So I have a sam file with extended CIGAR format like this:
17H87=1D12=1D2=3D32=1D4=2D5=2D13=....
And I want to convert it to a sam file containing regular CIGAR format that will look like this:
17S83M1D14M1D4M3D31M1D2M2D6M...
(they do not represent the same reads... I want only to visualize the problem)
Anyone knows some software/script that will convert sam/bam with extended CIGAR to a sam/bam with regular CIGAR? It seems like a standard problem that might already have a solution so I want to ask here before solving it the hard way(coding)
Assuming you have a .sam named
old.sam
Disclaimer: I haven't tested this on a real samfile, as I don't have one available right now
Argh. No. Wrong. Sorry. Disregard the first version.
Edits: Misread what you wanted at first, now it should replace = and X in extended with M.
Thanks for the reply, looks very elegant and probably will work for times when rapid testing is needed.