Hi,
I am attempting to merge the output of tophat in order to run some RNASeq
QC metrics. This is a single read 50 bp on a Hiseq. In order to get past
the fact that topphat gives a MAPQ of 255 to unmapped reads (not 0 as
expected by Picard) I used the following tool (
https://github.com/cbrueffer/tophat-recondition) to change it.
Once completed, I added read groups using picard and then sorted the
accepted_hits.bam by coordinate and sorted the unmapped reads by queryname.
tophat-recondition.py /home/ryan/NGS_Data/No_Dox
java -Xmx2g -jar /home/ryan/jar/picard-tools-1.129/picard.jar \
AddOrReplaceReadGroups \
I=/home/ryan/NGS_Data/unmapped_fixup.bam \
O=/home/ryan/NGS_Data/unmapped_fixup-RG.bam \
RGID=No_Dox RGLB=No_Dox RGPL=illumina RGPU=GCCAAT RGSM=No_Dox
java -Xmx2g -jar /home/ryan/jar/picard-tools-1.129/picard.jar \
AddOrReplaceReadGroups \
I=/home/ryan/NGS_Data/accepted_hits.bam \
O=/home/ryan/NGS_Data/accepted_hits-RG.bam \
SORT_ORDER=coordinate \
RGID=No_Dox RGLB=No_Dox RGPL=illumina RGPU=GCCAAT RGSM=No_Dox \
CREATE_INDEX=true
java -Xmx2g -jar /home/ryan/jar/picard-tools-1.129/picard.jar \
SortSam \
I=/home/ryan/NGS_Data/unmapped_fixup-RG.bam \
O=/home/ryan/NGS_Data/unmapped_fixup-RG-sorted.bam \
SORT_ORDER=queryname
java -Xmx2g -jar /home/ryan/jar/picard-tools-1.129/picard.jar \
SortSam \
I=/home/ryan/NGS_Data/accepted_hits-RG.bam \
O=/home/ryan/NGS_Data/accepted_hits-RG-sorted.bam \
SORT_ORDER=coordinate \
CREATE_INDEX=true
java -Xmx2g -jar /home/ryan/jar/picard-tools-1.129/picard.jar \
MergeBamAlignment \
UNMAPPED_BAM=/home/ryan/NGS_Data/unmapped_fixup-RG-sorted.bam \
ALIGNED_BAM=/home/ryan/NGS_Data/accepted_hits-RG-sorted.bam \
O=/home/ryan/NGS_Data/merge_unmapped_accepted_hits_No_Dox.bam \
SORT_ORDER=coordinate \
REFERENCE_SEQUENCE=/home/ryan/Reference/human_spikein/hg19_spikein.fa \
PROGRAM_RECORD_ID=Tophat \
PROGRAM_GROUP_VERSION=0.1 \
PROGRAM_GROUP_COMMAND_LINE=tophat/dummy \
PAIRED_RUN=false \
VALIDATION_STRINGENCY=LENIENT \
CREATE_INDEX=true
I then get the following warning followed by the error:
WARNING 2015-03-17 09:44:22 SamAlignmentMerger Exception merging
bam alignment - attempting to sort aligned reads and try again: Aligned
record iterator (HS3:608:C6LNLACXX:7:2101:9946:63417) is behind the
unmapped reads (HS3:608:C6LNLACXX:7:2101:9947:11009)
INFO 2015-03-17 09:44:33 SamAlignmentMerger Read 1000000 records
from alignment SAM/BAM.
INFO 2015-03-17 09:44:43 SamAlignmentMerger Read 2000000 records
from alignment SAM/BAM.
....
INFO 2015-03-17 09:58:01 SamAlignmentMerger Read 96000000 records
from alignment SAM/BAM.
INFO 2015-03-17 09:58:09 SamAlignmentMerger Read 97000000 records
from alignment SAM/BAM.
INFO 2015-03-17 09:58:15 SamAlignmentMerger Finished reading
97571897 total records from alignment SAM/BAM.
[Tue Mar 17 09:58:16 PDT 2015] picard.sam.MergeBamAlignment done. Elapsed
time: 14.32 minutes.
Runtime.totalMemory()=1908932608
To get help, see
http://broadinstitute.github.io/picard/index.html#GettingHelp
Exception in thread "main" java.lang.IllegalStateException: Aligned record
iterator (HS3:608:C6LNLACXX:7:1101:10000:11036) is behind the unmapped
reads (HS3:608:C6LNLACXX:7:1101:10000:48402)
at
picard.sam.AbstractAlignmentMerger.mergeAlignment(AbstractAlignmentMerger.java:383)
at
picard.sam.SamAlignmentMerger.mergeAlignment(SamAlignmentMerger.java:153)
at picard.sam.MergeBamAlignment.doWork(MergeBamAlignment.java:248)
at
picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:187)
at
picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:95)
at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:105)
I have searched and have been unsuccessful at resolving this problem. Any
ideas?
I am running picard 1.129 using java version "1.7.0_60"
ValidateSamFile on both inputs into MergeBamAlignment returns no errors in
those files. I am at a lost and seeking for help!
Thanks,
Ryan
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help