-
Notifications
You must be signed in to change notification settings - Fork 596
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
SelectVariants and VariantFiltration not updating AC, AN and AF for --setFilteredGtToNocall #1871
Conversation
@droazen Please choose a reviewer. |
@akiezun Would you have time to review this one this week, since you've been looking at Ron's other PRs? |
@@ -177,6 +178,9 @@ | |||
|
|||
private final List<Allele> diploidNoCallAlleles = Arrays.asList(Allele.NO_CALL, Allele.NO_CALL); | |||
|
|||
// Number of called alleles | |||
int calledAlleles = 0; |
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.
remove this field. It is state that is not carried over apply
calls and thus it is useless. Turn it into a temp and pass directly to methods that need it
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.
Moved to makeGenotypes()
.
looks good. small edits. back to you @ronlevine. Please rebase before next round. |
@ronlevine Will you have time to address Adam's comments on this PR? |
Yes. It will have to wait until Monday. |
9104222
to
9ebdaf3
Compare
@droazen Please take a look. Note that I removed the functional programming in |
public static void updateChromosomeCountsInfo(final Map<Allele, Integer> calledAltAlleles, final int calledAlleles, | ||
final VariantContextBuilder builder) { | ||
Utils.nonNull(calledAltAlleles, "Called alternate alleles can not be null"); | ||
Utils.nonNull(builder, "Variant context builder can not be null"); |
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.
you might want a guard against negative calledAlleles here
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.
Done
@ronlevine It looks to me that there could be some refactoring done here to separate out the AF update logic into a single function call that could be used in multiple places rather than having two sets of fairly complicated and highly similar logic. Could you see if that's doable? |
@lbergelson I refactored the common logic into a utility class. Please take a look. |
@lbergelson Per your suggestion, I made |
@@ -1349,4 +1351,119 @@ private static int indexOfSameAllele(final VariantContext vc, final Allele allel | |||
|
|||
return -1; | |||
} | |||
|
|||
/** | |||
* Add chromosome Counds (AC, AN and AF) to the VCF header lines |
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.
typo: counds
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 chromosome counts established nomenclature that I'm not aware of? It seems like allele counts is more accurate to me since this is all per allele.
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.
Kind of. There are the classes ChromosomeCounts
and ChromosomeCountConstants
.
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.
So there are. Wait on doing those renames until I talk with a few people here about what the right name is. I don't want it to be inconsistent, but I think it's confusing how it is at the moment.
- Also, I noticed that VariantContextUtils has
calculateChromosomeCounts
which seems to be very similar to the new methods in this pr. Did we know about those going in to these changes? Are we duplicating code that already exists? - I also noticed that ChromosomeCountConstants seems to be totally redundant with ChromosomeCounts. Could you remove ChromoSomeCountConstants while you're in this code? It looks like add ChromomeCounts should probably just addAll ChromosomeCounts.getDescriptions as well..
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.
- Removed
getCalledChromosomeCounts
andupdateChromosomeCountsInfo
and replaced theVariantContextUtils .calculateChromosomeCounts
. - Removed
ChromoSomeCountConstants
.
@ronlevine Sorry for the slow response. I like it much more with the refactoring you did. I had a few minor comments. I want to ask @vdauwera about the names on monday, I find them confusing, but if it's standard nomenclature then we should keep them. So don't do any renaming until I get back to you about that I guess. |
@ronlevine I consulted with Geraldine. Keep calling things chromosome counts. That seems to be the accepted name. |
@lbergelson Incorporated your comments. Back to you. |
@ronlevine Looks good to me. Feel free to merge after squashing/rebasing if there aren't any issues with the rebase. Ignore the codacy failure, it's something I was testing but I don't think it's that useful. |
…-setFilteredGtToNocall
b230d3c
to
88acbda
Compare
Fixes #1731
Summary of changes