Skip to content
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

removing A,R, and G length attributes when ReblockGVCF subsets an allele #8209

Merged
merged 4 commits into from
Mar 2, 2023

Conversation

meganshand
Copy link
Contributor

Previously if an input gVCF had allele length, reference length, or genotype length annotations in the FORMAT field, reblockGVCF would not remove all of them at sites where an allele was dropped. This makes the output gVCF invalid since the annotation length no longer matches the length described in the header at those sites. This PR fixes up F1R2, F2R1, and AF annotations and removes any other annotations that are not already handled that are defined as A, R, or G length in the header.

@gatk-bot
Copy link

gatk-bot commented Feb 16, 2023

Github actions tests reported job failures from actions build 4195524107
Failures in the following jobs:

Test Type JDK Job ID Logs
integration 11.0.11+9 4195524107.12 logs
integration 8 4195524107.0 logs

@meganshand
Copy link
Contributor Author

@ldgauthier can you please suggest a reviewer? Thanks!

Copy link
Contributor

@ldgauthier ldgauthier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple minor discussion points. I'm glad you addressed my ancient TODO!

@@ -249,6 +251,15 @@ public void onTraversalStart() {
}
}

//Allele length and Genotype length annotations need to be subset or removed if alleles are dropped so we need to parse the header for annotation count types
for(final VCFFormatHeaderLine formatHeaderLine : inputHeader.getFormatHeaderLines()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Occasionally the header is wrong, but it's usually A should be R or vice versa, not const should be A. I think this is fine since we're just using this as a list to remove, but it's something to keep in mind.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, in that case I'll add a warning for the logs that at least lists which annotations have been removed for easier debugging in the future.

final int[] newAnnot = IntStream.range(0, allelesToKeep.size()).map(n -> oldAnnot[allelePermutation.fromIndex(n)]).toArray();
final int nonRefIndex = allelesToKeep.indexOf(Allele.NON_REF_ALLELE);
if (nonRefIndex != -1 && nonRefIndex < newAnnot.length) {
newAnnot[nonRefIndex] = 0; //we will "lose" coverage here, but otherwise merging NON_REF AD counts with other alleles "creates" reads
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I can't follow my own logic here, but you just copied so you're not to blame.

@meganshand meganshand merged commit 4c1fb92 into master Mar 2, 2023
@meganshand meganshand deleted the ms_reblock_annots branch March 2, 2023 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants