From: Sarah Westcott Date: Mon, 5 Mar 2012 14:59:50 +0000 (-0500) Subject: fixed classify.seq error message when flip accnos file was blank. Fixed bug with... X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=a626c629e4d4840cd2ce04d98055dcfef1f8593a fixed classify.seq error message when flip accnos file was blank. Fixed bug with phylotype command related to the addition of "unknown" classification in phylotree. --- diff --git a/classifyseqscommand.cpp b/classifyseqscommand.cpp index 794b961..72acd22 100644 --- a/classifyseqscommand.cpp +++ b/classifyseqscommand.cpp @@ -905,16 +905,35 @@ int ClassifySeqsCommand::createProcesses(string taxFileName, string tempTaxFile, } #endif - + vector nonBlankAccnosFiles; + if (!(m->isBlank(accnos))) { nonBlankAccnosFiles.push_back(accnos); } + else { m->mothurRemove(accnos); } //remove so other files can be renamed to it + for(int i=0;iisBlank(accnos + toString(processIDS[i]) + ".temp"))) { + nonBlankAccnosFiles.push_back(accnos + toString(processIDS[i]) + ".temp"); + }else { m->mothurRemove((accnos + toString(processIDS[i]) + ".temp")); } + m->mothurRemove((m->getFullPathName(taxFileName) + toString(processIDS[i]) + ".temp")); m->mothurRemove((m->getFullPathName(tempTaxFile) + toString(processIDS[i]) + ".temp")); - m->mothurRemove((m->getFullPathName(accnos) + toString(processIDS[i]) + ".temp")); } + //append accnos files + if (nonBlankAccnosFiles.size() != 0) { + rename(nonBlankAccnosFiles[0].c_str(), accnos.c_str()); + + for (int h=1; h < nonBlankAccnosFiles.size(); h++) { + appendTaxFiles(nonBlankAccnosFiles[h], accnos); + m->mothurRemove(nonBlankAccnosFiles[h]); + } + }else { //recreate the accnosfile if needed + ofstream out; + m->openOutputFile(accnos, out); + out.close(); + } + return num; } diff --git a/phylotypecommand.cpp b/phylotypecommand.cpp index 1d6c391..f402f2a 100644 --- a/phylotypecommand.cpp +++ b/phylotypecommand.cpp @@ -244,13 +244,15 @@ 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 ','