-
-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multi-allelic variants #976
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## tb-add-downsample-vcf #976 +/- ##
=========================================================
- Coverage 95.64% 95.63% -0.01%
=========================================================
Files 127 127
Lines 7457 7473 +16
Branches 521 501 -20
=========================================================
+ Hits 7132 7147 +15
- Misses 325 326 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
f559b3f
to
87f07fe
Compare
87f07fe
to
8f7a4eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me. A couple very minor issues, but I think the functional organization is actually improved and easier to understand even with the more complex likelihood model.
val logProbs: Array[Double] = Array( | ||
math.log10(epsilon), | ||
math.log10((1 - epsilon) / 2), | ||
math.log10(1 - epsilon) | ||
) | ||
// compute genotype log-likelihoods | ||
(0 until numAlleles).flatMap(b => | ||
(0 to b).map(a => | ||
(0 until numAlleles).map(allele => | ||
logProbs(Array(a, b).count(_ == allele)) * alleleDepths(allele) | ||
).sum | ||
) | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that this passes the equivalency test with the biallelic case, but I found it very difficult to understand. It might help to have a bit more commentary here. I'd suggest at least something like:
// compute genotype log-likelihoods in a flat array pairing each allele with all alleles earlier or equal to it
// e.g. lp_AA, lp_BA, lp_BB, lp_CA, lp_CB, lp_CC, ...
Likelihoods.logToPhredLikelihoods(genotypeLikelihoods) | ||
} | ||
|
||
def mostLikelyGenotype: Option[(Int, Int)] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def mostLikelyGenotype: Option[(Int, Int)] = { | |
private def mostLikelyGenotype: Option[(Int, Int)] = { |
@@ -13,6 +13,7 @@ import com.fulcrumgenomics.vcf.DownsampleVcf.{downsampleAndRegenotype, winnowVar | |||
|
|||
import scala.math.log10 | |||
import scala.util.Random | |||
import scala.tools.nsc.doc.html.HtmlTags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this?
No description provided.