X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=classify.cpp;h=459c90f9ddd769628b0fc9061e7bd504a88b2900;hb=96dbe925073caefaed6e6db85659c144a806aeb1;hp=2d01183479a504c798a18071df045f723643f850;hpb=a6cf29fa4dac0909c7582cb1094151d34093ee76;p=mothur.git diff --git a/classify.cpp b/classify.cpp index 2d01183..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()); @@ -249,7 +251,8 @@ int Classify::readTaxonomy(string file) { m->mothurOutEndLine(); m->mothurOut("Reading in the " + file + " taxonomy...\t"); cout.flush(); - + if (m->debug) { m->mothurOut("[DEBUG]: Taxonomies read in...\n"); } + #ifdef USE_MPI int pid, num, processors; vector positions; @@ -259,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()); @@ -298,30 +298,19 @@ int Classify::readTaxonomy(string file) { istringstream iss (tempBuf,istringstream::in); iss >> name; m->gobble(iss); iss >> taxInfo; + if (m->debug) { m->mothurOut("[DEBUG]: name = " + name + " tax = " + taxInfo + "\n"); } taxonomy[name] = taxInfo; phyloTree->addSeqToTree(name, taxInfo); } 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; - - taxonomy[name] = taxInfo; - - phyloTree->addSeqToTree(name, taxInfo); - - m->gobble(inTax); - } - inTax.close(); +#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);