Permalink
Browse files

Fixes bug with classify.seqs

  • Loading branch information...
1 parent 241a174 commit 68280e959a67c39d9b29f4eb70ad20b95cd2385f @mothur-westcott mothur-westcott committed Feb 23, 2017
Showing with 25 additions and 35 deletions.
  1. +6 −6 Mothur.xcodeproj/project.pbxproj
  2. +3 −13 source/classifier/classify.cpp
  3. +16 −16 source/classifier/phylotree.cpp
@@ -3384,8 +3384,8 @@
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_PREPROCESSOR_DEFINITIONS = (
- "VERSION=\"\\\"1.39.1\\\"\"",
- "RELEASE_DATE=\"\\\"2/2/2017\\\"\"",
+ "VERSION=\"\\\"1.39.2\\\"\"",
+ "RELEASE_DATE=\"\\\"2/16/2017\\\"\"",
"MOTHUR_FILES=\"\\\"/Users/sarahwestcott/desktop/release\\\"\"",
);
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
@@ -3419,8 +3419,8 @@
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_PREPROCESSOR_DEFINITIONS = (
- "VERSION=\"\\\"1.39.1\\\"\"",
- "RELEASE_DATE=\"\\\"2/2/2017\\\"\"",
+ "VERSION=\"\\\"1.39.2\\\"\"",
+ "RELEASE_DATE=\"\\\"2/16/2017\\\"\"",
"MOTHUR_FILES=\"\\\"/Users/sarahwestcott/desktop/release\\\"\"",
);
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
@@ -3505,8 +3505,8 @@
GCC_MODEL_TUNING = "";
GCC_OPTIMIZATION_LEVEL = 3;
GCC_PREPROCESSOR_DEFINITIONS = (
- "VERSION=\"\\\"1.39.1\\\"\"",
- "RELEASE_DATE=\"\\\"2/2/2017\\\"\"",
+ "VERSION=\"\\\"1.39.2\\\"\"",
+ "RELEASE_DATE=\"\\\"2/16/2017\\\"\"",
"MOTHUR_FILES=\"\\\"/Users/sarahwestcott/desktop/release\\\"\"",
);
GCC_VERSION = "";
@@ -123,26 +123,16 @@ int Classify::readTaxonomy(string file) {
phyloTree = new PhyloTree();
string name, taxInfo;
- m->mothurOutEndLine();
- m->mothurOut("Reading in the " + file + " taxonomy...\t"); cout.flush();
+ m->mothurOut("\nReading in the " + file + " taxonomy...\t"); cout.flush();
if (m->debug) { m->mothurOut("[DEBUG]: Taxonomies read in...\n"); }
-
taxonomy.clear();
m->readTax(file, taxonomy, true);
- //commented out to save time with large templates. 6/12/13
- //map<string, string> tempTaxonomy;
- for (map<string, string>::iterator itTax = taxonomy.begin(); itTax != taxonomy.end(); itTax++) {
- //if (m->inUsersGroups(itTax->first, names)) {
- phyloTree->addSeqToTree(itTax->first, itTax->second);
+ for (map<string, string>::iterator itTax = taxonomy.begin(); itTax != taxonomy.end(); itTax++) {
+ 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;
phyloTree->assignHeirarchyIDs(0);
@@ -21,6 +21,7 @@ PhyloTree::PhyloTree(){
tree[0].level = 0;
maxLevel = 0;
calcTotals = true;
+
addSeqToTree("unknown", "unknown;");
}
catch(exception& e) {
@@ -92,16 +93,15 @@ PhyloTree::PhyloTree(string tfile){
temp.erase(itTemp++);
}
- assignHeirarchyIDs(0);
-
string unknownTax = "unknown;";
//added last taxon until you get desired level
for (int i = 1; i < maxLevel; i++) {
unknownTax += "unknown_unclassfied;";
}
-
addSeqToTree("unknown", unknownTax);
+ assignHeirarchyIDs(0);
+
//create file for summary if needed
setUp(tfile);
}
@@ -193,8 +193,7 @@ int PhyloTree::addSeqToTree(string seqName, string seqTaxonomy){
tree[0].accessions.push_back(seqName);
m->removeConfidences(seqTaxonomy);
-
- string taxon;// = getNextTaxon(seqTaxonomy);
+ string taxon;// = getNextTaxon(seqTaxonomy);
while(seqTaxonomy != ""){
@@ -219,12 +218,13 @@ int PhyloTree::addSeqToTree(string seqName, string seqTaxonomy){
}
else{ //otherwise, create it
tree.push_back(TaxNode(taxon));
- numNodes++;
- tree[currentNode].children[taxon] = numNodes-1;
- tree[currentNode].level = level;
- tree[numNodes-1].parent = currentNode;
- currentNode = tree[currentNode].children[taxon];
+ tree[currentNode].children[taxon] = numNodes;
+ tree[numNodes].level = level;
+ tree[numNodes].parent = currentNode;
+ currentNode = numNodes;
+ numNodes++;
+
tree[currentNode].accessions.push_back(seqName);
name2Taxonomy[seqName] = currentNode;
}
@@ -377,12 +377,12 @@ void PhyloTree::binUnclassified(string file){
}
else{ //otherwise, create it
copy.push_back(TaxNode(taxon));
- copyNodes++;
- copy[currentNode].children[taxon] = copyNodes-1;
- copy[copyNodes-1].parent = currentNode;
- copy[copyNodes-1].level = copy[currentNode].level + 1;
-
- currentNode = copy[currentNode].children[taxon];
+
+ copy[currentNode].children[taxon] = copyNodes;
+ copy[copyNodes].parent = currentNode;
+ copy[copyNodes].level = copy[currentNode].level + 1;
+ currentNode = copyNodes;
+ copyNodes++;
}
}
}

0 comments on commit 68280e9

Please sign in to comment.