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

Fix for NPE when GDB has too many alleles #7738

Merged
merged 5 commits into from
Mar 30, 2022
Merged

Fix for NPE when GDB has too many alleles #7738

merged 5 commits into from
Mar 30, 2022

Conversation

ldgauthier
Copy link
Contributor

and low quality genotypes allow variant to pass QUAL filter

@gatk-bot
Copy link

gatk-bot commented Mar 28, 2022

Travis reported job failures from build 38284
Failures in the following jobs:

Test Type JDK Job ID Logs
unit openjdk11 38284.13 logs
integration openjdk11 38284.12 logs
cloud openjdk8 38284.1 logs
cloud openjdk11 38284.14 logs
unit openjdk8 38284.3 logs

@ldgauthier
Copy link
Contributor Author

The NPE was happening at highly multiallelic sites that ALSO had enough GQ0 homozygous reference genotypes to introduce enough doubt about the site being reference that the site passed the QUAL filter. Then it went on to annotation, which is where the NPE arose. I also added a check in the annotation code so we can be more graceful and informative.

@gatk-bot
Copy link

gatk-bot commented Mar 29, 2022

Travis reported job failures from build 38297
Failures in the following jobs:

Test Type JDK Job ID Logs
unit openjdk11 38297.13 logs
integration openjdk11 38297.12 logs
cloud openjdk8 38297.1 logs
cloud openjdk11 38297.14 logs

Copy link
Contributor

@droazen droazen left a comment

Choose a reason for hiding this comment

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

@ldgauthier Looks good to me -- I've just requested some minor tweaks, then this can go in once tests pass

@@ -306,6 +309,10 @@ else if ( clazz.equals(int[].class) ) {
}

final double[] likelihoodSums = calculateLikelihoodSums(vc, defaultPloidy, allHomRefData);
if (MathUtils.sum(likelihoodSums) == 0.0 && !allHomRefData) {
throw new IllegalStateException("No likelihood sum exceeded zero -- method was called for variant data " +
"with no variant information.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Are users likely to encounter this error in practice? If yes, maybe add a bit more contextual info to make it less cryptic (such as the fact that we're doing allele subsetting and calculating the most likely alleles)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this would be if a developer called this method under the wrong circumstances. In the buggy behavior we spent a loooooong time calculating on all-zero data, which is weird and annoying and this would definitely put a stop to it.

@@ -124,11 +124,14 @@ public AFCalculationResult calculate(final VariantContext vc) {
* Compute the probability of the alleles segregating given the genotype likelihoods of the samples in vc
*
* @param vc the VariantContext holding the alleles and sample information. The VariantContext
* must have at least 1 alternative allele
* must have at least 1 alternative allele. Hom-ref genotype likelihoods can be approximated
* but
Copy link
Contributor

Choose a reason for hiding this comment

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

but .... ?

* @return result (for programming convenience)
*/
public AFCalculationResult calculate(final VariantContext vc, final int defaultPloidy) {
Utils.nonNull(vc, "VariantContext cannot be null");
Utils.validate(vc.getGenotypes().stream().anyMatch(Genotype::hasLikelihoods),
"VariantContext must contain at least one genotype with likelihoods");
Copy link
Contributor

Choose a reason for hiding this comment

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

In these error messages, it might be good to include a list of ways that you could end up with genotypes with no likelihoods, to help users debug.

args.add("-G");
args.add("StandardAnnotation");
args.add("-G");
args.add("AS_StandardAnnotation");
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using ArgumentsBuilder in the future

@gatk-bot
Copy link

gatk-bot commented Mar 29, 2022

Travis reported job failures from build 38312
Failures in the following jobs:

Test Type JDK Job ID Logs
integration openjdk11 38312.12 logs
integration openjdk8 38312.2 logs

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