[pysam] How to find both both primary and supplementary read?

0

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

• 86 views



Source link