]> git.donarmstrong.com Git - mothur.git/blobdiff - rarefactsharedcommand.cpp
added pipeline commands which involved change to command factory and command class...
[mothur.git] / rarefactsharedcommand.cpp
index c0f5ec0c4daba141c9267817836522e0d22c1a3a..0be8141636a1fffaacce16f2592e6bf8738ad400 100644 (file)
 #include "sharedsobs.h"
 #include "sharednseqs.h"
 
+//**********************************************************************************************************************
+vector<string> RareFactSharedCommand::getValidParameters(){    
+       try {
+               string Array[] =  {"iters","freq","label","calc","groups", "jumble","outputdir","inputdir"};
+               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "RareFactSharedCommand", "getValidParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+RareFactSharedCommand::RareFactSharedCommand(){        
+       try {
+               //initialize outputTypes
+               vector<string> tempOutNames;
+               outputTypes["sharedrarefaction"] = tempOutNames;
+               outputTypes["sharedr_nseqs"] = tempOutNames;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "RareFactSharedCommand", "RareFactSharedCommand");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> RareFactSharedCommand::getRequiredParameters(){ 
+       try {
+               vector<string> myArray;
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "RareFactSharedCommand", "getRequiredParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> RareFactSharedCommand::getRequiredFiles(){      
+       try {
+               string Array[] =  {"shared"};
+               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "RareFactSharedCommand", "getRequiredFiles");
+               exit(1);
+       }
+}
 //**********************************************************************************************************************
 
 RareFactSharedCommand::RareFactSharedCommand(string option)  {
@@ -41,6 +89,11 @@ RareFactSharedCommand::RareFactSharedCommand(string option)  {
                                if (validParameter.isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }
                        }
                        
+                       //initialize outputTypes
+                       vector<string> tempOutNames;
+                       outputTypes["sharedrarefaction"] = tempOutNames;
+                       outputTypes["sharedr_nseqs"] = tempOutNames;
+                       
                        //make sure the user has already run the read.otu command
                        if (globaldata->getSharedFile() == "") {
                                if (globaldata->getListFile() == "") { m->mothurOut("You must read a list and a group, or a shared before you can use the collect.shared command."); m->mothurOutEndLine(); abort = true; }
@@ -107,10 +160,10 @@ RareFactSharedCommand::RareFactSharedCommand(string option)  {
                                        if (validCalculator->isValidCalculator("sharedrarefaction", Estimators[i]) == true) { 
                                                if (Estimators[i] == "sharedobserved") { 
                                                        rDisplays.push_back(new RareDisplay(new SharedSobs(), new SharedThreeColumnFile(fileNameRoot+"shared.rarefaction", "")));
-                                                       outputNames.push_back(fileNameRoot+"shared.rarefaction");
+                                                       outputNames.push_back(fileNameRoot+"shared.rarefaction"); outputTypes["sharedrarefaction"].push_back(fileNameRoot+"shared.rarefaction");
                                                }else if (Estimators[i] == "sharednseqs") { 
                                                        rDisplays.push_back(new RareDisplay(new SharedNSeqs(), new SharedThreeColumnFile(fileNameRoot+"shared.r_nseqs", "")));
-                                                       outputNames.push_back(fileNameRoot+"shared.r_nseqs");
+                                                       outputNames.push_back(fileNameRoot+"shared.r_nseqs"); outputTypes["sharedr_nseqs"].push_back(fileNameRoot+"shared.r_nseqs");
                                                }
                                        }
                                }