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

Null pointer exception on specific cases (high ploidy values) #8158

Closed
2 tasks
kyriegorrin opened this issue Jan 12, 2023 · 2 comments
Closed
2 tasks

Null pointer exception on specific cases (high ploidy values) #8158

kyriegorrin opened this issue Jan 12, 2023 · 2 comments
Labels

Comments

@kyriegorrin
Copy link

kyriegorrin commented Jan 12, 2023

Bug Report

Affected tool(s) or class(es)

Bug when this line is executed:

oneShotLogger.warn("Length of PL arrays for this VC(position:" + reducedVC.getStart() + ", alleles:" + reducedVC.getNAlleles()

Casued because attribute "oneShotLogger" is uninitialized. See line (

) and its missing initialization in the constructor method (
protected GenotypingEngine(final Config configuration,
).

Affected version(s)

  • Latest public release version [4.3.0.0]
  • Latest master branch as of [12/01/2023]

Description

I work as support for a HPC cluster and this bug has affected one of our users, so I won't be able to provide the exact specifics. Long story short, the user reports that for a high enough value of ploidy (20-50), they start getting null pointer exception errors. Here we can see an example of how they launch the program:

gatk --java-options "-Xmx4g" HaplotypeCaller \
-I ${bamfile} \
-R ${reference} \
-O ${outpath}/${sample_id}.ploidy_${SLURM_ARRAY_TASK_ID}.output.g.vcf.gz \
-RF MappingQualityReadFilter \
--minimum-mapping-quality 10 \
--max-alternate-alleles 10 \
--max-genotype-count 75000 \
--dont-use-soft-clipped-bases true \
-ploidy ${SLURM_ARRAY_TASK_ID} \
-ERC GVCF

And this is the stack trace obtained when it fails:

java.lang.NullPointerException: Cannot invoke "org.broadinstitute.hellbender.utils.logging.OneShotLogger.warn(String)" because "this.oneShotLogger" is null
at org.broadinstitute.hellbender.tools.walkers.genotyper.GenotypingEngine.calculateGenotypes(GenotypingEngine.java:147)
at org.broadinstitute.hellbender.tools.walkers.haplotypecaller.HaplotypeCallerGenotypingEngine.assignGenotypeLikelihoods(HaplotypeCallerGenotypingEngine.java:219)
at org.broadinstitute.hellbender.tools.walkers.haplotypecaller.HaplotypeCallerEngine.callRegion(HaplotypeCallerEngine.java:700)
at org.broadinstitute.hellbender.tools.walkers.haplotypecaller.HaplotypeCaller.apply(HaplotypeCaller.java:273)
at org.broadinstitute.hellbender.engine.AssemblyRegionWalker.processReadShard(AssemblyRegionWalker.java:200)
at org.broadinstitute.hellbender.engine.AssemblyRegionWalker.traverse(AssemblyRegionWalker.java:173)
at org.broadinstitute.hellbender.engine.GATKTool.doWork(GATKTool.java:1085)
at org.broadinstitute.hellbender.cmdline.CommandLineProgram.runTool(CommandLineProgram.java:140)
at org.broadinstitute.hellbender.cmdline.CommandLineProgram.instanceMainPostParseArgs(CommandLineProgram.java:192)
at org.broadinstitute.hellbender.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:211)
at org.broadinstitute.hellbender.Main.runCommandLineProgram(Main.java:160)
at org.broadinstitute.hellbender.Main.mainEntry(Main.java:203)
at org.broadinstitute.hellbender.Main.main(Main.java:289)

The user mentioned that this didn't happen on GATK 4.1, so I've been comparing both versions of the code. It turns out that the implementation of "GenotypingEngine.java" has changed since then, and after some digging, I noticed that the issue is that the newer versions have uninitialized instances of the class "OneShotLogger".

The fix is simple, I've added the change myself and built GATK again. The user reports that the issue is gone. Just add the following code inside the constructor method:

protected GenotypingEngine(final Config configuration,
                               final SampleList samples,
                               final boolean doAlleleSpecificCalcs) {
        this.configuration = Utils.nonNull(configuration, "the configuration cannot be null");
        Utils.validate(!samples.asListOfSamples().isEmpty(), "the sample list cannot be null or empty");
        this.samples = samples;
        this.doAlleleSpecificCalcs = doAlleleSpecificCalcs;
        logger = LogManager.getLogger(getClass());
        this.oneShotLogger = new OneShotLogger(logger); // <------ ADD THIS LINE
        numberOfGenomes = this.samples.numberOfSamples() * configuration.genotypeArgs.samplePloidy;
        alleleFrequencyCalculator = AlleleFrequencyCalculator.makeCalculator(configuration.genotypeArgs);
    }

Steps to reproduce

See description, but I can't provide the exact inputs used for it.

Expected behavior

The null pointer exception shouldn't occur, there should be a warning only.

Actual behavior

Program crashes with null pointer exception for high enough values of ploidy.

@lbergelson
Copy link
Member

@kyriegorrin Woops. Thanks for the excellent bug report. I opened PR to fix it.

@lbergelson
Copy link
Member

fixed by #8159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants