Skip to content

Commit

Permalink
Added a comment documenting numerical issues with log10factorial in A…
Browse files Browse the repository at this point in the history
…lleleFractionLikelihoods.
  • Loading branch information
samuelklee committed Jan 28, 2022
1 parent ed84d00 commit fc02f7a
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ static double hetLogLikelihood(final AlleleFractionGlobalParameters parameters,
- n * log(majorFraction + minorFraction * lambda0RefMinor);
final double refMinorLogLikelihood = logNotPi + logcRefMinor + Gamma.logGamma(rhoRefMinor) - rhoRefMinor * log(tauRefMinor);

// changing the factorial implementation below may introduce non-negligible numerical differences;
// note https://github.com/broadinstitute/gatk/pull/7652
final double outlierLogLikelihood = logPi + log10ToLog(log10Factorial(a) + log10Factorial(r) - log10Factorial(a + r + 1));

return NaturalLogUtils.logSumExp(altMinorLogLikelihood, refMinorLogLikelihood, outlierLogLikelihood);
Expand Down

0 comments on commit fc02f7a

Please sign in to comment.