]> git.donarmstrong.com Git - mothur.git/blobdiff - bayesian.cpp
working on sffinfo command.
[mothur.git] / bayesian.cpp
index 57b8e20def801dffdf90f7e49d061d90d8c7a576..655d7027b5dabbe3a7ebeae94edbc95724d371c5 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();
                        
@@ -363,8 +368,8 @@ void Bayesian::readProbFile(ifstream& in, ifstream& inNum, string inName, string
                #ifdef USE_MPI
                        
                        int pid, num, num2, processors;
-                       vector<long> positions;
-                       vector<long> positions2;
+                       vector<unsigned long int> positions;
+                       vector<unsigned long int> positions2;
                        
                        MPI_Status status; 
                        MPI_File inMPI;