Repository navigation
Mutect2 works with multiple tumor and normal samples. - #5560
Conversation
ldgauthier
left a comment
There was a problem hiding this comment.
Some minor suggestions and questions. Our annotation system is so kludgy, but I don't have a lot of suggestions for reducing the amount of boilerplate.
| if (MTAC.mitochondria) { | ||
| final Set<String> samples = ReadUtils.getSamplesFromHeader(getHeaderForReads()); | ||
| if (samples.size() != 1) { | ||
| throw new UserException(String.format("The input bam has more than one sample: %s", Arrays.toString(samples.toArray()))); |
There was a problem hiding this comment.
I hope this doesn't require ridiculous amounts of memory to call MT across multiple samples. It would be good to suggest a threshold where GVCF mode becomes preferable for performance reasons.
There was a problem hiding this comment.
Or maybe we should recommend multiple samples autosomes as one M2 call and the MT contig should only be in GVCF mode? (Autosomes in GVCF mode are probably verrrrrrry sloooooow.)
There was a problem hiding this comment.
Or maybe we should recommend multiple samples autosomes as one M2 call and the MT contig should only be in GVCF mode?
I agree, but I was thinking in waiving the exception that we could be laissez-faire. I mean, what if someone wants to joint call a couple of 1000x mitochondria from the same person? If the samples are from different people I don't object to forbidding it outright, but there's no way to know that.
There was a problem hiding this comment.
Maybe it's not the end of the world if it takes a long time, as long as it's not an astronomical amount of memory. On a related note, hopefully the dynamic graph pruning already uses the total coverage across all samples?
There was a problem hiding this comment.
On a related note, hopefully the dynamic graph pruning already uses the total coverage across all samples?
Fortunately, yes.
| final int normalMedianRefBaseQuality = GATKProtectedVariantContextUtils.getAttributeAsIntArray( | ||
| normalGenotype, BaseQuality.KEY, () -> new int[] {IMPUTED_NORMAL_BASE_QUALITY}, IMPUTED_NORMAL_BASE_QUALITY)[0]; | ||
| final double normalPValue = 1 - new BinomialDistribution(null, normalDepth, QualityUtils.qualToErrorProb(normalMedianRefBaseQuality)) | ||
| final int medianRefBaseQuality = vc.getAttributeAsIntList(BaseQuality.KEY, IMPUTED_NORMAL_BASE_QUALITY).get(0); |
There was a problem hiding this comment.
I like your abstract PerAlleleAnnotation method that builds the header lines, but I'd rather that BaseQuality.KEY referred to a value in GATKVCFConstants.
| } | ||
| final int[] strandBiasCounts = GATKProtectedVariantContextUtils.getAttributeAsIntArray(tumorGenotype, GATKVCFConstants.STRAND_BIAS_BY_SAMPLE_KEY, ()->null, -1); | ||
| final MutableInt altForwardCount = new MutableInt(0); | ||
| final MutableInt altReverseCount = new MutableInt(0); |
There was a problem hiding this comment.
What's the benefit of changing this to a MutableInt?
There was a problem hiding this comment.
I didn't want the array anymore because with a pass over samples requires it seemed too opaque to use an array to encapsulate two numbers. And once they're two numbers I like the MutableInt because it's final and it makes it more explicit that the for loop below is intended to grow the counts sample-by-sample. But, I mean, at the end of the day this is my own idiosyncratic preference and I can't really justify it beyond all argument. Do you think I should keep it an int[]?
There was a problem hiding this comment.
The way we have it in other places in the code is as an int array with constants describing the indices in the array as totalReadCounts[ALT_FORWARD_COUNT] or similar. I personally prefer primitives from a memory scalability perspective, but given that this is just two values readability is more important. If you think it's more clear that this is a running total if it's a final MutableInt, then I can be on board.
There was a problem hiding this comment.
I'm a dunce at reading anything that resembles C. It's clearer to me this way.
|
Looks good to me, but I mostly just looked at the annotation parts. I'll let @takutosato review for functionality. |
11dc6bd to
6d4d057
Compare
|
I just rebased over Laura's GVCF mode PR. |
Codecov Report
@@ Coverage Diff @@
## master #5560 +/- ##
===============================================
+ Coverage 87.077% 87.092% +0.015%
- Complexity 31479 31525 +46
===============================================
Files 1930 1930
Lines 145054 145231 +177
Branches 16075 16095 +20
===============================================
+ Hits 126308 126484 +176
- Misses 12896 12897 +1
Partials 5850 5850
|
| final Genotype tumorGenotype = vc.getGenotype(tumorSample); | ||
|
|
||
| if (!tumorGenotype.hasExtendedAttribute(UniqueAltReadCount.UNIQUE_ALT_READ_SET_COUNT_KEY)) { | ||
| if (vc.hasAttribute(UniqueAltReadCount.KEY)) { |
| ##source=Mutect2 | ||
| #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA12878 | ||
| chrM 152 . T C . . DP=1582;ECNT=1;TLOD=5266.19;POPAF=5.000e-08 GT:AD:AF:F1R2:F2R1:MBQ:MFRL:MMQ:MPOS:OCM:POTENTIAL_POLYMORPHIC_NUMT 0/1:3,1556:0.998:2,777:1,779:30,30:16270,369:60,60:42:0:true | ||
| chrM 263 . A G . . DP=858;ECNT=4;TLOD=2641.72;POPAF=5.000e-08 GT:AD:AF:F1R2:F2R1:MBQ:MFRL:MMQ:MPOS:OCM 0/1:1,831:0.999:0,403:1,428:10,30:292,305:60,60:32:800 |
There was a problem hiding this comment.
Did you edit this by hand? For the second variant I think 800 should have been deleted instead of 32.
For the record, I'm not wasting time going through every vcf file looking for typos - I just happened to notice this particular one (and it could very well be not a typo)
There was a problem hiding this comment.
You're right. Fixed.
4864a9b to
75df665
Compare
@takutosato Most of this PR is refactoring to make filtering work for multiple samples while leaving single-pair output unchanged. For example, moving FORMAT annotations to the INFO field, keeping track of the sample of orientation bias priors etc.
I'm leaving the wdl unchanged for now. It will still work with the new release.