Entering edit mode
8.4 years ago
Joe
▴
30
Hi, I need to substitute a bam file's QNAME to another bam file's QNAME, but without change header, sequence and everything else. Here is Example ( I don't show seq and others here): I have A.bam:
A.bamHeader
M04402:7:000000000-ANGUV:1:1106:13178:9134 147 chr1 17027 0 ...............
M04402:7:000000000-ANGUV:1:1106:13178:9134 99 chr1 17205 0....................
M04402:7:000000000-ANGUV:1:2115:20665:6740 147 chr1 17344 0.................
and so on......
I have another B.bam. the QNAME is
M00601:223:AM07W:1:1102:11074:13214 163 chr1 19754 24.............
M00601:223:AM07W:1:2101:17585:17440 99 chr1 17205 0....................
and so on......
I want to change all the A.bam QNAMEs (eg:M04402:7:000000000-ANGUV:1:1106:13178:9134) to B.bam QNAMEs(eg:M00601:223:AM07W:1:1102:11074:13214). But only change the QNAME, not other things.
What I can think about is use command line "sed".
Thanks!
While it can probably be done using the code posted by @i.sudbery I can't figure out the use case. Why do you want to do this?
The reason I want to do this is How to merge two identical BAM files? I want to change QNAME, then redo the thing I post in the link.
I see. You are creating a fake duplicate with same sequence data but different headers. You could just change
ANGUV
toBNGUV
which would make it a new flowcell :-)It works, thanks a lot