X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=bayesian.cpp;h=e6adfc24b863442a58edcd7f348c83f843b10635;hb=f27b66ce6415eb14c434f9850019c7cf140e023e;hp=5272b2d1761285f934e9e8e1a474fd27f1edc328;hpb=64ead0dc966e9a9768a24c8f55518db83ed2e82f;p=mothur.git diff --git a/bayesian.cpp b/bayesian.cpp index 5272b2d..e6adfc2 100644 --- a/bayesian.cpp +++ b/bayesian.cpp @@ -11,8 +11,8 @@ #include "kmer.hpp" /**************************************************************************************************/ -Bayesian::Bayesian(string tfile, string tempFile, string method, int ksize, int cutoff, bool p) : -Classify(tfile, tempFile, method, ksize, 0.0, 0.0, 0.0, 0.0), kmerSize(ksize), confidenceThreshold(cutoff), probs(p) { +Bayesian::Bayesian(string tfile, string tempFile, string method, int ksize, int cutoff, int i) : +Classify(tfile, tempFile, method, ksize, 0.0, 0.0, 0.0, 0.0), kmerSize(ksize), confidenceThreshold(cutoff), iters(i) { try { numKmers = database->getMaxKmer() + 1; @@ -116,18 +116,9 @@ string Bayesian::getTaxonomy(Sequence* seq) { int index = getMostProbableTaxonomy(queryKmers); //bootstrap - to set confidenceScore - if (probs) { - int numToSelect = queryKmers.size() / 8; - tax = bootstrapResults(queryKmers, index, numToSelect); - }else{ - TaxNode seqTax = phyloTree->get(index); - while (seqTax.level != 0) { //while you are not at the root - tax = seqTax.name + ";" + tax; - seqTax = phyloTree->get(seqTax.parent); - } - simpleTax = tax; - } - + int numToSelect = queryKmers.size() / 8; + tax = bootstrapResults(queryKmers, index, numToSelect); + return tax; } catch(exception& e) { @@ -151,7 +142,7 @@ string Bayesian::bootstrapResults(vector kmers, int tax, int numToSelect) { map::iterator itBoot2; map::iterator itConvert; - for (int i = 0; i < 100; i++) { + for (int i = 0; i < iters; i++) { vector temp; for (int j = 0; j < numToSelect; j++) {