X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=phylotypecommand.cpp;h=2d2db08a40ea5e1aa8712902dcd419ddb1ad757a;hb=2009a1a1f47e7467094d844e7c07ab8ddf7bb447;hp=e6dace8b796103804c16a4de86104cff0b05da4f;hpb=19fcbbdba99658f5eca244803280f9ee7f9f6607;p=mothur.git diff --git a/phylotypecommand.cpp b/phylotypecommand.cpp index e6dace8..2d2db08 100644 --- a/phylotypecommand.cpp +++ b/phylotypecommand.cpp @@ -128,11 +128,11 @@ PhylotypeCommand::PhylotypeCommand(string option) { m->mothurOut("No valid current files. taxonomy is a required parameter."); m->mothurOutEndLine(); abort = true; } - }else if (taxonomyFileName == "not open") { abort = true; } + }else if (taxonomyFileName == "not open") { taxonomyFileName = ""; abort = true; } else { m->setTaxonomyFile(taxonomyFileName); } namefile = validParameter.validFile(parameters, "name", true); - if (namefile == "not open") { abort = true; } + if (namefile == "not open") { namefile = ""; abort = true; } else if (namefile == "not found") { namefile = ""; } else { readNamesFile(); m->setNameFile(namefile); } @@ -144,7 +144,7 @@ PhylotypeCommand::PhylotypeCommand(string option) { string temp = validParameter.validFile(parameters, "cutoff", false); if (temp == "not found") { temp = "-1"; } - convert(temp, cutoff); + m->mothurConvert(temp, cutoff); label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; allLines = 1; } @@ -153,6 +153,11 @@ PhylotypeCommand::PhylotypeCommand(string option) { else { allLines = 1; } } + if (namefile == "") { + vector files; files.push_back(taxonomyFileName); + parser.getNameFile(files); + } + } } catch(exception& e) { @@ -227,6 +232,7 @@ int PhylotypeCommand::execute(){ ListVector list; list.setLabel(level); + //go through nodes and build listvector for (itCurrent = currentNodes.begin(); itCurrent != currentNodes.end(); itCurrent++) { @@ -239,18 +245,20 @@ int PhylotypeCommand::execute(){ //make the names compatable with listvector string name = ""; for (int i = 0; i < names.size(); i++) { - if (namefile != "") { - map::iterator itNames = namemap.find(names[i]); //make sure this name is in namefile - - if (itNames != namemap.end()) { name += namemap[names[i]] + ","; } //you found it in namefile - else { m->mothurOut(names[i] + " is not in your namefile, please correct."); m->mothurOutEndLine(); exit(1); } - - }else{ name += names[i] + ","; } + + if (names[i] != "unknown") { + if (namefile != "") { + map::iterator itNames = namemap.find(names[i]); //make sure this name is in namefile + + if (itNames != namemap.end()) { name += namemap[names[i]] + ","; } //you found it in namefile + else { m->mothurOut(names[i] + " is not in your namefile, please correct."); m->mothurOutEndLine(); exit(1); } + + }else{ name += names[i] + ","; } + } } name = name.substr(0, name.length()-1); //rip off extra ',' - //add bin to list vector - list.push_back(name); + if (name != "") { list.push_back(name); } //caused by unknown } //print listvector