5 * Created by Sarah Westcott on 7/8/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "getseqscommand.h"
11 #include "sequence.hpp"
12 #include "listvector.hpp"
14 //**********************************************************************************************************************
15 vector<string> GetSeqsCommand::setParameters(){
17 CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(pfasta);
18 CommandParameter pname("name", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(pname);
19 CommandParameter pgroup("group", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(pgroup);
20 CommandParameter plist("list", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(plist);
21 CommandParameter ptaxonomy("taxonomy", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(ptaxonomy);
22 CommandParameter palignreport("alignreport", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(palignreport);
23 CommandParameter pqfile("qfile", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(pqfile);
24 CommandParameter paccnos("accnos", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(paccnos);
25 CommandParameter pdups("dups", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(pdups);
26 CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
27 CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
29 vector<string> myArray;
30 for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); }
34 m->errorOut(e, "GetSeqsCommand", "setParameters");
38 //**********************************************************************************************************************
39 string GetSeqsCommand::getHelpString(){
41 string helpString = "";
42 helpString += "The get.seqs command reads an .accnos file and any of the following file types: fasta, name, group, list, taxonomy, quality or alignreport file.\n";
43 helpString += "It outputs a file containing only the sequences in the .accnos file.\n";
44 helpString += "The get.seqs command parameters are accnos, fasta, name, group, list, taxonomy, qfile, alignreport and dups. You must provide accnos unless you have a valid current accnos file, and at least one of the other parameters.\n";
45 helpString += "The dups parameter allows you to add the entire line from a name file if you add any name from the line. default=false. \n";
46 helpString += "The get.seqs command should be in the following format: get.seqs(accnos=yourAccnos, fasta=yourFasta).\n";
47 helpString += "Example get.seqs(accnos=amazon.accnos, fasta=amazon.fasta).\n";
48 helpString += "Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n";
52 m->errorOut(e, "GetSeqsCommand", "getHelpString");
57 //**********************************************************************************************************************
58 GetSeqsCommand::GetSeqsCommand(){
60 abort = true; calledHelp = true;
62 vector<string> tempOutNames;
63 outputTypes["fasta"] = tempOutNames;
64 outputTypes["taxonomy"] = tempOutNames;
65 outputTypes["name"] = tempOutNames;
66 outputTypes["group"] = tempOutNames;
67 outputTypes["alignreport"] = tempOutNames;
68 outputTypes["list"] = tempOutNames;
69 outputTypes["qfile"] = tempOutNames;
70 outputTypes["accnosreport"] = tempOutNames;
73 m->errorOut(e, "GetSeqsCommand", "GetSeqsCommand");
77 //**********************************************************************************************************************
78 GetSeqsCommand::GetSeqsCommand(string option) {
80 abort = false; calledHelp = false;
82 //allow user to run help
83 if(option == "help") { help(); abort = true; calledHelp = true; }
84 else if(option == "citation") { citation(); abort = true; calledHelp = true;}
87 vector<string> myArray = setParameters();
89 OptionParser parser(option);
90 map<string,string> parameters = parser.getParameters();
92 ValidParameters validParameter;
93 map<string,string>::iterator it;
95 //check to make sure all parameters are valid for command
96 for (it = parameters.begin(); it != parameters.end(); it++) {
97 if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; }
100 //initialize outputTypes
101 vector<string> tempOutNames;
102 outputTypes["fasta"] = tempOutNames;
103 outputTypes["taxonomy"] = tempOutNames;
104 outputTypes["name"] = tempOutNames;
105 outputTypes["group"] = tempOutNames;
106 outputTypes["alignreport"] = tempOutNames;
107 outputTypes["list"] = tempOutNames;
108 outputTypes["qfile"] = tempOutNames;
109 outputTypes["accnosreport"] = tempOutNames;
111 //if the user changes the output directory command factory will send this info to us in the output parameter
112 outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; }
114 //if the user changes the input directory command factory will send this info to us in the output parameter
115 string inputDir = validParameter.validFile(parameters, "inputdir", false);
116 if (inputDir == "not found"){ inputDir = ""; }
119 it = parameters.find("alignreport");
120 //user has given a template file
121 if(it != parameters.end()){
122 path = m->hasPath(it->second);
123 //if the user has not given a path then, add inputdir. else leave path alone.
124 if (path == "") { parameters["alignreport"] = inputDir + it->second; }
127 it = parameters.find("fasta");
128 //user has given a template file
129 if(it != parameters.end()){
130 path = m->hasPath(it->second);
131 //if the user has not given a path then, add inputdir. else leave path alone.
132 if (path == "") { parameters["fasta"] = inputDir + it->second; }
135 it = parameters.find("accnos");
136 //user has given a template file
137 if(it != parameters.end()){
138 path = m->hasPath(it->second);
139 //if the user has not given a path then, add inputdir. else leave path alone.
140 if (path == "") { parameters["accnos"] = inputDir + it->second; }
143 it = parameters.find("accnos2");
144 //user has given a template file
145 if(it != parameters.end()){
146 path = m->hasPath(it->second);
147 //if the user has not given a path then, add inputdir. else leave path alone.
148 if (path == "") { parameters["accnos2"] = inputDir + it->second; }
151 it = parameters.find("list");
152 //user has given a template file
153 if(it != parameters.end()){
154 path = m->hasPath(it->second);
155 //if the user has not given a path then, add inputdir. else leave path alone.
156 if (path == "") { parameters["list"] = inputDir + it->second; }
159 it = parameters.find("name");
160 //user has given a template file
161 if(it != parameters.end()){
162 path = m->hasPath(it->second);
163 //if the user has not given a path then, add inputdir. else leave path alone.
164 if (path == "") { parameters["name"] = inputDir + it->second; }
167 it = parameters.find("group");
168 //user has given a template file
169 if(it != parameters.end()){
170 path = m->hasPath(it->second);
171 //if the user has not given a path then, add inputdir. else leave path alone.
172 if (path == "") { parameters["group"] = inputDir + it->second; }
175 it = parameters.find("taxonomy");
176 //user has given a template file
177 if(it != parameters.end()){
178 path = m->hasPath(it->second);
179 //if the user has not given a path then, add inputdir. else leave path alone.
180 if (path == "") { parameters["taxonomy"] = inputDir + it->second; }
183 it = parameters.find("qfile");
184 //user has given a template file
185 if(it != parameters.end()){
186 path = m->hasPath(it->second);
187 //if the user has not given a path then, add inputdir. else leave path alone.
188 if (path == "") { parameters["qfile"] = inputDir + it->second; }
193 //check for required parameters
194 accnosfile = validParameter.validFile(parameters, "accnos", true);
195 if (accnosfile == "not open") { abort = true; }
196 else if (accnosfile == "not found") {
197 accnosfile = m->getAccnosFile();
198 if (accnosfile != "") { m->mothurOut("Using " + accnosfile + " as input file for the accnos parameter."); m->mothurOutEndLine(); }
200 m->mothurOut("You have no valid accnos file and accnos is required."); m->mothurOutEndLine();
205 if (accnosfile2 == "not found") { accnosfile2 = ""; }
207 fastafile = validParameter.validFile(parameters, "fasta", true);
208 if (fastafile == "not open") { abort = true; }
209 else if (fastafile == "not found") { fastafile = ""; }
211 namefile = validParameter.validFile(parameters, "name", true);
212 if (namefile == "not open") { abort = true; }
213 else if (namefile == "not found") { namefile = ""; }
215 groupfile = validParameter.validFile(parameters, "group", true);
216 if (groupfile == "not open") { abort = true; }
217 else if (groupfile == "not found") { groupfile = ""; }
219 alignfile = validParameter.validFile(parameters, "alignreport", true);
220 if (alignfile == "not open") { abort = true; }
221 else if (alignfile == "not found") { alignfile = ""; }
223 listfile = validParameter.validFile(parameters, "list", true);
224 if (listfile == "not open") { abort = true; }
225 else if (listfile == "not found") { listfile = ""; }
227 taxfile = validParameter.validFile(parameters, "taxonomy", true);
228 if (taxfile == "not open") { abort = true; }
229 else if (taxfile == "not found") { taxfile = ""; }
231 qualfile = validParameter.validFile(parameters, "qfile", true);
232 if (qualfile == "not open") { abort = true; }
233 else if (qualfile == "not found") { qualfile = ""; }
235 string usedDups = "true";
236 string temp = validParameter.validFile(parameters, "dups", false); if (temp == "not found") { temp = "true"; usedDups = ""; }
237 dups = m->isTrue(temp);
239 if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "") && (listfile == "") && (taxfile == "") && (qualfile == "") && (accnosfile2 == "")) { m->mothurOut("You must provide one of the following: fasta, name, group, alignreport, taxonomy, quality or listfile."); m->mothurOutEndLine(); abort = true; }
243 catch(exception& e) {
244 m->errorOut(e, "GetSeqsCommand", "GetSeqsCommand");
248 //**********************************************************************************************************************
250 int GetSeqsCommand::execute(){
253 if (abort == true) { if (calledHelp) { return 0; } return 2; }
255 //get names you want to keep
258 if (m->control_pressed) { return 0; }
260 //read through the correct file and output lines you want to keep
261 if (namefile != "") { readName(); }
262 if (fastafile != "") { readFasta(); }
263 if (groupfile != "") { readGroup(); }
264 if (alignfile != "") { readAlign(); }
265 if (listfile != "") { readList(); }
266 if (taxfile != "") { readTax(); }
267 if (qualfile != "") { readQual(); }
268 if (accnosfile2 != "") { compareAccnos(); }
270 if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
272 m->mothurOut("Selected " + toString(names.size()) + " sequences."); m->mothurOutEndLine();
274 if (outputNames.size() != 0) {
275 m->mothurOutEndLine();
276 m->mothurOut("Output File Names: "); m->mothurOutEndLine();
277 for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
278 m->mothurOutEndLine();
280 //set fasta file as new current fastafile
282 itTypes = outputTypes.find("fasta");
283 if (itTypes != outputTypes.end()) {
284 if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
287 itTypes = outputTypes.find("name");
288 if (itTypes != outputTypes.end()) {
289 if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
292 itTypes = outputTypes.find("group");
293 if (itTypes != outputTypes.end()) {
294 if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
297 itTypes = outputTypes.find("list");
298 if (itTypes != outputTypes.end()) {
299 if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
302 itTypes = outputTypes.find("taxonomy");
303 if (itTypes != outputTypes.end()) {
304 if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTaxonomyFile(current); }
307 itTypes = outputTypes.find("qfile");
308 if (itTypes != outputTypes.end()) {
309 if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setQualFile(current); }
317 catch(exception& e) {
318 m->errorOut(e, "GetSeqsCommand", "execute");
323 //**********************************************************************************************************************
324 int GetSeqsCommand::readFasta(){
326 string thisOutputDir = outputDir;
327 if (outputDir == "") { thisOutputDir += m->hasPath(fastafile); }
328 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(fastafile)) + "pick" + m->getExtension(fastafile);
330 m->openOutputFile(outputFileName, out);
334 m->openInputFile(fastafile, in);
337 bool wroteSomething = false;
341 if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
343 Sequence currSeq(in);
344 name = currSeq.getName();
347 //if this name is in the accnos file
348 if (names.count(name) != 0) {
349 wroteSomething = true;
351 currSeq.printSequence(out);
360 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
361 outputNames.push_back(outputFileName); outputTypes["fasta"].push_back(outputFileName);
366 catch(exception& e) {
367 m->errorOut(e, "GetSeqsCommand", "readFasta");
371 //**********************************************************************************************************************
372 int GetSeqsCommand::readQual(){
374 string thisOutputDir = outputDir;
375 if (outputDir == "") { thisOutputDir += m->hasPath(qualfile); }
376 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(qualfile)) + "pick" + m->getExtension(qualfile);
378 m->openOutputFile(outputFileName, out);
382 m->openInputFile(qualfile, in);
385 bool wroteSomething = false;
389 string saveName = "";
395 if (name.length() != 0) {
396 saveName = name.substr(1);
399 if (c == 10 || c == 13){ break; }
406 char letter= in.get();
407 if(letter == '>'){ in.putback(letter); break; }
408 else{ scores += letter; }
413 if (names.count(saveName) != 0) {
414 wroteSomething = true;
416 out << name << endl << scores;
425 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
426 outputNames.push_back(outputFileName); outputTypes["qfile"].push_back(outputFileName);
431 catch(exception& e) {
432 m->errorOut(e, "GetSeqsCommand", "readQual");
436 //**********************************************************************************************************************
437 int GetSeqsCommand::readList(){
439 string thisOutputDir = outputDir;
440 if (outputDir == "") { thisOutputDir += m->hasPath(listfile); }
441 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(listfile)) + "pick" + m->getExtension(listfile);
443 m->openOutputFile(outputFileName, out);
446 m->openInputFile(listfile, in);
448 bool wroteSomething = false;
452 if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
454 //read in list vector
457 //make a new list vector
459 newList.setLabel(list.getLabel());
462 for (int i = 0; i < list.getNumBins(); i++) {
464 //parse out names that are in accnos file
465 string binnames = list.get(i);
467 string newNames = "";
468 while (binnames.find_first_of(',') != -1) {
469 string name = binnames.substr(0,binnames.find_first_of(','));
470 binnames = binnames.substr(binnames.find_first_of(',')+1, binnames.length());
472 //if that name is in the .accnos file, add it
473 if (names.count(name) != 0) { newNames += name + ","; }
477 if (names.count(binnames) != 0) { newNames += binnames + ","; }
479 //if there are names in this bin add to new list
480 if (newNames != "") {
481 newNames = newNames.substr(0, newNames.length()-1); //rip off extra comma
482 newList.push_back(newNames);
486 //print new listvector
487 if (newList.getNumBins() != 0) {
488 wroteSomething = true;
497 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
498 outputNames.push_back(outputFileName); outputTypes["list"].push_back(outputFileName);
503 catch(exception& e) {
504 m->errorOut(e, "GetSeqsCommand", "readList");
508 //**********************************************************************************************************************
509 int GetSeqsCommand::readName(){
511 string thisOutputDir = outputDir;
512 if (outputDir == "") { thisOutputDir += m->hasPath(namefile); }
513 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(namefile)) + "pick" + m->getExtension(namefile);
515 m->openOutputFile(outputFileName, out);
519 m->openInputFile(namefile, in);
520 string name, firstCol, secondCol;
522 bool wroteSomething = false;
527 if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
533 if (dups) { hold = secondCol; }
535 vector<string> parsedNames;
536 m->splitAtComma(secondCol, parsedNames);
538 vector<string> validSecond;
539 for (int i = 0; i < parsedNames.size(); i++) {
540 if (names.count(parsedNames[i]) != 0) {
541 validSecond.push_back(parsedNames[i]);
545 if ((dups) && (validSecond.size() != 0)) { //dups = true and we want to add someone, then add everyone
546 for (int i = 0; i < parsedNames.size(); i++) { names.insert(parsedNames[i]); }
547 out << firstCol << '\t' << hold << endl;
548 wroteSomething = true;
550 //if the name in the first column is in the set then print it and any other names in second column also in set
551 if (names.count(firstCol) != 0) {
553 wroteSomething = true;
555 out << firstCol << '\t';
557 //you know you have at least one valid second since first column is valid
558 for (int i = 0; i < validSecond.size()-1; i++) { out << validSecond[i] << ','; }
559 out << validSecond[validSecond.size()-1] << endl;
562 //make first name in set you come to first column and then add the remaining names to second column
564 //you want part of this row
565 if (validSecond.size() != 0) {
567 wroteSomething = true;
569 out << validSecond[0] << '\t';
571 //you know you have at least one valid second since first column is valid
572 for (int i = 0; i < validSecond.size()-1; i++) { out << validSecond[i] << ','; }
573 out << validSecond[validSecond.size()-1] << endl;
582 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
583 outputNames.push_back(outputFileName); outputTypes["name"].push_back(outputFileName);
588 catch(exception& e) {
589 m->errorOut(e, "GetSeqsCommand", "readName");
594 //**********************************************************************************************************************
595 int GetSeqsCommand::readGroup(){
597 string thisOutputDir = outputDir;
598 if (outputDir == "") { thisOutputDir += m->hasPath(groupfile); }
599 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(groupfile)) + "pick" + m->getExtension(groupfile);
601 m->openOutputFile(outputFileName, out);
605 m->openInputFile(groupfile, in);
608 bool wroteSomething = false;
612 if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
615 in >> name; //read from first column
616 in >> group; //read from second column
618 //if this name is in the accnos file
619 if (names.count(name) != 0) {
620 wroteSomething = true;
622 out << name << '\t' << group << endl;
630 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
631 outputNames.push_back(outputFileName); outputTypes["group"].push_back(outputFileName);
636 catch(exception& e) {
637 m->errorOut(e, "GetSeqsCommand", "readGroup");
641 //**********************************************************************************************************************
642 int GetSeqsCommand::readTax(){
644 string thisOutputDir = outputDir;
645 if (outputDir == "") { thisOutputDir += m->hasPath(taxfile); }
646 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(taxfile)) + "pick" + m->getExtension(taxfile);
648 m->openOutputFile(outputFileName, out);
651 m->openInputFile(taxfile, in);
654 bool wroteSomething = false;
658 if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
660 in >> name; //read from first column
661 in >> tax; //read from second column
663 //if this name is in the accnos file
664 if (names.count(name) != 0) {
665 wroteSomething = true;
667 out << name << '\t' << tax << endl;
675 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
676 outputNames.push_back(outputFileName); outputTypes["taxonomy"].push_back(outputFileName);
681 catch(exception& e) {
682 m->errorOut(e, "GetSeqsCommand", "readTax");
686 //**********************************************************************************************************************
687 //alignreport file has a column header line then all other lines contain 16 columns. we just want the first column since that contains the name
688 int GetSeqsCommand::readAlign(){
690 string thisOutputDir = outputDir;
691 if (outputDir == "") { thisOutputDir += m->hasPath(alignfile); }
692 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(alignfile)) + "pick.align.report";
694 m->openOutputFile(outputFileName, out);
698 m->openInputFile(alignfile, in);
701 bool wroteSomething = false;
703 //read column headers
704 for (int i = 0; i < 16; i++) {
705 if (!in.eof()) { in >> junk; out << junk << '\t'; }
712 if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
715 in >> name; //read from first column
717 //if this name is in the accnos file
718 if (names.count(name) != 0) {
719 wroteSomething = true;
724 for (int i = 0; i < 15; i++) {
725 if (!in.eof()) { in >> junk; out << junk << '\t'; }
730 }else {//still read just don't do anything with it
732 for (int i = 0; i < 15; i++) {
733 if (!in.eof()) { in >> junk; }
743 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
744 outputNames.push_back(outputFileName); outputTypes["alignreport"].push_back(outputFileName);
749 catch(exception& e) {
750 m->errorOut(e, "GetSeqsCommand", "readAlign");
754 //**********************************************************************************************************************
756 int GetSeqsCommand::readAccnos(){
760 m->openInputFile(accnosfile, in);
775 catch(exception& e) {
776 m->errorOut(e, "GetSeqsCommand", "readAccnos");
780 //**********************************************************************************************************************
782 int GetSeqsCommand::compareAccnos(){
785 string thisOutputDir = outputDir;
786 if (outputDir == "") { thisOutputDir += m->hasPath(accnosfile); }
787 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(accnosfile)) + "accnos.report";
789 m->openOutputFile(outputFileName, out);
792 m->openInputFile(accnosfile2, in);
795 set<string> namesAccnos2;
796 set<string> namesDups;
797 set<string> namesAccnos = names;
799 map<string, int> nameCount;
801 if (namefile != "") {
803 m->openInputFile(namefile, inName);
806 while(!inName.eof()){
808 if (m->control_pressed) { inName.close(); return 0; }
810 string thisname, repnames;
812 inName >> thisname; m->gobble(inName); //read from first column
813 inName >> repnames; //read from second column
815 int num = m->getNumNames(repnames);
816 nameCount[thisname] = num;
826 if (namesAccnos.count(name) == 0){ //name unique to accnos2
827 namesAccnos2.insert(name);
828 }else { //you are in both so erase
829 namesAccnos.erase(name);
830 namesDups.insert(name);
837 out << "Names in both files : " + toString(namesDups.size()) << endl;
838 m->mothurOut("Names in both files : " + toString(namesDups.size())); m->mothurOutEndLine();
840 for (set<string>::iterator it = namesDups.begin(); it != namesDups.end(); it++) {
842 if (namefile != "") { out << '\t' << nameCount[(*it)]; }
846 out << "Names unique to " + accnosfile + " : " + toString(namesAccnos.size()) << endl;
847 m->mothurOut("Names unique to " + accnosfile + " : " + toString(namesAccnos.size())); m->mothurOutEndLine();
849 for (set<string>::iterator it = namesAccnos.begin(); it != namesAccnos.end(); it++) {
851 if (namefile != "") { out << '\t' << nameCount[(*it)]; }
855 out << "Names unique to " + accnosfile2 + " : " + toString(namesAccnos2.size()) << endl;
856 m->mothurOut("Names unique to " + accnosfile2 + " : " + toString(namesAccnos2.size())); m->mothurOutEndLine();
858 for (set<string>::iterator it = namesAccnos2.begin(); it != namesAccnos2.end(); it++) {
860 if (namefile != "") { out << '\t' << nameCount[(*it)]; }
866 outputNames.push_back(outputFileName); outputTypes["accnosreport"].push_back(outputFileName);
871 catch(exception& e) {
872 m->errorOut(e, "GetSeqsCommand", "readAccnos");
878 //**********************************************************************************************************************