Question: How To Reorder Bam File Contigs For The Gatk Pipeline
1
gravatar for win
7.6 years ago by
win840
India
win840 wrote:

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 • 5.6k views
ADD COMMENTlink modified 7.6 years ago • written 7.6 years ago by win840
5
gravatar for Sean Davis
7.6 years ago by
Sean Davis26k
National Institutes of Health, Bethesda, MD
Sean Davis26k wrote:

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 COMMENTlink written 7.6 years ago by Sean Davis26k

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 REPLYlink written 3.4 years ago by SmallChess510
0
gravatar for win
7.6 years ago by
win840
India
win840 wrote:

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

ADD COMMENTlink modified 7.6 years ago • written 7.6 years ago by win840

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 REPLYlink written 7.6 years ago by Sean Davis26k

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 REPLYlink written 7.6 years ago by win840
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1875 users visited in the last hour