Merging bam files
0
2
Entering edit mode
6.0 years ago
jyu429 ▴ 120

Hi, I'm trying to merge these two bam files and I did the command 

samtools merge merged.bam file1.bam file2.bam 

However, it gives me this error: [trans_tbl_init] @SQ SN (hg38_gold start=chr14:105786368 strand=+) found in binary header but not text header. I'm not sure how to get around this. Is there an option I need to turn on to suppress/fix this?

bam merge • 2.4k views
ADD COMMENT
1
Entering edit mode

I just checked the code. This should happen whenever you have a chromosome missing between the files that you want to merge. You might be able to get around this with samtool merge merged.bam file2.bam file1.bam, but if not then it makes sense to reheader at least one of the files to have all of the chromosomes (put the missing ones at the end, don't change the order of any of the existing ones!) and then merge.

ADD REPLY
1
Entering edit mode

Or you can try MergeSamFiles commans from picard tools. It is better in handling headers than samtools.

ADD REPLY
1
Entering edit mode

Indeed, picard tends to be a bit friendlier with merging headers.

ADD REPLY
0
Entering edit mode

What version are you using?

ADD REPLY
0
Entering edit mode

Version 1.1. Is that too outdated?

ADD REPLY
0
Entering edit mode

Can you update to 1.2 and see if that fixes it?

ADD REPLY
0
Entering edit mode

I updated it and it gives me the same error.

ADD REPLY

Login before adding your answer.

Traffic: 1813 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