In the first implementation of nucleotide diversity correction for Pool-Seq (https://github.com/magicDGS/popgenlib/pull/19), the countProbability(final int readCount, final int coverage, final int poolSize, final int poolCount) method is implementing the binomial distribution probability of readCount. In commons-math3, there is a BinomialDistribution implementation, which gives this probability with a faster algorithm.
Nevertheless, the BinomialDistribution class requires to be instantiated with the parameters to call the probabilty function, and that may have a performance penalty by class instantiation because we compute the probability often and for several distributions. We should check if we can substitute our method by new BinomialDistribution(coverage, (double) k / poolSize).probability(readCount) to clean our implementation and rely on a faster algorithm.
In the first implementation of nucleotide diversity correction for Pool-Seq (https://github.com/magicDGS/popgenlib/pull/19), the
countProbability(final int readCount, final int coverage, final int poolSize, final int poolCount)
method is implementing the binomial distribution probability ofreadCount
. In commons-math3, there is aBinomialDistribution
implementation, which gives this probability with a faster algorithm.Nevertheless, the
BinomialDistribution
class requires to be instantiated with the parameters to call the probabilty function, and that may have a performance penalty by class instantiation because we compute the probability often and for several distributions. We should check if we can substitute our method bynew BinomialDistribution(coverage, (double) k / poolSize).probability(readCount)
to clean our implementation and rely on a faster algorithm.