]> git.donarmstrong.com Git - mothur.git/blobdiff - deconvolutecommand.cpp
initial add of metastats
[mothur.git] / deconvolutecommand.cpp
index fcfd320e0b6be3aa3572b661a579311c9dead5bf..b3fa7ddd397e973b7ac3895acfb8c0ebf0505f1f 100644 (file)
@@ -41,7 +41,7 @@ DeconvoluteCommand::DeconvoluteCommand(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;            }
                                }
@@ -49,7 +49,7 @@ DeconvoluteCommand::DeconvoluteCommand(string option)  {
                                it = parameters.find("name");
                                //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["name"] = inputDir + it->second;             }
                                }
@@ -64,7 +64,7 @@ DeconvoluteCommand::DeconvoluteCommand(string option)  {
                        //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 = ""; 
-                               outputDir += hasPath(inFastaName); //if user entered a file with a path then preserve it        
+                               outputDir += m->hasPath(inFastaName); //if user entered a file with a path then preserve it     
                        }
                        
                        oldNameMapFName = validParameter.validFile(parameters, "name", true);
@@ -102,17 +102,21 @@ int DeconvoluteCommand::execute() {
                if (abort == true) { return 0; }
 
                //prepare filenames and open files
-               string outNameFile = outputDir + getRootName(getSimpleName(inFastaName)) + "names";
-               string outFastaFile = outputDir + getRootName(getSimpleName(inFastaName)) + "unique" + getExtension(inFastaName);
+               string outNameFile = outputDir + m->getRootName(m->getSimpleName(inFastaName)) + "names";
+               string outFastaFile = outputDir + m->getRootName(m->getSimpleName(inFastaName)) + "unique" + m->getExtension(inFastaName);
                
                FastaMap fastamap;
        
                if(oldNameMapFName == "")       {       fastamap.readFastaFile(inFastaName);                                    }
                else                                            {       fastamap.readFastaFile(inFastaName, oldNameMapFName);   }
                
+               if (m->control_pressed) { return 0; }
+               
                fastamap.printCondensedFasta(outFastaFile);
                fastamap.printNamesFile(outNameFile);
                
+               if (m->control_pressed) { remove(outFastaFile.c_str()); remove(outNameFile.c_str()); return 0; }
+               
                m->mothurOutEndLine();
                m->mothurOut("Output File Names: "); m->mothurOutEndLine();
                m->mothurOut(outFastaFile); m->mothurOutEndLine();