Question: Rename Tag in BAM file
0
gravatar for i.sudbery
19 days ago by
i.sudbery6.3k
Sheffield, UK
i.sudbery6.3k wrote:

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 • 162 views
ADD COMMENTlink modified 19 days ago by Pierre Lindenbaum124k • written 19 days ago by i.sudbery6.3k
1
gravatar for Pierre Lindenbaum
19 days ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum124k wrote:

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 COMMENTlink written 19 days ago by Pierre Lindenbaum124k
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: 1892 users visited in the last hour