Question: How to change a BAM file so the chromosome identifier is "chr 1" not just "1"
0
gravatar for bruss
11 months ago by
bruss30
bruss30 wrote:

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 • 322 views
ADD COMMENTlink written 11 months ago by bruss30
6
gravatar for genomax
11 months ago by
genomax84k
United States
genomax84k wrote:

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 COMMENTlink written 11 months ago by genomax84k
3

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 REPLYlink written 11 months ago by Devon Ryan95k

This worked great, thanks!!

ADD REPLYlink written 11 months ago by bruss30
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: 1227 users visited in the last hour