[pysam] How to find both both primary and supplementary read?
1
0
Entering edit mode
3.4 years ago
octpus616 ▴ 120

Dear,

I am interesting in find split reads supporting structure variant, my bam file is alignment by bwa mem with default parmaters. As I know from Sequence Alignment/Map Format Specification, I try to use flag == 2048 to filter supplementary alignment:

  for bam_cat in bam.fetch(counting, int(start), int(end)): 
        #print(bam_cat.flag & 2048)
        if bam_cat.flag & 2048 == 2048: 
            print(str(bam_cat))

I think it work well to subset supplementary alignment, But as my understanding, a supplementary alignment often match a primary alignment (right?) , However, I dont know how to find its primary alignment without another iteration for all bam file (It algorithm complexity is too terrible).

NGS pysam bam python SAM • 2.0k views
ADD COMMENT
0
Entering edit mode
3.4 years ago

However, I dont know how to find its primary alignment without another iteration for all bam file

look at the 'SA' attribute.

ADD COMMENT
0
Entering edit mode

Oh, I got it, thank you, I missed someting.

ADD REPLY

Login before adding your answer.

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