]> git.donarmstrong.com Git - mothur.git/blobdiff - collectsharedcommand.cpp
added warning about merging with something above cutoff to cluster. working on chimeras
[mothur.git] / collectsharedcommand.cpp
index 4254950ba8560efe2b8714b77f8905228ce8d92e..2f12282d7c4ca3379e9fe9b9848acd6ed5bd2df6 100644 (file)
@@ -50,7 +50,7 @@ CollectSharedCommand::CollectSharedCommand(string option){
                
                else {
                        //valid paramters for this command
-                       string Array[] =  {"freq","label","calc","groups","all"};
+                       string Array[] =  {"freq","label","calc","groups","all","outputdir","inputdir"};
                        vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
                        
                        OptionParser parser(option);
@@ -63,6 +63,10 @@ CollectSharedCommand::CollectSharedCommand(string option){
                                if (validParameter.isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }
                        }
                        
+                       //if the user changes the output directory command factory will send this info to us in the output parameter 
+                       outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  outputDir = "";         }
+                       
+                                               
                        //make sure the user has already run the read.otu command
                        if (globaldata->getSharedFile() == "") {
                                if (globaldata->getListFile() == "") { mothurOut("You must read a list and a group, or a shared before you can use the collect.shared command."); mothurOutEndLine(); abort = true; }
@@ -103,12 +107,13 @@ CollectSharedCommand::CollectSharedCommand(string option){
                        temp = validParameter.validFile(parameters, "freq", false);                     if (temp == "not found") { temp = "100"; }
                        convert(temp, freq); 
                        
-                       temp = validParameter.validFile(parameters, "all", false);                              if (temp == "not found") { temp = "true"; }
+                       temp = validParameter.validFile(parameters, "all", false);                              if (temp == "not found") { temp = "false"; }
                        all = isTrue(temp);
                                                
                        if (abort == false) {
-                       
-                               string fileNameRoot = getRootName(globaldata->inputFileName);
+                               
+                               if (outputDir == "") { outputDir += hasPath(globaldata->inputFileName); }
+                               string fileNameRoot = outputDir + getRootName(getSimpleName(globaldata->inputFileName));
                                format = globaldata->getFormat();
                                int i;
                                
@@ -184,7 +189,7 @@ void CollectSharedCommand::help(){
                mothurOut("The default value for groups is all the groups in your groupfile.\n");
                validCalculator->printCalc("shared", cout);
                mothurOut("The label parameter is used to analyze specific labels in your input.\n");
-               mothurOut("The all parameter is used to specify if you want the estimate of all your groups together.  This estimate can only be made for sharedsobs and sharedchao calculators. The default is true.\n");
+               mothurOut("The all parameter is used to specify if you want the estimate of all your groups together.  This estimate can only be made for sharedsobs and sharedchao calculators. The default is false.\n");
                mothurOut("If you use sharedchao and run into memory issues, set all to false. \n");
                mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups.\n");
                mothurOut("Note: No spaces between parameter labels (i.e. list), '=' and parameters (i.e.yourListfile).\n\n");
@@ -218,10 +223,10 @@ int CollectSharedCommand::execute(){
                //if the users entered no valid calculators don't execute command
                if (cDisplays.size() == 0) { return 0; }
                for(int i=0;i<cDisplays.size();i++){    cDisplays[i]->setAll(all);      }       
-               
+       
                read = new ReadOTUFile(globaldata->inputFileName);      
                read->read(&*globaldata); 
-                       
+               
                input = globaldata->ginput;
                order = input->getSharedOrderVector();
                string lastLabel = order->getLabel();