]> git.donarmstrong.com Git - mothur.git/blob - getseqscommand.cpp
fixes while testing
[mothur.git] / getseqscommand.cpp
1 /*
2  *  getseqscommand.cpp
3  *  Mothur
4  *
5  *  Created by Sarah Westcott on 7/8/09.
6  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "getseqscommand.h"
11 #include "sequence.hpp"
12 #include "listvector.hpp"
13
14 //**********************************************************************************************************************
15 vector<string> GetSeqsCommand::getValidParameters(){    
16         try {
17                 string Array[] =  {"fasta","name", "group", "alignreport", "accnos", "dups", "list","taxonomy","outputdir","inputdir"};
18                 vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
19                 return myArray;
20         }
21         catch(exception& e) {
22                 m->errorOut(e, "GetSeqsCommand", "getValidParameters");
23                 exit(1);
24         }
25 }
26 //**********************************************************************************************************************
27 GetSeqsCommand::GetSeqsCommand(){       
28         try {
29                 abort = true;
30                 //initialize outputTypes
31                 vector<string> tempOutNames;
32                 outputTypes["fasta"] = tempOutNames;
33                 outputTypes["taxonomy"] = tempOutNames;
34                 outputTypes["name"] = tempOutNames;
35                 outputTypes["group"] = tempOutNames;
36                 outputTypes["alignreport"] = tempOutNames;
37                 outputTypes["list"] = tempOutNames;
38         }
39         catch(exception& e) {
40                 m->errorOut(e, "GetSeqsCommand", "GetSeqsCommand");
41                 exit(1);
42         }
43 }
44 //**********************************************************************************************************************
45 vector<string> GetSeqsCommand::getRequiredParameters(){ 
46         try {
47                 string Array[] =  {"accnos"};
48                 vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
49                 return myArray;
50         }
51         catch(exception& e) {
52                 m->errorOut(e, "GetSeqsCommand", "getRequiredParameters");
53                 exit(1);
54         }
55 }
56 //**********************************************************************************************************************
57 vector<string> GetSeqsCommand::getRequiredFiles(){      
58         try {
59                 vector<string> myArray;
60                 return myArray;
61         }
62         catch(exception& e) {
63                 m->errorOut(e, "GetSeqsCommand", "getRequiredFiles");
64                 exit(1);
65         }
66 }
67 //**********************************************************************************************************************
68 GetSeqsCommand::GetSeqsCommand(string option)  {
69         try {
70                 abort = false;
71                                 
72                 //allow user to run help
73                 if(option == "help") { help(); abort = true; }
74                 
75                 else {
76                         //valid paramters for this command
77                         string Array[] =  {"fasta","name", "group", "alignreport", "accnos", "dups", "list","taxonomy","outputdir","inputdir"};
78                         vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
79                         
80                         OptionParser parser(option);
81                         map<string,string> parameters = parser.getParameters();
82                         
83                         ValidParameters validParameter;
84                         map<string,string>::iterator it;
85                         
86                         //check to make sure all parameters are valid for command
87                         for (it = parameters.begin(); it != parameters.end(); it++) { 
88                                 if (validParameter.isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }
89                         }
90                         
91                         //initialize outputTypes
92                         vector<string> tempOutNames;
93                         outputTypes["fasta"] = tempOutNames;
94                         outputTypes["taxonomy"] = tempOutNames;
95                         outputTypes["name"] = tempOutNames;
96                         outputTypes["group"] = tempOutNames;
97                         outputTypes["alignreport"] = tempOutNames;
98                         outputTypes["list"] = tempOutNames;
99                         
100                         //if the user changes the output directory command factory will send this info to us in the output parameter 
101                         outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  outputDir = "";         }
102                         
103                         //if the user changes the input directory command factory will send this info to us in the output parameter 
104                         string inputDir = validParameter.validFile(parameters, "inputdir", false);              
105                         if (inputDir == "not found"){   inputDir = "";          }
106                         else {
107                                 string path;
108                                 it = parameters.find("alignreport");
109                                 //user has given a template file
110                                 if(it != parameters.end()){ 
111                                         path = m->hasPath(it->second);
112                                         //if the user has not given a path then, add inputdir. else leave path alone.
113                                         if (path == "") {       parameters["alignreport"] = inputDir + it->second;              }
114                                 }
115                                 
116                                 it = parameters.find("fasta");
117                                 //user has given a template file
118                                 if(it != parameters.end()){ 
119                                         path = m->hasPath(it->second);
120                                         //if the user has not given a path then, add inputdir. else leave path alone.
121                                         if (path == "") {       parameters["fasta"] = inputDir + it->second;            }
122                                 }
123                                 
124                                 it = parameters.find("accnos");
125                                 //user has given a template file
126                                 if(it != parameters.end()){ 
127                                         path = m->hasPath(it->second);
128                                         //if the user has not given a path then, add inputdir. else leave path alone.
129                                         if (path == "") {       parameters["accnos"] = inputDir + it->second;           }
130                                 }
131                                 
132                                 it = parameters.find("list");
133                                 //user has given a template file
134                                 if(it != parameters.end()){ 
135                                         path = m->hasPath(it->second);
136                                         //if the user has not given a path then, add inputdir. else leave path alone.
137                                         if (path == "") {       parameters["list"] = inputDir + it->second;             }
138                                 }
139                                 
140                                 it = parameters.find("name");
141                                 //user has given a template file
142                                 if(it != parameters.end()){ 
143                                         path = m->hasPath(it->second);
144                                         //if the user has not given a path then, add inputdir. else leave path alone.
145                                         if (path == "") {       parameters["name"] = inputDir + it->second;             }
146                                 }
147                                 
148                                 it = parameters.find("group");
149                                 //user has given a template file
150                                 if(it != parameters.end()){ 
151                                         path = m->hasPath(it->second);
152                                         //if the user has not given a path then, add inputdir. else leave path alone.
153                                         if (path == "") {       parameters["group"] = inputDir + it->second;            }
154                                 }
155                                 
156                                 it = parameters.find("taxonomy");
157                                 //user has given a template file
158                                 if(it != parameters.end()){ 
159                                         path = m->hasPath(it->second);
160                                         //if the user has not given a path then, add inputdir. else leave path alone.
161                                         if (path == "") {       parameters["taxonomy"] = inputDir + it->second;         }
162                                 }
163                         }
164
165                         
166                         //check for required parameters
167                         accnosfile = validParameter.validFile(parameters, "accnos", true);
168                         if (accnosfile == "not open") { abort = true; }
169                         else if (accnosfile == "not found") {  accnosfile = "";  m->mothurOut("You must provide an accnos file."); m->mothurOutEndLine(); abort = true; }       
170                         
171                         fastafile = validParameter.validFile(parameters, "fasta", true);
172                         if (fastafile == "not open") { abort = true; }
173                         else if (fastafile == "not found") {  fastafile = "";  }        
174                         
175                         namefile = validParameter.validFile(parameters, "name", true);
176                         if (namefile == "not open") { abort = true; }
177                         else if (namefile == "not found") {  namefile = "";  }  
178                         
179                         groupfile = validParameter.validFile(parameters, "group", true);
180                         if (groupfile == "not open") { abort = true; }
181                         else if (groupfile == "not found") {  groupfile = "";  }        
182                         
183                         alignfile = validParameter.validFile(parameters, "alignreport", true);
184                         if (alignfile == "not open") { abort = true; }
185                         else if (alignfile == "not found") {  alignfile = "";  }
186                         
187                         listfile = validParameter.validFile(parameters, "list", true);
188                         if (listfile == "not open") { abort = true; }
189                         else if (listfile == "not found") {  listfile = "";  }
190                         
191                         taxfile = validParameter.validFile(parameters, "taxonomy", true);
192                         if (taxfile == "not open") { abort = true; }
193                         else if (taxfile == "not found") {  taxfile = "";  }
194                         
195                         string usedDups = "true";
196                         string temp = validParameter.validFile(parameters, "dups", false);      if (temp == "not found") { temp = "false"; usedDups = ""; }
197                         dups = m->isTrue(temp);
198                         
199                         if ((fastafile == "") && (namefile == "") && (groupfile == "") && (alignfile == "") && (listfile == "") && (taxfile == ""))  { m->mothurOut("You must provide one of the following: fasta, name, group, alignreport, taxonomy or listfile."); m->mothurOutEndLine(); abort = true; }
200                 
201                         if ((usedDups != "") && (namefile == "")) {  m->mothurOut("You may only use dups with the name option."); m->mothurOutEndLine();  abort = true; }                       
202
203                 }
204
205         }
206         catch(exception& e) {
207                 m->errorOut(e, "GetSeqsCommand", "GetSeqsCommand");
208                 exit(1);
209         }
210 }
211 //**********************************************************************************************************************
212
213 void GetSeqsCommand::help(){
214         try {
215                 m->mothurOut("The get.seqs command reads an .accnos file and any of the following file types: fasta, name, group, list, taxonomy or alignreport file.\n");
216                 m->mothurOut("It outputs a file containing only the sequences in the .accnos file.\n");
217                 m->mothurOut("The get.seqs command parameters are accnos, fasta, name, group, list, taxonomy, alignreport and dups.  You must provide accnos and at least one of the other parameters.\n");
218                 m->mothurOut("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");
219                 m->mothurOut("The get.seqs command should be in the following format: get.seqs(accnos=yourAccnos, fasta=yourFasta).\n");
220                 m->mothurOut("Example get.seqs(accnos=amazon.accnos, fasta=amazon.fasta).\n");
221                 m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
222         }
223         catch(exception& e) {
224                 m->errorOut(e, "GetSeqsCommand", "help");
225                 exit(1);
226         }
227 }
228
229 //**********************************************************************************************************************
230
231 int GetSeqsCommand::execute(){
232         try {
233                 
234                 if (abort == true) { return 0; }
235                 
236                 //get names you want to keep
237                 readAccnos();
238                 
239                 if (m->control_pressed) { return 0; }
240                 
241                 //read through the correct file and output lines you want to keep
242                 if (namefile != "")                     {               readName();             }
243                 if (fastafile != "")            {               readFasta();    }
244                 if (groupfile != "")            {               readGroup();    }
245                 if (alignfile != "")            {               readAlign();    }
246                 if (listfile != "")                     {               readList();             }
247                 if (taxfile != "")                      {               readTax();              }
248                 
249                 if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) {   remove(outputNames[i].c_str());  } return 0; }
250                 
251                 if (outputNames.size() != 0) {
252                         m->mothurOutEndLine();
253                         m->mothurOut("Output File Names: "); m->mothurOutEndLine();
254                         for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
255                         m->mothurOutEndLine();
256                 }
257                 
258                 return 0;               
259         }
260
261         catch(exception& e) {
262                 m->errorOut(e, "GetSeqsCommand", "execute");
263                 exit(1);
264         }
265 }
266
267 //**********************************************************************************************************************
268 int GetSeqsCommand::readFasta(){
269         try {
270                 string thisOutputDir = outputDir;
271                 if (outputDir == "") {  thisOutputDir += m->hasPath(fastafile);  }
272                 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(fastafile)) + "pick" +  m->getExtension(fastafile);
273                 ofstream out;
274                 m->openOutputFile(outputFileName, out);
275                 
276                 
277                 ifstream in;
278                 m->openInputFile(fastafile, in);
279                 string name;
280                 
281                 bool wroteSomething = false;
282                 
283                 while(!in.eof()){
284                 
285                         if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str());  return 0; }
286                         
287                         Sequence currSeq(in);
288                         name = currSeq.getName();
289                         
290                         if (name != "") {
291                                 //if this name is in the accnos file
292                                 if (names.count(name) != 0) {
293                                         wroteSomething = true;
294                                         
295                                         currSeq.printSequence(out);
296                                 }
297                         }
298                         m->gobble(in);
299                 }
300                 in.close();     
301                 out.close();
302                 
303                 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();  }
304                 outputNames.push_back(outputFileName);  outputTypes["fasta"].push_back(outputFileName); 
305                 
306                 return 0;
307
308         }
309         catch(exception& e) {
310                 m->errorOut(e, "GetSeqsCommand", "readFasta");
311                 exit(1);
312         }
313 }
314 //**********************************************************************************************************************
315 int GetSeqsCommand::readList(){
316         try {
317                 string thisOutputDir = outputDir;
318                 if (outputDir == "") {  thisOutputDir += m->hasPath(listfile);  }
319                 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(listfile)) + "pick" +  m->getExtension(listfile);
320                 ofstream out;
321                 m->openOutputFile(outputFileName, out);
322                 
323                 ifstream in;
324                 m->openInputFile(listfile, in);
325                 
326                 bool wroteSomething = false;
327                 
328                 while(!in.eof()){
329                         
330                         if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str());  return 0; }
331
332                         //read in list vector
333                         ListVector list(in);
334                         
335                         //make a new list vector
336                         ListVector newList;
337                         newList.setLabel(list.getLabel());
338                         
339                         //for each bin
340                         for (int i = 0; i < list.getNumBins(); i++) {
341                         
342                                 //parse out names that are in accnos file
343                                 string binnames = list.get(i);
344                                 
345                                 string newNames = "";
346                                 while (binnames.find_first_of(',') != -1) { 
347                                         string name = binnames.substr(0,binnames.find_first_of(','));
348                                         binnames = binnames.substr(binnames.find_first_of(',')+1, binnames.length());
349                                         
350                                         //if that name is in the .accnos file, add it
351                                         if (names.count(name) != 0) {  newNames += name + ",";  }
352                                 }
353                         
354                                 //get last name
355                                 if (names.count(binnames) != 0) {  newNames += binnames + ",";  }
356
357                                 //if there are names in this bin add to new list
358                                 if (newNames != "") { 
359                                         newNames = newNames.substr(0, newNames.length()-1); //rip off extra comma
360                                         newList.push_back(newNames);    
361                                 }
362                         }
363                                 
364                         //print new listvector
365                         if (newList.getNumBins() != 0) {
366                                 wroteSomething = true;
367                                 newList.print(out);
368                         }
369                         
370                         m->gobble(in);
371                 }
372                 in.close();     
373                 out.close();
374                 
375                 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();  }
376                 outputNames.push_back(outputFileName); outputTypes["list"].push_back(outputFileName);
377                 
378                 return 0;
379
380         }
381         catch(exception& e) {
382                 m->errorOut(e, "GetSeqsCommand", "readList");
383                 exit(1);
384         }
385 }
386 //**********************************************************************************************************************
387 int GetSeqsCommand::readName(){
388         try {
389                 string thisOutputDir = outputDir;
390                 if (outputDir == "") {  thisOutputDir += m->hasPath(namefile);  }
391                 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(namefile)) + "pick" +  m->getExtension(namefile);
392                 ofstream out;
393                 m->openOutputFile(outputFileName, out);
394                 
395
396                 ifstream in;
397                 m->openInputFile(namefile, in);
398                 string name, firstCol, secondCol;
399                 
400                 bool wroteSomething = false;
401                 
402                 
403                 while(!in.eof()){
404                 
405                         if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str());  return 0; }
406
407                         in >> firstCol;                         
408                         in >> secondCol;
409                         
410                         string hold = "";
411                         if (dups) { hold = secondCol; }
412                         
413                         vector<string> parsedNames;
414                         //parse second column saving each name
415                         while (secondCol.find_first_of(',') != -1) { 
416                                 name = secondCol.substr(0,secondCol.find_first_of(','));
417                                 secondCol = secondCol.substr(secondCol.find_first_of(',')+1, secondCol.length());
418                                 parsedNames.push_back(name);
419                         }
420                         
421                         //get name after last ,
422                         parsedNames.push_back(secondCol);
423                         
424                         vector<string> validSecond;
425                         for (int i = 0; i < parsedNames.size(); i++) {
426                                 if (names.count(parsedNames[i]) != 0) {
427                                         validSecond.push_back(parsedNames[i]);
428                                 }
429                         }
430
431                         if ((dups) && (validSecond.size() != 0)) { //dups = true and we want to add someone, then add everyone
432                                 for (int i = 0; i < parsedNames.size(); i++) {  names.insert(parsedNames[i]);  }
433                                 out << firstCol << '\t' << hold << endl;
434                                 wroteSomething = true;
435                         }else {
436                                 //if the name in the first column is in the set then print it and any other names in second column also in set
437                                 if (names.count(firstCol) != 0) {
438                                 
439                                         wroteSomething = true;
440                                         
441                                         out << firstCol << '\t';
442                                         
443                                         //you know you have at least one valid second since first column is valid
444                                         for (int i = 0; i < validSecond.size()-1; i++) {  out << validSecond[i] << ',';  }
445                                         out << validSecond[validSecond.size()-1] << endl;
446                                         
447                                 
448                                 //make first name in set you come to first column and then add the remaining names to second column
449                                 }else {
450                                         //you want part of this row
451                                         if (validSecond.size() != 0) {
452                                         
453                                                 wroteSomething = true;
454                                                 
455                                                 out << validSecond[0] << '\t';
456                                         
457                                                 //you know you have at least one valid second since first column is valid
458                                                 for (int i = 0; i < validSecond.size()-1; i++) {  out << validSecond[i] << ',';  }
459                                                 out << validSecond[validSecond.size()-1] << endl;
460                                         }
461                                 }
462                         }
463                         m->gobble(in);
464                 }
465                 in.close();
466                 out.close();
467                 
468                 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();  }
469                 outputNames.push_back(outputFileName); outputTypes["name"].push_back(outputFileName);
470                 
471                 return 0;
472                 
473         }
474         catch(exception& e) {
475                 m->errorOut(e, "GetSeqsCommand", "readName");
476                 exit(1);
477         }
478 }
479
480 //**********************************************************************************************************************
481 int GetSeqsCommand::readGroup(){
482         try {
483                 string thisOutputDir = outputDir;
484                 if (outputDir == "") {  thisOutputDir += m->hasPath(groupfile);  }
485                 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(groupfile)) + "pick" + m->getExtension(groupfile);
486                 ofstream out;
487                 m->openOutputFile(outputFileName, out);
488                 
489
490                 ifstream in;
491                 m->openInputFile(groupfile, in);
492                 string name, group;
493                 
494                 bool wroteSomething = false;
495                 
496                 while(!in.eof()){
497
498                         if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str());  return 0; }
499
500
501                         in >> name;                             //read from first column
502                         in >> group;                    //read from second column
503                         
504                         //if this name is in the accnos file
505                         if (names.count(name) != 0) {
506                                 wroteSomething = true;
507                                 
508                                 out << name << '\t' << group << endl;
509                         }
510                                         
511                         m->gobble(in);
512                 }
513                 in.close();
514                 out.close();
515                 
516                 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();  }
517                 outputNames.push_back(outputFileName);  outputTypes["group"].push_back(outputFileName);
518                 
519                 return 0;
520
521         }
522         catch(exception& e) {
523                 m->errorOut(e, "GetSeqsCommand", "readGroup");
524                 exit(1);
525         }
526 }
527 //**********************************************************************************************************************
528 int GetSeqsCommand::readTax(){
529         try {
530                 string thisOutputDir = outputDir;
531                 if (outputDir == "") {  thisOutputDir += m->hasPath(taxfile);  }
532                 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(taxfile)) + "pick" + m->getExtension(taxfile);
533                 ofstream out;
534                 m->openOutputFile(outputFileName, out);
535                 
536                 ifstream in;
537                 m->openInputFile(taxfile, in);
538                 string name, tax;
539                 
540                 bool wroteSomething = false;
541                 
542                 while(!in.eof()){
543
544                         if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str());  return 0; }
545
546                         in >> name;                             //read from first column
547                         in >> tax;                      //read from second column
548                         
549                         //if this name is in the accnos file
550                         if (names.count(name) != 0) {
551                                 wroteSomething = true;
552                                 
553                                 out << name << '\t' << tax << endl;
554                         }
555                                         
556                         m->gobble(in);
557                 }
558                 in.close();
559                 out.close();
560                 
561                 if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine();  }
562                 outputNames.push_back(outputFileName);  outputTypes["taxonomy"].push_back(outputFileName);
563                         
564                 return 0;
565
566         }
567         catch(exception& e) {
568                 m->errorOut(e, "GetSeqsCommand", "readTax");
569                 exit(1);
570         }
571 }
572 //**********************************************************************************************************************
573 //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
574 int GetSeqsCommand::readAlign(){
575         try {
576                 string thisOutputDir = outputDir;
577                 if (outputDir == "") {  thisOutputDir += m->hasPath(alignfile);  }
578                 string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(alignfile)) + "pick.align.report";
579                 ofstream out;
580                 m->openOutputFile(outputFileName, out);
581                 
582
583                 ifstream in;
584                 m->openInputFile(alignfile, in);
585                 string name, junk;
586                 
587                 bool wroteSomething = false;
588                 
589                 //read column headers
590                 for (int i = 0; i < 16; i++) {  
591                         if (!in.eof())  {       in >> junk;      out << junk << '\t';   }
592                         else                    {       break;                  }
593                 }
594                 out << endl;
595                 
596                 while(!in.eof()){
597                 
598                         if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str());  return 0; }
599
600
601                         in >> name;                             //read from first column
602                         
603                         //if this name is in the accnos file
604                         if (names.count(name) != 0) {
605                                 wroteSomething = true;
606                                 
607                                 out << name << '\t';
608                                 
609                                 //read rest
610                                 for (int i = 0; i < 15; i++) {  
611                                         if (!in.eof())  {       in >> junk;      out << junk << '\t';   }
612                                         else                    {       break;                  }
613                                 }
614                                 out << endl;
615                                 
616                         }else {//still read just don't do anything with it
617                                 //read rest
618                                 for (int i = 0; i < 15; i++) {  
619                                         if (!in.eof())  {       in >> junk;             }
620                                         else                    {       break;                  }
621                                 }
622                         }
623                         
624                         m->gobble(in);
625                 }
626                 in.close();
627                 out.close();
628                 
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["alignreport"].push_back(outputFileName);
631                 
632                 return 0;
633                 
634         }
635         catch(exception& e) {
636                 m->errorOut(e, "GetSeqsCommand", "readAlign");
637                 exit(1);
638         }
639 }
640 //**********************************************************************************************************************
641
642 int GetSeqsCommand::readAccnos(){
643         try {
644                 
645                 ifstream in;
646                 m->openInputFile(accnosfile, in);
647                 string name;
648                 
649                 while(!in.eof()){
650                         in >> name;
651                                                 
652                         names.insert(name);
653                         
654                         m->gobble(in);
655                 }
656                 in.close();     
657                 
658                 return 0;
659
660         }
661         catch(exception& e) {
662                 m->errorOut(e, "GetSeqsCommand", "readAccnos");
663                 exit(1);
664         }
665 }
666
667 //**********************************************************************************************************************
668