Hello,
I am trying to run the gatk UnifiedGenotyper, but it complained that the bam file did not have group information. After looking at the documentation I ran the picard AddOrReplaceReadGroups as follows:
java -jar AddOrReplaceReadGroups.jar I=sample.bam O=sample_addGroup.bam SORT_ORDER=coordinate CREATE_INDEX=true RGPL=illumina RGID=184 RGSM=sample184 RGLB=bar RGPU=pu184 VALIDATION_STRINGENCY=LENIENT
This created bam file sample_addGroup.bam. However, when I tried to run gatk it complained that the contigs were out of order (reads contigs = [chr1, chr10, chr11, etc...] instead or coordinate order) even though I used the parameter SORT_ORDER=coordinate above.
So I ran the picard SortSam tool as follows:
java -jar SortSam.jar I=sample_addGroup.bam O=sample_addGroupSorted.bam SORT_ORDER=coordinate VALIDATION_STRINGENCY=SILENT
However, I'm getting the following error. Any ideas??? Thank you very much!!!!!!!!!
.
.
.
INFO 2012-02-13 09:42:51 SortSam Read 630000000 records.
INFO 2012-02-13 09:43:43 SortSam Read 640000000 records.
INFO 2012-02-13 09:44:36 SortSam Read 650000000 records.
INFO 2012-02-13 09:45:30 SortSam Read 660000000 records.
INFO 2012-02-13 09:46:20 SortSam Read 670000000 records.
[Mon Feb 13 09:46:22 EST 2012] net.sf.picard.sam.SortSam done. Elapsed time: 59.
17 minutes.
Runtime.totalMemory()=1423900672
Exception in thread "main" net.sf.samtools.FileTruncatedException: Premature end
of file
at net.sf.samtools.util.BlockCompressedInputStream.readBlock(BlockCompre
ssedInputStream.java:359)
at net.sf.samtools.util.BlockCompressedInputStream.available(BlockCompre
ssedInputStream.java:109)
at net.sf.samtools.util.BlockCompressedInputStream.read(BlockCompressedI
nputStream.java:234)
at java.io.DataInputStream.read(DataInputStream.java:132)
at net.sf.samtools.util.BinaryCodec.readBytesOrFewer(BinaryCodec.java:39
4)
at net.sf.samtools.util.BinaryCodec.readBytes(BinaryCodec.java:371)
at net.sf.samtools.util.BinaryCodec.readBytes(BinaryCodec.java:357)
at net.sf.samtools.BAMRecordCodec.decode(BAMRecordCodec.java:188)
at net.sf.samtools.BAMFileReader$BAMFileIterator.getNextRecord(BAMFileRe
ader.java:514)
at net.sf.samtools.BAMFileReader$BAMFileIterator.advance(BAMFileReader.j
ava:488)
at net.sf.samtools.BAMFileReader$BAMFileIterator.next(BAMFileReader.java
:478)
at net.sf.samtools.BAMFileReader$BAMFileIterator.next(BAMFileReader.java
:444)
at net.sf.samtools.SAMFileReader$AssertableIterator.next(SAMFileReader.j
ava:641)
at net.sf.samtools.SAMFileReader$AssertableIterator.next(SAMFileReader.j
ava:619)
at net.sf.picard.sam.SortSam.doWork(SortSam.java:67)
at net.sf.picard.cmdline.CommandLineProgram.instanceMain(CommandLineProg
ram.java:177)
at net.sf.picard.cmdline.CommandLineProgram.instanceMainWithExit(Command
LineProgram.java:119)
at net.sf.picard.sam.SortSam.main(SortSam.java:79)
Thank you so much Istvan! You're my guardian angel :-) In fact ReorderSam sorted the file in the order that I was expecting while SortSam did not. The truncated problem was something else, see my response to Matt below, but your response helped me tremendously once I got that first problem resolved. Thanks again!!!