]> git.donarmstrong.com Git - mothur.git/blobdiff - classify.cpp
started work on sffinfo command. fixed bug across all paralellized commands if the...
[mothur.git] / classify.cpp
index e07344d4678a0ca263008e4b10d4d125ad8ef122..9a2de1fa46d78e99f8909abd729fb6f24e00bdf0 100644 (file)
@@ -28,7 +28,7 @@ void Classify::generateDatabaseAndNames(string tfile, string tempFile, string me
                m->mothurOut("Generating search database...    "); cout.flush();
 #ifdef USE_MPI 
                        int pid, processors;
-                       vector<long> positions;
+                       vector<unsigned long int> positions;
                        int tag = 2001;
                
                        MPI_Status status; 
@@ -97,7 +97,7 @@ void Classify::generateDatabaseAndNames(string tfile, string tempFile, string me
                if (method == "suffix") {
                        ifstream inFASTA;
                        openInputFile(tempFile, inFASTA);
-                       numSeqs = count(istreambuf_iterator<char>(inFASTA),istreambuf_iterator<char>(), '>');
+                       getNumSeqs(inFASTA, numSeqs);
                        inFASTA.close();
                }
 
@@ -128,7 +128,7 @@ void Classify::generateDatabaseAndNames(string tfile, string tempFile, string me
                                gobble(fastaFile);
                        
                                names.push_back(temp.getName());
-                                                               
+                                                       
                                database->addSequence(temp);    
                        }
                        fastaFile.close();
@@ -138,7 +138,7 @@ void Classify::generateDatabaseAndNames(string tfile, string tempFile, string me
                }else if ((method == "kmer") && (!needToGenerate)) {    
                        ifstream kmerFileTest(kmerDBName.c_str());
                        database->readKmerDB(kmerFileTest);     
-                       
+               
                        ifstream fastaFile;
                        openInputFile(tempFile, fastaFile);
                        
@@ -150,9 +150,15 @@ void Classify::generateDatabaseAndNames(string tfile, string tempFile, string me
                        }
                        fastaFile.close();
                }
-#endif         
+#endif 
+       
                database->setNumSeqs(names.size());
                
+               //sanity check
+               bool okay = phyloTree->ErrorCheck(names);
+               
+               if (!okay) { m->control_pressed = true; }
+               
                m->mothurOut("DONE."); m->mothurOutEndLine();
                m->mothurOut("It took " + toString(time(NULL) - start) + " seconds generate search database. "); m->mothurOutEndLine();
 
@@ -177,7 +183,7 @@ int Classify::readTaxonomy(string file) {
 
 #ifdef USE_MPI 
                int pid, num, processors;
-               vector<long> positions;
+               vector<unsigned long int> positions;
                int tag = 2001;
                
                MPI_Status status;