]> git.donarmstrong.com Git - mothur.git/blobdiff - chopseqscommand.cpp
paralellized rarefaction.single
[mothur.git] / chopseqscommand.cpp
index 2eabbc1099c40cab04f6de929014b326fddab6d4..b2810741ae7b2b6591a7f0aa8e3b52b143dcfe3d 100644 (file)
@@ -35,9 +35,6 @@ ChopSeqsCommand::ChopSeqsCommand(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 = "";         }
-                       
                        //if the user changes the input directory command factory will send this info to us in the output parameter 
                        string inputDir = validParameter.validFile(parameters, "inputdir", false);              
                        if (inputDir == "not found"){   inputDir = "";          }
@@ -46,7 +43,7 @@ ChopSeqsCommand::ChopSeqsCommand(string option)  {
                                it = parameters.find("fasta");
                                //user has given a template file
                                if(it != parameters.end()){ 
-                                       path = hasPath(it->second);
+                                       path = m->hasPath(it->second);
                                        //if the user has not given a path then, add inputdir. else leave path alone.
                                        if (path == "") {       parameters["fasta"] = inputDir + it->second;            }
                                }
@@ -57,11 +54,14 @@ ChopSeqsCommand::ChopSeqsCommand(string option)  {
                        if (fastafile == "not open") { abort = true; }
                        else if (fastafile == "not found") {  m->mothurOut("You must provide a fasta file."); m->mothurOutEndLine(); 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 = m->hasPath(fastafile);      }
+                       
                        string temp = validParameter.validFile(parameters, "numbases", false);  if (temp == "not found") { temp = "0"; } 
                        convert(temp, numbases);   
                        
                        temp = validParameter.validFile(parameters, "countgaps", false);        if (temp == "not found") { temp = "f"; } 
-                       countGaps = isTrue(temp);   
+                       countGaps = m->isTrue(temp);   
                
                        keep = validParameter.validFile(parameters, "keep", false);             if (keep == "not found") { keep = "front"; } 
                                
@@ -100,17 +100,17 @@ int ChopSeqsCommand::execute(){
                
                if (abort == true) { return 0; }
                
-               string outputFileName = outputDir + getRootName(getSimpleName(fastafile)) + "chop.fasta";
-               string outputFileNameAccnos = outputDir + getRootName(getSimpleName(fastafile)) + "chop.accnos";
+               string outputFileName = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "chop.fasta";
+               string outputFileNameAccnos = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "chop.accnos";
                
                ofstream out;
-               openOutputFile(outputFileName, out);
+               m->openOutputFile(outputFileName, out);
                
                ofstream outAcc;
-               openOutputFile(outputFileNameAccnos, outAcc);
+               m->openOutputFile(outputFileNameAccnos, outAcc);
                
                ifstream in;
-               openInputFile(fastafile, in);
+               m->openInputFile(fastafile, in);
                
                bool wroteAccnos = false;