]> git.donarmstrong.com Git - mothur.git/blobdiff - getgroupscommand.cpp
fixed bug with shhh.flow from file path name in write functions, added "smart" featur...
[mothur.git] / getgroupscommand.cpp
index 0c42b7dad8281b1d9edd49550c3df95ae773c7e8..432894b06fe9d5ffa6982fdaaa49474a44c403e0 100644 (file)
 //**********************************************************************************************************************
 vector<string> GetGroupsCommand::setParameters(){      
        try {
-               CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(pfasta);
-               CommandParameter pshared("shared", "InputTypes", "", "", "none", "FNGLT-sharedGroup", "none",false,false); parameters.push_back(pshared);
-               CommandParameter pname("name", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(pname);
-               CommandParameter pgroup("group", "InputTypes", "", "", "none", "FNGLT-sharedGroup", "none",false,false); parameters.push_back(pgroup);
-               CommandParameter plist("list", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(plist);
-               CommandParameter ptaxonomy("taxonomy", "InputTypes", "", "", "none", "FNGLT", "none",false,false); parameters.push_back(ptaxonomy);
+               CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "FNGLT",false,false); parameters.push_back(pfasta);
+               CommandParameter pshared("shared", "InputTypes", "", "", "none", "sharedGroup", "none",false,false); parameters.push_back(pshared);
+               CommandParameter pname("name", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pname);
+               CommandParameter pgroup("group", "InputTypes", "", "", "none", "sharedGroup", "FNGLT",false,false); parameters.push_back(pgroup);
+               CommandParameter plist("list", "InputTypes", "", "", "none", "none", "FNGLT",false,false); parameters.push_back(plist);
+               CommandParameter ptaxonomy("taxonomy", "InputTypes", "", "", "none", "none", "FNGLT",false,false); parameters.push_back(ptaxonomy);
                CommandParameter paccnos("accnos", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(paccnos);
                CommandParameter pgroups("groups", "String", "", "", "", "", "",false,false); parameters.push_back(pgroups);
                CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
@@ -180,12 +180,12 @@ GetGroupsCommand::GetGroupsCommand(string option)  {
                        else { m->setAccnosFile(accnosfile); }
                        
                        fastafile = validParameter.validFile(parameters, "fasta", true);
-                       if (fastafile == "not open") { abort = true; }
+                       if (fastafile == "not open") { fastafile = ""; abort = true; }
                        else if (fastafile == "not found") {  fastafile = "";  }
                        else { m->setFastaFile(fastafile); }
                        
                        namefile = validParameter.validFile(parameters, "name", true);
-                       if (namefile == "not open") { abort = true; }
+                       if (namefile == "not open") { namefile = ""; abort = true; }
                        else if (namefile == "not found") {  namefile = "";  }  
                        else { m->setNameFile(namefile); }
                        
@@ -200,7 +200,7 @@ GetGroupsCommand::GetGroupsCommand(string option)  {
                        else { m->setListFile(listfile); }
                        
                        taxfile = validParameter.validFile(parameters, "taxonomy", true);
-                       if (taxfile == "not open") { abort = true; }
+                       if (taxfile == "not open") { taxfile = ""; abort = true; }
                        else if (taxfile == "not found") {  taxfile = "";  }
                        else { m->setTaxonomyFile(taxfile); }
                        
@@ -253,6 +253,10 @@ GetGroupsCommand::GetGroupsCommand(string option)  {
                        if ((fastafile == "") && (namefile == "") && (groupfile == "")  && (sharedfile == "") && (listfile == "") && (taxfile == ""))  { m->mothurOut("You must provide at least one of the following: fasta, name, taxonomy, group, shared or list."); m->mothurOutEndLine(); abort = true; }
                        if ((groupfile == "") && ((namefile != "") || (fastafile != "") || (listfile != "") || (taxfile != "")))  { m->mothurOut("If using a fasta, name, taxonomy, group or list, then you must provide a group file."); m->mothurOutEndLine(); abort = true; }
 
+                       if ((namefile == "") && ((fastafile != "") || (taxfile != ""))){
+                               vector<string> files; files.push_back(fastafile); files.push_back(taxfile);
+                               parser.getNameFile(files);
+                       }
                }
                
        }