How to change a BAM file so the chromosome identifier is "chr 1" not just "1"
1
0
Entering edit mode
4.8 years ago
bruss ▴ 30

Hi

I'm trying to set up some files to call Super Enhancers using ROSE. I think I have everything I need, however my BAM files may not be formatted properly. using samtools idxstats I realized that the BAM file I'm using lists chromosomes with their numbers (IE: "1") rather than a "chr 1" format which is needed for ROSE. Any idea how I can convert this BAM file to change the chr identifiers? Thanks for any help you can provide!

ChIP-Seq • 1.8k views
ADD COMMENT
6
Entering edit mode
4.8 years ago
GenoMax 141k

Use samtools reheader:

reheader

    samtools reheader <in.header.sam> <in.bam>

    Replace the header in in.bam with the header in in.header.sam. This command is much faster than replacing the header with a BAM→SAM→BAM conversion.
ADD COMMENT
3
Entering edit mode

For those reading this and wondering, "but what about the chromosome names for each read?!?", the answer is that those names aren't actually stored in a BAM file. Rather, alignments have chromosome index number associated with them and the name you see when you use samtools view is taken from the header.

ADD REPLY
0
Entering edit mode

This worked great, thanks!!

ADD REPLY

Login before adding your answer.

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