Question: Changing chromosome names in BAM files
0
gravatar for aodabas20
8 weeks ago by
aodabas200
aodabas200 wrote:

Hi all,

I have ATAC-seq datas and I am trying to find TF binding motifs. I trimmed adapters(trim-galore), aligned to genome(with bowtie2), converted sam files to bam files and filtered them (according to mapping quality, duplicates and mitocondrial reads). Then, I wanted to look at my bam files. These are the results of "samtools idxstats"![enter image description here][1] command

chr1_KI270892v1_alt 162212 308 0

chr2_KI270894v1_alt 214158 1585 0

chr3_KI270895v1_alt 162896 540 0

chr6_GL000251v2_alt 4795265 10343 0

chr7_KI270899v1_alt 190869 942 0

I want to change those chromosome names with short names. Like this chr1_KI270892v1_alt -> chr1

How can I change all this names with short ones?

rna-seq chip-seq alignment • 164 views
ADD COMMENTlink modified 8 weeks ago by swbarnes29.4k • written 8 weeks ago by aodabas200
1

I want to change those chromosome names with short names. Like this chr1_KI270892v1_alt -> chr1

uh ? why would you want to do that ?

ADD REPLYlink written 8 weeks ago by Pierre Lindenbaum133k

Because I have found a tool that can find TF activities between 2 conditions.But ıt only accepts chr1,chr2 ... format.

ADD REPLYlink written 8 weeks ago by aodabas200
1

I am not sure how it uses chromosome names, but chr1_KI270892v1_alt is not the same thing as chr1. It would make as much sense to rename that as it would chr2 to chr1. While technically possible, it is not very meaningful.

You probably should use samtools (or another tool) to filter for just the relevant chromosomes.

ADD REPLYlink modified 8 weeks ago • written 8 weeks ago by igor12k
0
gravatar for swbarnes2
8 weeks ago by
swbarnes29.4k
United States
swbarnes29.4k wrote:

I think the key point in doing this is this:

When you eyeball a .sam file, you see the chromosome name in each row But I think in bam format, the chromosome name is not actually stored in every row, it's only stored in the header, and when you make a sam file, it gets the chromosome name from the header.

So I believe changing the header properly is all you have to do.

However, for reproducibility, it might be best to make a reference with the names you want, and re-align. Lest some day, someone wonder why your chromosomes don't match what you supposedly aligned to.

ADD COMMENTlink written 8 weeks ago by swbarnes29.4k

How can I change the header in sam files?

İ thougt there are some scripts that allow us to change chromosome names as we want

ADD REPLYlink written 8 weeks ago by aodabas200
1

Look into samtools reheader option that can be used for this purpose. @Igor makes a good point above.

ADD REPLYlink written 8 weeks ago by GenoMax95k
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: 1056 users visited in the last hour
_