+
+ if (taxonomyfile != "") {
+ if (namefile == "") {
+ InputData input(listfile, "list");
+ ListVector* list = input.getListVector();
+ string lastLabel = list->getLabel();
+
+ for (int i = 0; i < list->getNumBins(); i++) {
+ vector<string> temp;
+ string bin = list->get(i);
+ m->splitAtComma(bin, temp);
+ for (int j = 0; j < temp.size(); j++) { vector<string> tempFakeOut; tempFakeOut.push_back(temp[j]); nameMap[temp[j]] = tempFakeOut; }
+ }
+ delete list;
+
+ int tcount = getTax(subset);
+ if (tcount != subset.size()) { m->mothurOut("[ERROR]: subsampled list file contains " + toString(subset.size()) + " sequences, but I only found " + toString(tcount) + " in your taxonomy file, did you forget a name file? Please correct."); m->mothurOutEndLine(); }
+ }else {
+ string tempAccnos = "temp.accnos";
+ ofstream outAccnos;
+ m->openOutputFile(tempAccnos, outAccnos);
+ for (set<string>::iterator it = subset.begin(); it != subset.end(); it++) { outAccnos << *it << endl; }
+ outAccnos.close();
+
+ m->mothurOut("Sampling taxonomy and name file... "); m->mothurOutEndLine();
+ string thisNameOutputDir = outputDir;
+ if (outputDir == "") { thisNameOutputDir += m->hasPath(namefile); }
+ map<string, string> variables;
+ variables["[filename]"] = thisNameOutputDir + m->getRootName(m->getSimpleName(namefile));
+ variables["[extension]"] = m->getExtension(namefile);
+ string outputNameFileName = getOutputFileName("name", variables);
+
+ string thisTaxOutputDir = outputDir;
+ if (outputDir == "") { thisTaxOutputDir += m->hasPath(taxonomyfile); }
+ variables["[filename]"] = thisTaxOutputDir + m->getRootName(m->getSimpleName(taxonomyfile));
+ variables["[extension]"] = m->getExtension(taxonomyfile);
+ string outputTaxFileName = getOutputFileName("taxonomy", variables);
+
+
+ //use unique.seqs to create new name and fastafile
+ string inputString = "dups=f, name=" + namefile + ", taxonomy=" + taxonomyfile + ", accnos=" + tempAccnos;
+ m->mothurOut("/******************************************/"); m->mothurOutEndLine();
+ m->mothurOut("Running command: get.seqs(" + inputString + ")"); m->mothurOutEndLine();
+ m->mothurCalling = true;
+
+ Command* getCommand = new GetSeqsCommand(inputString);
+ getCommand->execute();
+
+ map<string, vector<string> > filenames = getCommand->getOutputFiles();
+
+ delete getCommand;
+ m->mothurCalling = false;
+
+ m->renameFile(filenames["name"][0], outputNameFileName);
+ m->renameFile(filenames["taxonomy"][0], outputTaxFileName);
+
+ outputTypes["name"].push_back(outputNameFileName); outputNames.push_back(outputNameFileName);
+ outputNames.push_back(outputTaxFileName); outputTypes["taxonomy"].push_back(outputTaxFileName);
+
+ m->mothurOut("/******************************************/"); m->mothurOutEndLine();
+
+ m->mothurOut("Done."); m->mothurOutEndLine();
+ }
+ }