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