This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error When Running Gatk

I am Calling snps and indels using the pipeline referred in this post: http://www.biostars.org/post/show/1268/what-is-the-best-pipeline-for-human-whole-exome-sequencing/ In a step, realign, my code like this:

java -jar GenomeAnalysisTK.jar -T RealignerTargetCreator -R GRCh37.c.fasta -I ../s_4.sort.rg.bam -o ../s_4.intervals

And usually it cannot generate a interval file...(But I can really get it sometimes, I do not know why) The error message like this:

##### ERROR See the documentation (rerun with -h) for this tool to view allowable command-line arguments.
##### ERROR Visit our wiki for extensive documentation http://www.broadinstitute.org/gsa/wiki
##### ERROR Visit our forum to view answers to commonly asked questions http://getsatisfaction.com/gsa
##### ERROR
##### ERROR MESSAGE: SAM/BAM file ../s_4/s_4.sort.rg.bam is malformed: Premature EOF; BinaryCodec in readmode; streamed file (filename not available)

I got s_4.sort.rg.bam by sorting it using samtools sort and then using picardtools AddOrReplaceReadGroups.jar .

Furthermore, if I samtools the file s_4.sort.rg.bam, the warning like this:

samtools view  s_4.sort.rg.bam | less
[bam_header_read] EOF marker is absent. The input is probably truncated.

So how to deal with this problem?

error gatk

2 answers

Both tools are telling you the problem: your BAM file is truncated. Did you cancel the sort or Picard operation prematurely? Did it crash in the middle for some reason? Try making a new BAM file that isn't truncated. You can test out the new BAM file with Picard ValidateSamFile.

But my raw bam files are also truncated. How could I deal with that? By the way, why I can run -T UnifiedGenotyper but cannot run -T RealignerTargetCreator

The answer is the same - remake the BAM (perhaps from the raw reads). 9 times out of 10, this means something bad happened and you shouldn't want to continue your analysis with the defective file.

I don't know why GATK is pickier on one command than another.

I just had a similar error after using Picard to remove duplicate information from BAM files. My issue was that the BAM index was then out of date; the error was fixed by reindexing the BAM file using samtools.

Log in to answer this question.