// Author: David Alexander #include #include #include using boost::math::binomial_distribution; using boost::math::complement; using boost::math::cdf; namespace ConsensusCore { double BinomialSurvival(int q, int size, double prob, bool asPhred) { binomial_distribution dist(size, prob); double tail = q < 0 ? 1 : cdf(complement(dist, q)); return asPhred ? -10. * log10(tail) : tail; } }