#include "kmer.hpp"
/**************************************************************************************************/
-Bayesian::Bayesian(string tfile, string tempFile, string method, int ksize, int cutoff) :
-Classify(tfile, tempFile, method, ksize, 0.0, 0.0, 0.0, 0.0), kmerSize(ksize), confidenceThreshold(cutoff) {
+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) {
try {
numKmers = database->getMaxKmer() + 1;
/**************************************************************************************************/
string Bayesian::getTaxonomy(Sequence* seq) {
try {
- string tax;
+ string tax = "";
Kmer kmer(kmerSize);
//get words contained in query
int index = getMostProbableTaxonomy(queryKmers);
//bootstrap - to set confidenceScore
- int numToSelect = queryKmers.size() / 8;
- tax = bootstrapResults(queryKmers, index, numToSelect);
+ 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;
+ }
return tax;
}