]> git.donarmstrong.com Git - mothur.git/blobdiff - getgroupscommand.cpp
fixed clearcut version bug, added group count output to get.groups and remove.groups
[mothur.git] / getgroupscommand.cpp
index 635f68fc51a4151d7714d2934484cf4c44c1e16c..7d81aaa8848749a9bf53e3e2663791e3798b419c 100644 (file)
@@ -206,8 +206,8 @@ void GetGroupsCommand::help(){
                m->mothurOut("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");
                m->mothurOut("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");
                m->mothurOut("The get.groups command should be in the following format: get.groups(accnos=yourAccnos, fasta=yourFasta, group=yourGroupFile).\n");
-               m->mothurOut("Example get.seqs(accnos=amazon.accnos, fasta=amazon.fasta, group=amazon.groups).\n");
-               m->mothurOut("or get.seqs(groups=pasture, fasta=amazon.fasta, amazon.groups).\n");
+               m->mothurOut("Example get.groups(accnos=amazon.accnos, fasta=amazon.fasta, group=amazon.groups).\n");
+               m->mothurOut("or get.groups(groups=pasture, fasta=amazon.fasta, group=amazon.groups).\n");
                m->mothurOut("Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n\n");
        }
        catch(exception& e) {
@@ -250,14 +250,43 @@ int GetGroupsCommand::execute(){
                if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) {        remove(outputNames[i].c_str()); } return 0; }
                
                m->mothurOut("Selected " + toString(names.size()) + " sequences. From the groups: "); m->mothurOutEndLine();
-               for (int i = 0; i < Groups.size(); i++) {       m->mothurOut(Groups[i]); m->mothurOutEndLine(); }
+               for (int i = 0; i < Groups.size(); i++) {       m->mothurOut(Groups[i]); m->mothurOut(" contains " + toString(groupMap->getNumSeqs(Groups[i]))); m->mothurOutEndLine(); }
                m->mothurOutEndLine();
                
+               
+               
                if (outputNames.size() != 0) {
                        m->mothurOutEndLine();
                        m->mothurOut("Output File names: "); m->mothurOutEndLine();
                        for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
                        m->mothurOutEndLine();
+                       
+                       //set fasta file as new current fastafile
+                       string current = "";
+                       itTypes = outputTypes.find("fasta");
+                       if (itTypes != outputTypes.end()) {
+                               if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setFastaFile(current); }
+                       }
+                       
+                       itTypes = outputTypes.find("name");
+                       if (itTypes != outputTypes.end()) {
+                               if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setNameFile(current); }
+                       }
+                       
+                       itTypes = outputTypes.find("group");
+                       if (itTypes != outputTypes.end()) {
+                               if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setGroupFile(current); }
+                       }
+                       
+                       itTypes = outputTypes.find("list");
+                       if (itTypes != outputTypes.end()) {
+                               if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setListFile(current); }
+                       }
+                       
+                       itTypes = outputTypes.find("taxonomy");
+                       if (itTypes != outputTypes.end()) {
+                               if ((itTypes->second).size() != 0) { current = (itTypes->second)[0]; m->setTaxonomyFile(current); }
+                       }
                }
                
                return 0;