X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=classify.cpp;h=459c90f9ddd769628b0fc9061e7bd504a88b2900;hb=035f86272c776e1cccaa47021e26782e49cd41e7;hp=7726b3e00cca9de19971b70656f9581e43e97c8a;hpb=01f6af90c907264686304a5c684c702e94ff40ae;p=mothur.git diff --git a/classify.cpp b/classify.cpp index 7726b3e..459c90f 100644 --- a/classify.cpp +++ b/classify.cpp @@ -61,7 +61,8 @@ void Classify::generateDatabaseAndNames(string tfile, string tempFile, string me names.push_back(temp.getName()); database->addSequence(temp); } - database->generateDB(); + if ((method == "kmer") && (!shortcuts)) {;} //don't print + else {database->generateDB(); } }else if ((method == "kmer") && (!needToGenerate)) { ifstream kmerFileTest(kmerDBName.c_str()); database->readKmerDB(kmerFileTest); @@ -200,7 +201,8 @@ void Classify::generateDatabaseAndNames(string tfile, string tempFile, string me } fastaFile.close(); - database->generateDB(); + if ((method == "kmer") && (!shortcuts)) {;} //don't print + else {database->generateDB(); } }else if ((method == "kmer") && (!needToGenerate)) { ifstream kmerFileTest(kmerDBName.c_str()); @@ -260,9 +262,6 @@ int Classify::readTaxonomy(string file) { MPI_File inMPI; MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are MPI_Comm_size(MPI_COMM_WORLD, &processors); - - //char* inFileName = new char[file.length()]; - //memcpy(inFileName, file.c_str(), file.length()); char inFileName[1024]; strcpy(inFileName, file.c_str()); @@ -306,28 +305,12 @@ int Classify::readTaxonomy(string file) { MPI_File_close(&inMPI); MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case -#else - ifstream inTax; - m->openInputFile(file, inTax); - - //read template seqs and save - while (!inTax.eof()) { - inTax >> name; m->gobble(inTax); - inTax >> taxInfo; - - if (m->debug) { m->mothurOut("[DEBUG]: name = '" + name + "' tax = '" + taxInfo + "'\n"); } - - taxonomy[name] = taxInfo; - - phyloTree->addSeqToTree(name, taxInfo); - - m->gobble(inTax); - } - inTax.close(); -#endif +#else - - + taxonomy.clear(); + m->readTax(file, taxonomy); + for (map::iterator itTax = taxonomy.begin(); itTax != taxonomy.end(); itTax++) { phyloTree->addSeqToTree(itTax->first, itTax->second); } +#endif phyloTree->assignHeirarchyIDs(0); phyloTree->setUp(file);