How To Reorder Bam File Contigs For The Gatk Pipeline
2
1
Entering edit mode
11.4 years ago
win ▴ 970

i have a sorted & read group added bam file and when i try to run the following GATK command on it

java -jar GenomeAnalysisTK.jar -T RealignerTargetCreator -R hg19.fa -o read.bam.list -I read.sorted.bam

I get the following message

input file reads and reference have incompatible contigs

i can see that in my bam file the contig order is as follows chr1,.......chrX,.......chr18,.......chrY,.....chr22,.....chrM whereas the reference contig order is chr1,chr2........chr22,chrX,chrY,chrM

does sorting the bam file not take care of this issue?

any ideas how this can issue can be fixed?

thanks in advance.

bam contigs • 7.3k views
ADD COMMENT
5
Entering edit mode
11.4 years ago

You'll need to use a FASTA reference file that includes the same chromosome names and orders as your BAM file. If they differ, as yours do, you'll need to use a tool like picard ReorderSam:

http://picard.sourceforge.net/command-line-overview.shtml#ReorderSam

Note that sorting and ordering are two related but different topics. A BAM file can be sorted but not in the correct order; this is the case you have.

ADD COMMENT
0
Entering edit mode

Does that mean if I have chr1, chr2 ... in my reference file, but chr1, chr3 in my BAM file. The file could be sorted by position but not ordered correctly?

ADD REPLY
0
Entering edit mode
11.4 years ago
win ▴ 970

Thanks. I did try and run ReorderSam, it runs for sometime and then stops, the bam file contains nothing. Any ideas?

ADD COMMENT
0
Entering edit mode

I have no idea what your problem might be. I recommend that you find a local bioinformatics collaborator who can work through the first dataset with you.

ADD REPLY
0
Entering edit mode

the issue is sorted for now, it started working when i changed the TMP_DIR value in picard. I'll try and finish rest of the analysis and post here.

ADD REPLY

Login before adding your answer.

Traffic: 2455 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6