}
#endif
-
+ vector<string> 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;i<processIDS.size();i++){
appendTaxFiles((taxFileName + toString(processIDS[i]) + ".temp"), taxFileName);
appendTaxFiles((tempTaxFile + toString(processIDS[i]) + ".temp"), tempTaxFile);
- appendTaxFiles((accnos + toString(processIDS[i]) + ".temp"), accnos);
+ if (!(m->isBlank(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;
}
//make the names compatable with listvector
string name = "";
for (int i = 0; i < names.size(); i++) {
- if (namefile != "") {
- map<string, string>::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<string, string>::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 ','