X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=classify.cpp;h=5f97c7ec693a97997554683188a013b1054eb3d7;hb=372fb21ea66ced432b109225851a1b80ef0491a3;hp=15ef0aa75dfc5793d1d1bef68996f477134e99a3;hpb=a9dbc22713bfc056a797361dd757b1a5c98e1c01;p=mothur.git diff --git a/classify.cpp b/classify.cpp index 15ef0aa..5f97c7e 100644 --- a/classify.cpp +++ b/classify.cpp @@ -236,7 +236,7 @@ void Classify::generateDatabaseAndNames(string tfile, string tempFile, string me } } /**************************************************************************************************/ -Classify::Classify() { m = MothurOut::getInstance(); database = NULL; flipped=false; } +Classify::Classify() { m = MothurOut::getInstance(); database = NULL; phyloTree=NULL; flipped=false; } /**************************************************************************************************/ int Classify::readTaxonomy(string file) { @@ -309,16 +309,19 @@ int Classify::readTaxonomy(string file) { taxonomy.clear(); m->readTax(file, taxonomy); - map tempTaxonomy; + + //commented out to save time with large templates. 6/12/13 + //map tempTaxonomy; for (map::iterator itTax = taxonomy.begin(); itTax != taxonomy.end(); itTax++) { - if (m->inUsersGroups(itTax->first, names)) { - phyloTree->addSeqToTree(itTax->first, itTax->second); - tempTaxonomy[itTax->first] = itTax->second; - }else { - m->mothurOut("[WARNING]: " + itTax->first + " is in your taxonomy file and not in your reference file, ignoring.\n"); - } + //if (m->inUsersGroups(itTax->first, names)) { + phyloTree->addSeqToTree(itTax->first, itTax->second); + if (m->control_pressed) { break; } + //tempTaxonomy[itTax->first] = itTax->second; + // }else { + // m->mothurOut("[WARNING]: " + itTax->first + " is in your taxonomy file and not in your reference file, ignoring.\n"); + //} } - taxonomy = tempTaxonomy; + //taxonomy = tempTaxonomy; #endif phyloTree->assignHeirarchyIDs(0); @@ -340,21 +343,8 @@ int Classify::readTaxonomy(string file) { vector Classify::parseTax(string tax) { try { vector taxons; - - tax = tax.substr(0, tax.length()-1); //get rid of last ';' - - //parse taxonomy - string individual; - while (tax.find_first_of(';') != -1) { - individual = tax.substr(0,tax.find_first_of(';')); - tax = tax.substr(tax.find_first_of(';')+1, tax.length()); - taxons.push_back(individual); - - } - //get last one - taxons.push_back(tax); - - return taxons; + m->splitAtChar(tax, taxons, ';'); + return taxons; } catch(exception& e) { m->errorOut(e, "Classify", "parseTax");