}
saveIn.close();
}
-FilesGood = false;
+
if(probFileTest && probFileTest2 && phyloTreeTest && probFileTest3 && FilesGood){
if (tempFile == "saved") { m->mothurOutEndLine(); m->mothurOut("Using sequences from " + rdb->getSavedReference() + " that are saved in memory."); m->mothurOutEndLine(); }
}
#endif
-
//for each word
for (int i = 0; i < numKmers; i++) {
if (m->control_pressed) { break; }
vector<int> seqsWithWordi = database->getSequencesWithKmer(i);
- map<int, int> count;
- for (int k = 0; k < genusNodes.size(); k++) { count[genusNodes[k]] = 0; }
-
//for each sequence with that word
+ vector<int> count; count.resize(genusNodes.size(), 0);
for (int j = 0; j < seqsWithWordi.size(); j++) {
- int temp = phyloTree->getIndex(names[seqsWithWordi[j]]);
+ int temp = phyloTree->getGenusIndex(names[seqsWithWordi[j]]);
count[temp]++; //increment count of seq in this genus who have this word
}
//probabilityInThisTaxonomy = (# of seqs with that word in this taxonomy + probabilityInTemplate) / (total number of seqs in this taxonomy + 1);
- wordGenusProb[i][k] = log((count[genusNodes[k]] + probabilityInTemplate) / (float) (genusTotals[k] + 1));
+ wordGenusProb[i][k] = log((count[k] + probabilityInTemplate) / (float) (genusTotals[k] + 1));
- if (count[genusNodes[k]] != 0) {
+ if (count[k] != 0) {
#ifdef USE_MPI
int pid;
MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
/**************************************************************************************************/
Bayesian::~Bayesian() {
try {
-
- delete phyloTree;
- if (database != NULL) { delete database; }
+ if (phyloTree != NULL) { delete phyloTree; }
+ if (database != NULL) { delete database; }
}
catch(exception& e) {
m->errorOut(e, "Bayesian", "~Bayesian");
//bootstrap - to set confidenceScore
int numToSelect = queryKmers.size() / 8;
+ if (m->debug) { m->mothurOut(seq->getName() + "\t"); }
+
tax = bootstrapResults(queryKmers, index, numToSelect);
+
+ if (m->debug) { m->mothurOut("\n"); }
return tax;
}
int seqTaxIndex = tax;
TaxNode seqTax = phyloTree->get(tax);
+
while (seqTax.level != 0) { //while you are not at the root
itBoot2 = confidenceScores.find(seqTaxIndex); //is this a classification we already have a count on
confidence = itBoot2->second;
}
+ if (m->debug) { m->mothurOut(seqTax.name + "(" + toString(((confidence/(float)iters) * 100)) + ");"); }
+
if (((confidence/(float)iters) * 100) >= confidenceThreshold) {
confidenceTax = seqTax.name + "(" + toString(((confidence/(float)iters) * 100)) + ");" + confidenceTax;
simpleTax = seqTax.name + ";" + simpleTax;
}
-
+
seqTaxIndex = seqTax.parent;
seqTax = phyloTree->get(seqTax.parent);
}