Rename Tag in BAM file
1
0
Entering edit mode
5.0 years ago

Lets say I have a BAM file with a read like so:

SRR2057595.3333414_ATCGG        0       chr19   3571763 255     44M     *       0       0       *       *       XA:i:2  MD:Z:13C27C2    NM:i:2    BX:Z:ATCGG

but a program I want to use requires what is currently in the BX tag to be in the UM tag. So it looks thus:

SRR2057595.3333414_ATCGG        0       chr19   3571763 255     44M     *       0       0       *       *       XA:i:2  MD:Z:13C27C2    NM:i:2    UM:Z:ATCGG

I could write pysam script to do this, but I feel like there should be a less home-made way to do this.

bam • 2.3k views
ADD COMMENT
2
Entering edit mode
5.0 years ago

using samjdk: http://lindenb.github.io/jvarkit/SamJdk.html

 java -jar dist/samjdk.jar -e 'final Object s=record.getAttribute("BX"); if(s!=null) {record.setAttribute("BX",null);record.setAttribute("UM",s);} return record;' in.bam
ADD COMMENT

Login before adding your answer.

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