#include "kmer.hpp"
/**************************************************************************************************/
-Bayesian::Bayesian(string tfile, string tempFile, string method, int ksize, int cutoff) :
-Classify(tfile, tempFile, method, ksize, 0, 0, 0, 0), kmerSize(ksize), confidenceThreshold(cutoff) {
+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;
mothurOut("It took " + toString(time(NULL) - start) + " seconds get probabilities. "); mothurOutEndLine();
}
catch(exception& e) {
- errorOut(e, "Bayesian", "getTaxonomy");
+ errorOut(e, "Bayesian", "Bayesian");
exit(1);
}
}
/**************************************************************************************************/
string Bayesian::getTaxonomy(Sequence* seq) {
try {
- string tax;
+ string tax = "";
Kmer kmer(kmerSize);
//get words contained in query
//bootstrap - to set confidenceScore
int numToSelect = queryKmers.size() / 8;
tax = bootstrapResults(queryKmers, index, numToSelect);
-
+
return tax;
}
catch(exception& e) {
map<string, int>::iterator itBoot2;
map<int, int>::iterator itConvert;
- for (int i = 0; i < 100; i++) {
+ for (int i = 0; i < iters; i++) {
vector<int> temp;
for (int j = 0; j < numToSelect; j++) {
}
if (confidence >= confidenceThreshold) {
- confidenceTax = seqTax.name + "(" + toString(confidence) + ");" + confidenceTax;
+ confidenceTax = seqTax.name + "(" + toString(((confidence/(float)iters) * 100)) + ");" + confidenceTax;
simpleTax = seqTax.name + ";" + simpleTax;
}