]> git.donarmstrong.com Git - mothur.git/blobdiff - collectcommand.cpp
added warning about merging with something above cutoff to cluster. working on chimeras
[mothur.git] / collectcommand.cpp
index beb70ebe9c7c82d84ab7c21cd43bc3e7a154eb50..473d2db8b473bbef240793c419e6c8beece29ddf 100644 (file)
@@ -44,7 +44,7 @@ CollectCommand::CollectCommand(string option){
                
                else {
                        //valid paramters for this command
-                       string Array[] =  {"freq","label","calc","abund","size"};
+                       string Array[] =  {"freq","label","calc","abund","size","outputdir","inputdir"};
                        vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
                        
                        OptionParser parser(option);
@@ -57,6 +57,9 @@ CollectCommand::CollectCommand(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() == "") && (globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { mothurOut("You must read a list, sabund, rabund or shared file before you can use the collect.single command."); mothurOutEndLine(); abort = true; }
                        
@@ -133,16 +136,17 @@ int CollectCommand::execute(){
                
                if ((globaldata->getFormat() != "sharedfile")) { inputFileNames.push_back(globaldata->inputFileName);  }
                else {  inputFileNames = parseSharedFile(globaldata->getSharedFile());  globaldata->setFormat("rabund");  }
-               
+       
                for (int p = 0; p < inputFileNames.size(); p++) {
-                       
-                       string fileNameRoot = getRootName(inputFileNames[p]);
+               
+                       if (outputDir == "") { outputDir += hasPath(inputFileNames[p]); }
+                       string fileNameRoot = outputDir + getRootName(getSimpleName(inputFileNames[p]));
                        globaldata->inputFileName = inputFileNames[p];
-                       
+               
                        if (inputFileNames.size() > 1) {
                                mothurOutEndLine(); mothurOut("Processing group " + groups[p]); mothurOutEndLine(); mothurOutEndLine();
                        }
-                       
+               
                        validCalculator = new ValidCalculators();
                        
                        for (int i=0; i<Estimators.size(); i++) {
@@ -191,13 +195,12 @@ int CollectCommand::execute(){
                                }
                        }
                
-                       
                        //if the users entered no valid calculators don't execute command
                        if (cDisplays.size() == 0) { return 0; }
                        
                        read = new ReadOTUFile(inputFileNames[p]);      
                        read->read(&*globaldata); 
-                               
+               
                        order = globaldata->gorder;
                        string lastLabel = order->getLabel();
                        input = globaldata->ginput;