]> git.donarmstrong.com Git - mothur.git/blobdiff - bayesian.cpp
modified makefile and sensspeccommand files
[mothur.git] / bayesian.cpp
index 57b8e20def801dffdf90f7e49d061d90d8c7a576..17264776740a0e2f7e1ad2a797118bdb389be817 100644 (file)
@@ -17,9 +17,11 @@ Classify(), kmerSize(ksize), confidenceThreshold(cutoff), iters(i)  {
        try {
                                        
                /************calculate the probablity that each word will be in a specific taxonomy*************/
-               string phyloTreeName = tfile.substr(0,tfile.find_last_of(".")+1) + "tree.train";
-               string probFileName = tfile.substr(0,tfile.find_last_of(".")+1) + tempFile.substr(0,tempFile.find_last_of(".")+1) + char('0'+ kmerSize) + "mer.prob";
-               string probFileName2 = tfile.substr(0,tfile.find_last_of(".")+1) + tempFile.substr(0,tempFile.find_last_of(".")+1) + char('0'+ kmerSize) + "mer.numNonZero";
+               string tfileroot = tfile.substr(0,tfile.find_last_of(".")+1);
+               string tempfileroot = getRootName(getSimpleName(tempFile));
+               string phyloTreeName = tfileroot + "tree.train";
+               string probFileName = tfileroot + tempfileroot + char('0'+ kmerSize) + "mer.prob";
+               string probFileName2 = tfileroot + tempfileroot + char('0'+ kmerSize) + "mer.numNonZero";
                
                ofstream out;
                ofstream out2;
@@ -48,6 +50,9 @@ Classify(), kmerSize(ksize), confidenceThreshold(cutoff), iters(i)  {
                        //create search database and names vector
                        generateDatabaseAndNames(tfile, tempFile, method, ksize, 0.0, 0.0, 0.0, 0.0);
                        
+                       //prevents errors caused by creating shortcut files if you had an error in the sanity check.
+                       if (m->control_pressed) {  remove(phyloTreeName.c_str());   }
+                       
                        genusNodes = phyloTree->getGenusNodes(); 
                        genusTotals = phyloTree->getGenusTotals();