We've moved!
This site is now read-only. You can find our new documentation site and support forum for posting questions here.
Be sure to read our welcome blog!

LeftAlignIndels error setMaxRecordsInRam must be called before setHeader()

abaanoabaano Member
edited August 2012 in Ask the GATK team

Dear team,

I have been trying to run the LeftAlignIndels tool, however, keep getting this error "setMaxRecordsInRam must be called before setHeader()"

here is the full trace

ERROR stack trace

java.lang.IllegalStateException: setMaxRecordsInRam must be called before setHeader()
at net.sf.samtools.SAMFileWriterImpl.setMaxRecordsInRam(SAMFileWriterImpl.java:99)
at net.sf.samtools.SAMFileWriterFactory.initializeBAMWriter(SAMFileWriterFactory.java:180)
at net.sf.samtools.SAMFileWriterFactory.makeBAMWriter(SAMFileWriterFactory.java:163)
at net.sf.samtools.SAMFileWriterFactory.makeBAMWriter(SAMFileWriterFactory.java:136)
at org.broadinstitute.sting.gatk.io.storage.SAMFileWriterStorage.createBAMWriter(SAMFileWriterStorage.java:127)
at org.broadinstitute.sting.gatk.io.storage.SAMFileWriterStorage.(SAMFileWriterStorage.java:70)
at org.broadinstitute.sting.gatk.io.storage.SAMFileWriterStorage.(SAMFileWriterStorage.java:53)
at org.broadinstitute.sting.gatk.io.storage.StorageFactory.createStorage(StorageFactory.java:78)
at org.broadinstitute.sting.gatk.io.storage.StorageFactory.createStorage(StorageFactory.java:55)
at org.broadinstitute.sting.gatk.io.DirectOutputTracker.getStorage(DirectOutputTracker.java:42)
at org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterStub.addAlignment(SAMFileWriterStub.java:287)
at org.broadinstitute.sting.gatk.walkers.indels.LeftAlignIndels.emit(LeftAlignIndels.java:92)
at org.broadinstitute.sting.gatk.walkers.indels.LeftAlignIndels.map(LeftAlignIndels.java:110)
at org.broadinstitute.sting.gatk.walkers.indels.LeftAlignIndels.map(LeftAlignIndels.java:70)
at org.broadinstitute.sting.gatk.traversals.TraverseReads.traverse(TraverseReads.java:106)
at org.broadinstitute.sting.gatk.traversals.TraverseReads.traverse(TraverseReads.java:52)
at org.broadinstitute.sting.gatk.executive.LinearMicroScheduler.execute(LinearMicroScheduler.java:71)
at org.broadinstitute.sting.gatk.GenomeAnalysisEngine.execute(GenomeAnalysisEngine.java:269)
at org.broadinstitute.sting.gatk.CommandLineExecutable.execute(CommandLineExecutable.java:113)
at org.broadinstitute.sting.commandline.CommandLineProgram.start(CommandLineProgram.java:236)
at org.broadinstitute.sting.commandline.CommandLineProgram.start(CommandLineProgram.java:146)
at org.broadinstitute.sting.gatk.CommandLineGATK.main(CommandLineGATK.java:93)

ERROR ------------------------------------------------------------------------------------------
ERROR A GATK RUNTIME ERROR has occurred (version 2.0-39-gd091f72):
ERROR
ERROR Please visit the wiki to see if this is a known problem
ERROR If not, please post the error, 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: setMaxRecordsInRam must be called before setHeader()
ERROR ------------------------------------------------------------------------------------------

Do you have a suggestion on how to make it work.

Here is my execution line.

java -Xmx3g -jar GenomeAnalysisTK-2.0-39-gd091f72/GenomeAnalysisTK.jar -T LeftAlignIndels -R gatk_resources/hg19/ucsc.hg19.fasta -I input.bam -o input.bam

Thank you for your help

Best Answer

Answers

  • ebanksebanks Broad InstituteMember, Broadie, Dev ✭✭✭✭

    Yes, the fix for this has already been pushed. It will be available in the next release (Monday).

  • abaanoabaano Member

    Thank you. Looking forward to trying this tool out.

    Ogan

  • abaanoabaano Member

    Hi Eric,

    I downloaded the new release, however, I still get an error, a new one. I am not sure what the error is. Could you help me out please?

    Here is the trace.

    ERROR ------------------------------------------------------------------------------------------

    ERROR stack trace

    java.lang.NullPointerException
    at org.broadinstitute.sting.gatk.walkers.indels.LeftAlignIndels.map(LeftAlignIndels.java:93)
    at org.broadinstitute.sting.gatk.walkers.indels.LeftAlignIndels.map(LeftAlignIndels.java:70)
    at org.broadinstitute.sting.gatk.traversals.TraverseReads.traverse(TraverseReads.java:104)
    at org.broadinstitute.sting.gatk.traversals.TraverseReads.traverse(TraverseReads.java:52)
    at org.broadinstitute.sting.gatk.executive.LinearMicroScheduler.execute(LinearMicroScheduler.java:71)
    at org.broadinstitute.sting.gatk.GenomeAnalysisEngine.execute(GenomeAnalysisEngine.java:265)
    at org.broadinstitute.sting.gatk.CommandLineExecutable.execute(CommandLineExecutable.java:113)
    at org.broadinstitute.sting.commandline.CommandLineProgram.start(CommandLineProgram.java:236)
    at org.broadinstitute.sting.commandline.CommandLineProgram.start(CommandLineProgram.java:146)
    at org.broadinstitute.sting.gatk.CommandLineGATK.main(CommandLineGATK.java:93)

    ERROR ------------------------------------------------------------------------------------------
    ERROR A GATK RUNTIME ERROR has occurred (version 2.1-1-g270cc30):
    ERROR
    ERROR Please visit the wiki to see if this is a known problem
    ERROR If not, please post the error, 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 ------------------------------------------------------------------------------------------
  • ebanksebanks Broad InstituteMember, Broadie, Dev ✭✭✭✭

    Hmm, that shouldn't be possible. Are you sure that your BAM is valid? If so, can you please upload it (and the reference if that's not standard) so that I can take a look?

  • abaanoabaano Member

    Hi Eric,

    I have been trying different files and some seem to work some don't. They all have been processed by GATK/PICARD. I see no obvious problems with the files.

  • ebanksebanks Broad InstituteMember, Broadie, Dev ✭✭✭✭

    I can take a look if you upload one to our server.

  • abaanoabaano Member

    Where should I upload? Will attach take a bam file?

  • abaanoabaano Member
    edited August 2012

    Hi Eric,

    Sorry for the delay. I uploaded a bam file (for_ebanks_from_abaano folder). Let me now if there is anything else that I can provide. Thanks for the help.

  • ebanksebanks Broad InstituteMember, Broadie, Dev ✭✭✭✭

    Excellent. Thanks for the example bam.
    I'm pushing a fix now that will be available in the next release. Just so you know, the problem is that you have unmapped reads in your bam file that have CIGAR strings with indel operators...

  • abaanoabaano Member

    Thank you so much Eric.

    This and many others just like it, passed through many PICARD/GATK tools without issues. Is there something that I should fix on my end?

    Ogan

  • ebanksebanks Broad InstituteMember, Broadie, Dev ✭✭✭✭

    I'm not sure. Technically I saw errors from Picard (unmapped reads had non-zero mapping quality), but I guess they are allowed to have CIGARs...

  • abaanoabaano Member

    With GATK 2.X I started getting "SAMFileReader{something.bam} is malformed: BAM file has a read with mismatching number of bases and base qualities." error with many of my files. I ran picards validate on all my files and eventhough there were errors they They where fine running with GATK 1.6 . So I think something has changed from 1.X to 2.X. I tried turning on the MalformedReadsFilter using '-rf MalformedReads' however then I get "ERROR MESSAGE: Duplicate definition of argument with full name: filter_mismatching_base_and_quals". Are these related or completely separate issues?

  • ebanksebanks Broad InstituteMember, Broadie, Dev ✭✭✭✭

    The MalformedRead filter is applied by default so you don't need to add it to your command-line.

  • abaanoabaano Member

    Makes sense now. Does it supposed to take care of "mismatching number of bases and base qualities" error or is it handled by -defaultbasequality? I am trying to figure out whether the bam file issue is due to these or not? Maybe I should submit a separate post.

    In any case, thank you so much for all the help.

  • ebanksebanks Broad InstituteMember, Broadie, Dev ✭✭✭✭

    Yes, it's probably better to start a new thread (but remember that we can't really help with malformed bam files).

  • abaanoabaano Member

    I still see the "Code exception" error with version 2.1-8-g5efb575. I guess it is my bam file that is the problem.

  • ebanksebanks Broad InstituteMember, Broadie, Dev ✭✭✭✭
    Accepted Answer

    Sorry, I meant that it will be available in the next major release (2.2).

Sign In or Register to comment.