Question: How to change a BAM file so the chromosome identifier is "chr 1" not just "1"
0
gravatar for bruss
27 days ago by
bruss0
bruss0 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 • 130 views
ADD COMMENTlink written 27 days ago by bruss0
6
gravatar for genomax
27 days ago by
genomax69k
United States
genomax69k 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 27 days ago by genomax69k
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 27 days ago by Devon Ryan91k

This worked great, thanks!!

ADD REPLYlink written 25 days ago by bruss0
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: 716 users visited in the last hour