Notice:
If you happen to see a question you know the answer to, please do chime in and help your fellow community members. We encourage our fourm members to be more involved, jump in and help out your fellow researchers with their questions. GATK forum is a community forum and helping each other with using GATK tools and research is the cornerstone of our success as a genomics research community.We appreciate your help!

Test-drive the GATK tools and Best Practices pipelines on Terra


Check out this blog post to learn how you can get started with GATK and try out the pipelines in preconfigured workspaces (with a user-friendly interface!) without having to install anything.

GATK depthofcoverage runtimeerror: nullpointerexception

jonasmstjonasmst Oslo, NorwayMember

Hi, I'm getting a nullpointerexception when trying to run the depthofcoverage tool. The stack trace is as follows:

##### ERROR ------------------------------------------------------------------------------------------
##### ERROR stack trace
java.lang.NullPointerException
        at java.util.TreeMap.compare(TreeMap.java:1290)
        at java.util.TreeMap.put(TreeMap.java:538)
        at java.util.TreeSet.add(TreeSet.java:255)
        at org.broadinstitute.gatk.utils.sam.ReadUtils.getSAMFileSamples(ReadUtils.java:70)
        at org.broadinstitute.gatk.engine.samples.SampleDBBuilder.addSamplesFromSAMHeader(SampleDBBuilder.java:66)
        at org.broadinstitute.gatk.engine.GenomeAnalysisEngine.initializeSampleDB(GenomeAnalysisEngine.java:846)
        at org.broadinstitute.gatk.engine.GenomeAnalysisEngine.execute(GenomeAnalysisEngine.java:296)
        at org.broadinstitute.gatk.engine.CommandLineExecutable.execute(CommandLineExecutable.java:121)
        at org.broadinstitute.gatk.utils.commandline.CommandLineProgram.start(CommandLineProgram.java:248)
        at org.broadinstitute.gatk.utils.commandline.CommandLineProgram.start(CommandLineProgram.java:155)
        at org.broadinstitute.gatk.engine.CommandLineGATK.main(CommandLineGATK.java:108)
##### ERROR ------------------------------------------------------------------------------------------
##### ERROR A GATK RUNTIME ERROR has occurred (version nightly-2016-03-23-g4d8dc3c):
##### ERROR
##### ERROR This might be a bug. Please check the documentation guide to see if this is a known problem.
##### ERROR If not, please post the error message, with stack trace, to the GATK forum.
##### ERROR Visit our website and forum for extensive documentation and answers to
##### ERROR commonly asked questions http://www.broadinstitute.org/gatk
##### ERROR
##### ERROR MESSAGE: Code exception (see stack trace for error itself)
##### ERROR ------------------------------------------------------------------------------------------

and the command is called as follows:

java -jar $HOME/software/gatk/nightly_build/GenomeAnalysisTK.jar \
-T DepthOfCoverage \
-R $ref \
-I $bam \
-o $SUBMITDIR/output/seqdepth_s1t

Where $bam is a path pointing to an accepted_hits.sorted.bam aligned using HISAT2. It's directory also contains the bam index (note that I do get a warning stating that my index is older than my bam file). $ref is an ensembl sequence .fasta file

I've tried running the latest stable release and the latest nightly build, both give errors. For what it's worth, GATK should have read/write permissions to the specified output path and the path of the bam-file, but not in the directory holding the reference, could that cause a problem or is it something else? Also, it's run on a cluster using slurm, if that's of any relevance.

Thanks in advance.
-Jonas

Best Answer

Answers

  • SheilaSheila admin Broad InstituteMember, Broadie, Moderator admin

    @jonasmst
    Hi Jonas,

    It could be an issue with the permissions for the reference directory. You can also try validating your bam file with ValidateSamFile.

    -Sheila

  • jonasmstjonasmst Oslo, NorwayMember
    edited March 2016

    Hi, Sheila, thank you for replying so quickly.

    I've tried copying the reference to an open environment to see if the permissions was the issue. To no avail, I'm afraid. I've also validated the BAM-file and, for good measure, reindexed it to get rid of the warning.

    Any other suggestions? Are there specific requirements to java version for instance? Or does the tool depend on any other software such as bedtools or samtools?

    Thanks, Jonas

  • SheilaSheila admin Broad InstituteMember, Broadie, Moderator admin

    @jonasmst
    Hi Jonas,

    Ah, yes GATK only supports Java 1.7 right now. Have a look at this document for help on switching between versions. No, the tool should not depend on other software.

    -Sheila

  • jonasmstjonasmst Oslo, NorwayMember

    I am still getting nullpointerexception when using java version 1.7.0_79, albeit on line 106 and not 108, but the errors look the same. Do you have any suggestions to other ways of calculating sequencing depth?

    I appreciate your help, thank you.
    -Jonas

    Issue · Github
    by Sheila

    Issue Number
    762
    State
    closed
    Last Updated
    Assignee
    Array
    Milestone
    Array
    Closed By
    chandrans
  • jonasmstjonasmst Oslo, NorwayMember

    Missing SM field seems to have been the culprit. For future reference, I added an SM-field by piping samtools view to sed and replacing the line:
    @RG ID:sample1
    with:
    @RG ID:sample1 SM:sample1
    before running PicardTools AddOrReplaceReadGroups to add the other groups. AddOrReplaceReadGroups would not work without the SM-field either. Reheading the Picard-output with Samtools reheader produced a bam-file on which GATK DepthOfCoverage seems to run fine.

    Thanks for all your help, Sheila!

  • SheilaSheila admin Broad InstituteMember, Broadie, Moderator admin

    @jonasmst
    Hi Jonas,

    Thanks for reporting your solution!

    -Sheila

Sign In or Register to comment.