https://github.com/ekg/freebayes
Tip revision: a994e781423290df79453cc46da81fbd1c7160fc authored by Erik Garrison on 02 July 2013, 08:32:27 UTC
Setting Release-Version v9.9.1
Setting Release-Version v9.9.1
Tip revision: a994e78
Ewens.h
#include <map>
#include <cmath>
#include "Utility.h"
using namespace std;
// genotype priors
long double alleleFrequencyProbability(const map<int, int>& alleleFrequencyCounts, long double theta);
long double alleleFrequencyProbabilityln(const map<int, int>& alleleFrequencyCounts, long double theta);
long double __alleleFrequencyProbabilityln(const map<int, int>& alleleFrequencyCounts, long double theta);
class AlleleFrequencyProbabilityCache : public map<map<int, int>, long double> {
public:
long double alleleFrequencyProbabilityln(const map<int, int>& counts, long double theta) {
map<map<int, int>, long double>::iterator p = find(counts);
if (p == end()) {
long double pln = __alleleFrequencyProbabilityln(counts, theta);
insert(make_pair(counts, pln));
return pln;
} else {
return p->second;
}
}
};