Question: Change Notation Of Chromosome In Bam File
1
gravatar for hellbio
5.9 years ago by
hellbio360
hellbio360 wrote:

Hi all,

I have a bam file with chromosomal notation 1,2.... and i need it to be as chr1,chr2.....

For this i have tried, samtools view -H sample.bam > header.sam

Then edited the header.sam file with required chromosomal notation and tried samtools reheader header.sam sample.bam > out.bam

when in tried to view out.bam using samtools it says "Segemntation fault".

I also tried with PICARD, java -Xmx4g -jar ReplaceSamHeader.jar INPUT=sample.bam HEADER=header.sam OUTPUT=out.bam CREATE_INDEX=TRUE

It reports the same error with samtools i.e. segmenation fault.

Could anyone help me to fix this?

bam samtools • 3.8k views
ADD COMMENTlink modified 5.2 years ago by ff.cc.cc1.3k • written 5.9 years ago by hellbio360

This question has been answered elsewhere: A: Bam File: Change Chromosome Notation (see my script there). I think segmentation fault means your computer ran out of memory.

 

 

ADD REPLYlink written 4.2 years ago by petervangalen30
0
gravatar for Zev.Kronenberg
5.9 years ago by
United States
Zev.Kronenberg11k wrote:

The reads need to have the same @SQ tags for the seqid.

samtools view your.bam | perl -lane 'if($_ =~ /\@/){print $_}else{$F[2] = "chr$F[2]" if $F[2] !~ /\*/; print join "\t", @F}' | bgzip or gzip

Of coure you will need to edit your header so the @SQ tags are correct.

ADD COMMENTlink modified 5.9 years ago • written 5.9 years ago by Zev.Kronenberg11k
0
gravatar for ff.cc.cc
5.2 years ago by
ff.cc.cc1.3k
European Union
ff.cc.cc1.3k wrote:

Hi, I had the same task with my chomosome notation. Bam Header Edit helped me.

About the crash, beware of samtools version. Someone experimented crashes before version 0.1.19

ADD COMMENTlink written 5.2 years ago by ff.cc.cc1.3k
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: 1753 users visited in the last hour