-
Notifications
You must be signed in to change notification settings - Fork 592
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 option to recalculate the allele fraction based on AD instead of … #5118
Conversation
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.
Some comments.
|
||
/** | ||
* Created by gauthier on 8/15/18. | ||
* Bug Laura to fill this in |
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.
Might want to do something about this.
Utils.nonNull(vc, "vc is null"); | ||
|
||
final GenotypesContext genotypes = vc.getGenotypes(); | ||
if ( g == null || !g.isCalled() || g.hasExtendedAttribute(getKeyNames().get(0))) { //don't overwrite AF based on Bayesian estimate if it already exists |
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 should be clear in the class javadoc that this annotation does nothing if AF is already present.
else if (likelihoods != null) { | ||
DepthPerAlleleBySample adCalc = new DepthPerAlleleBySample(); | ||
final int[] AD = adCalc.annotateWithLikelihoods(vc, g, new LinkedHashSet<>(vc.getAlleles()), likelihoods); | ||
final double[] allAlleleFractions = MathUtils.normalizeFromRealSpace(Arrays.stream(AD).mapToDouble(x -> x*1.0).toArray()); |
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.
x -> x
will work here without the *1.0
@@ -235,10 +235,13 @@ private void addGenotypes(final LikelihoodMatrix<Allele> tumorLog10Matrix, | |||
final Optional<LikelihoodMatrix<Allele>> normalLog10Matrix, | |||
final VariantContextBuilder callVcb) { | |||
final double[] tumorAlleleCounts = getEffectiveCounts(tumorLog10Matrix); | |||
final Genotype tumorGenotype = new GenotypeBuilder(tumorSample, tumorLog10Matrix.alleles()) | |||
.AD(Arrays.stream(tumorAlleleCounts).mapToInt(x -> (int) FastMath.round(x)).toArray()) |
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.
Is AD
still getting added to the genotype in the new code below?
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.
Yes, the original code wrote out AD based on the Bayesian estimate, then overwrote it during annotation because DepthPerAlleleBySample
is a StandardMutectAnnotation
. So in theory, there didn't used to be a way to turn it off.
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 confirmed that the output without the arg does still have AD and added coverage in the tumor normal test.
66c2f20
to
d560cb5
Compare
…the Bayesian estimate
d560cb5
to
18e62d7
Compare
Codecov Report
@@ Coverage Diff @@
## master #5118 +/- ##
==============================================
+ Coverage 86.507% 86.577% +0.07%
- Complexity 29260 29716 +456
==============================================
Files 1814 1826 +12
Lines 135635 137753 +2118
Branches 15063 15313 +250
==============================================
+ Hits 117334 119262 +1928
- Misses 12833 13019 +186
- Partials 5468 5472 +4
|
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.
👍
…the Bayesian estimate
For @meganshand until @davidbenjamin addresses #5096 in a more rigorous way