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; }
86 vector<string> myArray = setParameters();
88 OptionParser parser(option);
89 map<string,string> parameters = parser.getParameters();
91 ValidParameters validParameter;
92 map<string,string>::iterator it;
94 //check to make sure all parameters are valid for command
95 for (it = parameters.begin(); it != parameters.end(); it++) {
96 if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; }
99 //initialize outputTypes
100 vector<string> tempOutNames;
101 outputTypes["fasta"] = tempOutNames;
102 outputTypes["taxonomy"] = tempOutNames;
103 outputTypes["name"] = tempOutNames;
104 outputTypes["group"] = tempOutNames;
105 outputTypes["alignreport"] = tempOutNames;
106 outputTypes["list"] = tempOutNames;
107 outputTypes["qfile"] = tempOutNames;
108 outputTypes["accnosreport"] = tempOutNames;
110 //if the user changes the output directory command factory will send this info to us in the output parameter
111 outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; }
113 //if the user changes the input directory command factory will send this info to us in the output parameter
114 string inputDir = validParameter.validFile(parameters, "inputdir", false);
115 if (inputDir == "not found"){ inputDir = ""; }
118 it = parameters.find("alignreport");
119 //user has given a template file
120 if(it != parameters.end()){
121 path = m->hasPath(it->second);
122 //if the user has not given a path then, add inputdir. else leave path alone.
123 if (path == "") { parameters["alignreport"] = inputDir + it->second; }
126 it = parameters.find("fasta");
127 //user has given a template file
128 if(it != parameters.end()){
129 path = m->hasPath(it->second);
130 //if the user has not given a path then, add inputdir. else leave path alone.
131 if (path == "") { parameters["fasta"] = inputDir + it->second; }
134 it = parameters.find("accnos");
135 //user has given a template file
136 if(it != parameters.end()){
137 path = m->hasPath(it->second);
138 //if the user has not given a path then, add inputdir. else leave path alone.
139 if (path == "") { parameters["accnos"] = inputDir + it->second; }
142 it = parameters.find("accnos2");
143 //user has given a template file
144 if(it != parameters.end()){
145 path = m->hasPath(it->second);
146 //if the user has not given a path then, add inputdir. else leave path alone.
147 if (path == "") { parameters["accnos2"] = inputDir + it->second; }
150 it = parameters.find("list");
151 //user has given a template file
152 if(it != parameters.end()){
153 path = m->hasPath(it->second);
154 //if the user has not given a path then, add inputdir. else leave path alone.
155 if (path == "") { parameters["list"] = inputDir + it->second; }
158 it = parameters.find("name");
159 //user has given a template file
160 if(it != parameters.end()){
161 path = m->hasPath(it->second);
162 //if the user has not given a path then, add inputdir. else leave path alone.
163 if (path == "") { parameters["name"] = inputDir + it->second; }
166 it = parameters.find("group");
167 //user has given a template file
168 if(it != parameters.end()){
169 path = m->hasPath(it->second);
170 //if the user has not given a path then, add inputdir. else leave path alone.
171 if (path == "") { parameters["group"] = inputDir + it->second; }
174 it = parameters.find("taxonomy");
175 //user has given a template file
176 if(it != parameters.end()){
177 path = m->hasPath(it->second);
178 //if the user has not given a path then, add inputdir. else leave path alone.
179 if (path == "") { parameters["taxonomy"] = inputDir + it->second; }
182 it = parameters.find("qfile");
183 //user has given a template file
184 if(it != parameters.end()){
185 path = m->hasPath(it->second);
186 //if the user has not given a path then, add inputdir. else leave path alone.
187 if (path == "") { parameters["qfile"] = inputDir + it->second; }
192 //check for required parameters
193 accnosfile = validParameter.validFile(parameters, "accnos", true);
194 if (accnosfile == "not open") { abort = true; }
195 else if (accnosfile == "not found") {
196 accnosfile = m->getAccnosFile();
197 if (accnosfile != "") { m->mothurOut("Using " + accnosfile + " as input file for the accnos parameter."); m->mothurOutEndLine(); }
199 m->mothurOut("You have no valid accnos file and accnos is required."); m->mothurOutEndLine();
204 if (accnosfile2 == "not found") { accnosfile2 = ""; }
206 fastafile = validParameter.validFile(parameters, "fasta", true);
207 if (fastafile == "not open") { abort = true; }
208 else if (fastafile == "not found") { fastafile = ""; }
210 namefile = validParameter.validFile(parameters, "name", true);
211 if (namefile == "not open") { abort = true; }
212 else if (namefile == "not found") { namefile = ""; }
214 groupfile = validParameter.validFile(parameters, "group", true);
215 if (groupfile == "not open") { abort = true; }
216 else if (groupfile == "not found") { groupfile = ""; }
218 alignfile = validParameter.validFile(parameters, "alignreport", true);
219 if (alignfile == "not open") { abort = true; }
220 else if (alignfile == "not found") { alignfile = ""; }
222 listfile = validParameter.validFile(parameters, "list", true);
223 if (listfile == "not open") { abort = true; }
224 else if (listfile == "not found") { listfile = ""; }
226 taxfile = validParameter.validFile(parameters, "taxonomy", true);
227 if (taxfile == "not open") { abort = true; }
228 else if (taxfile == "not found") { taxfile = ""; }
230 qualfile = validParameter.validFile(parameters, "qfile", true);
231 if (qualfile == "not open") { abort = true; }
232 else if (qualfile == "not found") { qualfile = ""; }
234 string usedDups = "true";
235 string temp = validParameter.validFile(parameters, "dups", false); if (temp == "not found") { temp = "true"; usedDups = ""; }
236 dups = m->isTrue(temp);
238 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; }
242 catch(exception& e) {
243 m->errorOut(e, "GetSeqsCommand", "GetSeqsCommand");
247 //**********************************************************************************************************************
249 int GetSeqsCommand::execute(){
252 if (abort == true) { if (calledHelp) { return 0; } return 2; }
254 //get names you want to keep
257 if (m->control_pressed) { return 0; }
259 //read through the correct file and output lines you want to keep
260 if (namefile != "") { readName(); }
261 if (fastafile != "") { readFasta(); }
262 if (groupfile != "") { readGroup(); }
263 if (alignfile != "") { readAlign(); }
264 if (listfile != "") { readList(); }
265 if (taxfile != "") { readTax(); }
266 if (qualfile != "") { readQual(); }
267 if (accnosfile2 != "") { compareAccnos(); }
269 if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
271 m->mothurOut("Selected " + toString(names.size()) + " sequences."); m->mothurOutEndLine();
273 if (outputNames.size() != 0) {
274 m->mothurOutEndLine();
275 m->mothurOut("Output File Names: "); m->mothurOutEndLine();
276 for (int i = 0; i < outputNames.size(); i++) { m->mothurOut(outputNames[i]); m->mothurOutEndLine(); }
277 m->mothurOutEndLine();
279 //set fasta file as new current fastafile
281 itTypes = outputTypes.find("fasta");
282 if (itTypes != outputTypes.end()) {
283 if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
286 itTypes = outputTypes.find("name");
287 if (itTypes != outputTypes.end()) {
288 if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
291 itTypes = outputTypes.find("group");
292 if (itTypes != outputTypes.end()) {
293 if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
296 itTypes = outputTypes.find("list");
297 if (itTypes != outputTypes.end()) {
298 if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
301 itTypes = outputTypes.find("taxonomy");
302 if (itTypes != outputTypes.end()) {
303 if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTaxonomyFile(current); }
306 itTypes = outputTypes.find("qfile");
307 if (itTypes != outputTypes.end()) {
308 if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setQualFile(current); }
316 catch(exception& e) {
317 m->errorOut(e, "GetSeqsCommand", "execute");
322 //**********************************************************************************************************************
323 int GetSeqsCommand::readFasta(){
325 string thisOutputDir = outputDir;
326 if (outputDir == "") { thisOutputDir += m->hasPath(fastafile); }
327 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(fastafile)) + "pick" + m->getExtension(fastafile);
329 m->openOutputFile(outputFileName, out);
333 m->openInputFile(fastafile, in);
336 bool wroteSomething = false;
340 if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
342 Sequence currSeq(in);
343 name = currSeq.getName();
346 //if this name is in the accnos file
347 if (names.count(name) != 0) {
348 wroteSomething = true;
350 currSeq.printSequence(out);
359 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
360 outputNames.push_back(outputFileName); outputTypes["fasta"].push_back(outputFileName);
365 catch(exception& e) {
366 m->errorOut(e, "GetSeqsCommand", "readFasta");
370 //**********************************************************************************************************************
371 int GetSeqsCommand::readQual(){
373 string thisOutputDir = outputDir;
374 if (outputDir == "") { thisOutputDir += m->hasPath(qualfile); }
375 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(qualfile)) + "pick" + m->getExtension(qualfile);
377 m->openOutputFile(outputFileName, out);
381 m->openInputFile(qualfile, in);
384 bool wroteSomething = false;
388 string saveName = "";
394 if (name.length() != 0) {
395 saveName = name.substr(1);
398 if (c == 10 || c == 13){ break; }
405 char letter= in.get();
406 if(letter == '>'){ in.putback(letter); break; }
407 else{ scores += letter; }
412 if (names.count(saveName) != 0) {
413 wroteSomething = true;
415 out << name << endl << scores;
424 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
425 outputNames.push_back(outputFileName); outputTypes["qfile"].push_back(outputFileName);
430 catch(exception& e) {
431 m->errorOut(e, "GetSeqsCommand", "readQual");
435 //**********************************************************************************************************************
436 int GetSeqsCommand::readList(){
438 string thisOutputDir = outputDir;
439 if (outputDir == "") { thisOutputDir += m->hasPath(listfile); }
440 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(listfile)) + "pick" + m->getExtension(listfile);
442 m->openOutputFile(outputFileName, out);
445 m->openInputFile(listfile, in);
447 bool wroteSomething = false;
451 if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
453 //read in list vector
456 //make a new list vector
458 newList.setLabel(list.getLabel());
461 for (int i = 0; i < list.getNumBins(); i++) {
463 //parse out names that are in accnos file
464 string binnames = list.get(i);
466 string newNames = "";
467 while (binnames.find_first_of(',') != -1) {
468 string name = binnames.substr(0,binnames.find_first_of(','));
469 binnames = binnames.substr(binnames.find_first_of(',')+1, binnames.length());
471 //if that name is in the .accnos file, add it
472 if (names.count(name) != 0) { newNames += name + ","; }
476 if (names.count(binnames) != 0) { newNames += binnames + ","; }
478 //if there are names in this bin add to new list
479 if (newNames != "") {
480 newNames = newNames.substr(0, newNames.length()-1); //rip off extra comma
481 newList.push_back(newNames);
485 //print new listvector
486 if (newList.getNumBins() != 0) {
487 wroteSomething = true;
496 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
497 outputNames.push_back(outputFileName); outputTypes["list"].push_back(outputFileName);
502 catch(exception& e) {
503 m->errorOut(e, "GetSeqsCommand", "readList");
507 //**********************************************************************************************************************
508 int GetSeqsCommand::readName(){
510 string thisOutputDir = outputDir;
511 if (outputDir == "") { thisOutputDir += m->hasPath(namefile); }
512 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(namefile)) + "pick" + m->getExtension(namefile);
514 m->openOutputFile(outputFileName, out);
518 m->openInputFile(namefile, in);
519 string name, firstCol, secondCol;
521 bool wroteSomething = false;
526 if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
532 if (dups) { hold = secondCol; }
534 vector<string> parsedNames;
535 m->splitAtComma(secondCol, parsedNames);
537 vector<string> validSecond;
538 for (int i = 0; i < parsedNames.size(); i++) {
539 if (names.count(parsedNames[i]) != 0) {
540 validSecond.push_back(parsedNames[i]);
544 if ((dups) && (validSecond.size() != 0)) { //dups = true and we want to add someone, then add everyone
545 for (int i = 0; i < parsedNames.size(); i++) { names.insert(parsedNames[i]); }
546 out << firstCol << '\t' << hold << endl;
547 wroteSomething = true;
549 //if the name in the first column is in the set then print it and any other names in second column also in set
550 if (names.count(firstCol) != 0) {
552 wroteSomething = true;
554 out << firstCol << '\t';
556 //you know you have at least one valid second since first column is valid
557 for (int i = 0; i < validSecond.size()-1; i++) { out << validSecond[i] << ','; }
558 out << validSecond[validSecond.size()-1] << endl;
561 //make first name in set you come to first column and then add the remaining names to second column
563 //you want part of this row
564 if (validSecond.size() != 0) {
566 wroteSomething = true;
568 out << validSecond[0] << '\t';
570 //you know you have at least one valid second since first column is valid
571 for (int i = 0; i < validSecond.size()-1; i++) { out << validSecond[i] << ','; }
572 out << validSecond[validSecond.size()-1] << endl;
581 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
582 outputNames.push_back(outputFileName); outputTypes["name"].push_back(outputFileName);
587 catch(exception& e) {
588 m->errorOut(e, "GetSeqsCommand", "readName");
593 //**********************************************************************************************************************
594 int GetSeqsCommand::readGroup(){
596 string thisOutputDir = outputDir;
597 if (outputDir == "") { thisOutputDir += m->hasPath(groupfile); }
598 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(groupfile)) + "pick" + m->getExtension(groupfile);
600 m->openOutputFile(outputFileName, out);
604 m->openInputFile(groupfile, in);
607 bool wroteSomething = false;
611 if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
614 in >> name; //read from first column
615 in >> group; //read from second column
617 //if this name is in the accnos file
618 if (names.count(name) != 0) {
619 wroteSomething = true;
621 out << name << '\t' << group << endl;
629 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
630 outputNames.push_back(outputFileName); outputTypes["group"].push_back(outputFileName);
635 catch(exception& e) {
636 m->errorOut(e, "GetSeqsCommand", "readGroup");
640 //**********************************************************************************************************************
641 int GetSeqsCommand::readTax(){
643 string thisOutputDir = outputDir;
644 if (outputDir == "") { thisOutputDir += m->hasPath(taxfile); }
645 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(taxfile)) + "pick" + m->getExtension(taxfile);
647 m->openOutputFile(outputFileName, out);
650 m->openInputFile(taxfile, in);
653 bool wroteSomething = false;
657 if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
659 in >> name; //read from first column
660 in >> tax; //read from second column
662 //if this name is in the accnos file
663 if (names.count(name) != 0) {
664 wroteSomething = true;
666 out << name << '\t' << tax << endl;
674 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
675 outputNames.push_back(outputFileName); outputTypes["taxonomy"].push_back(outputFileName);
680 catch(exception& e) {
681 m->errorOut(e, "GetSeqsCommand", "readTax");
685 //**********************************************************************************************************************
686 //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
687 int GetSeqsCommand::readAlign(){
689 string thisOutputDir = outputDir;
690 if (outputDir == "") { thisOutputDir += m->hasPath(alignfile); }
691 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(alignfile)) + "pick.align.report";
693 m->openOutputFile(outputFileName, out);
697 m->openInputFile(alignfile, in);
700 bool wroteSomething = false;
702 //read column headers
703 for (int i = 0; i < 16; i++) {
704 if (!in.eof()) { in >> junk; out << junk << '\t'; }
711 if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
714 in >> name; //read from first column
716 //if this name is in the accnos file
717 if (names.count(name) != 0) {
718 wroteSomething = true;
723 for (int i = 0; i < 15; i++) {
724 if (!in.eof()) { in >> junk; out << junk << '\t'; }
729 }else {//still read just don't do anything with it
731 for (int i = 0; i < 15; i++) {
732 if (!in.eof()) { in >> junk; }
742 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
743 outputNames.push_back(outputFileName); outputTypes["alignreport"].push_back(outputFileName);
748 catch(exception& e) {
749 m->errorOut(e, "GetSeqsCommand", "readAlign");
753 //**********************************************************************************************************************
755 int GetSeqsCommand::readAccnos(){
759 m->openInputFile(accnosfile, in);
774 catch(exception& e) {
775 m->errorOut(e, "GetSeqsCommand", "readAccnos");
779 //**********************************************************************************************************************
781 int GetSeqsCommand::compareAccnos(){
784 string thisOutputDir = outputDir;
785 if (outputDir == "") { thisOutputDir += m->hasPath(accnosfile); }
786 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(accnosfile)) + "accnos.report";
788 m->openOutputFile(outputFileName, out);
791 m->openInputFile(accnosfile2, in);
794 set<string> namesAccnos2;
795 set<string> namesDups;
796 set<string> namesAccnos = names;
798 map<string, int> nameCount;
800 if (namefile != "") {
802 m->openInputFile(namefile, inName);
805 while(!inName.eof()){
807 if (m->control_pressed) { inName.close(); return 0; }
809 string thisname, repnames;
811 inName >> thisname; m->gobble(inName); //read from first column
812 inName >> repnames; //read from second column
814 int num = m->getNumNames(repnames);
815 nameCount[thisname] = num;
825 if (namesAccnos.count(name) == 0){ //name unique to accnos2
826 namesAccnos2.insert(name);
827 }else { //you are in both so erase
828 namesAccnos.erase(name);
829 namesDups.insert(name);
836 out << "Names in both files : " + toString(namesDups.size()) << endl;
837 m->mothurOut("Names in both files : " + toString(namesDups.size())); m->mothurOutEndLine();
839 for (set<string>::iterator it = namesDups.begin(); it != namesDups.end(); it++) {
841 if (namefile != "") { out << '\t' << nameCount[(*it)]; }
845 out << "Names unique to " + accnosfile + " : " + toString(namesAccnos.size()) << endl;
846 m->mothurOut("Names unique to " + accnosfile + " : " + toString(namesAccnos.size())); m->mothurOutEndLine();
848 for (set<string>::iterator it = namesAccnos.begin(); it != namesAccnos.end(); it++) {
850 if (namefile != "") { out << '\t' << nameCount[(*it)]; }
854 out << "Names unique to " + accnosfile2 + " : " + toString(namesAccnos2.size()) << endl;
855 m->mothurOut("Names unique to " + accnosfile2 + " : " + toString(namesAccnos2.size())); m->mothurOutEndLine();
857 for (set<string>::iterator it = namesAccnos2.begin(); it != namesAccnos2.end(); it++) {
859 if (namefile != "") { out << '\t' << nameCount[(*it)]; }
865 outputNames.push_back(outputFileName); outputTypes["accnosreport"].push_back(outputFileName);
870 catch(exception& e) {
871 m->errorOut(e, "GetSeqsCommand", "readAccnos");
877 //**********************************************************************************************************************