#NEWLINE# def add_read( self , read , chrom ) : #NEWLINE# #INDENT# if read . is_unmapped : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if ( self . only_first_fragment and read . is_paired and ( not read . is_read1 ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# tag = None #NEWLINE# is_rev = False #NEWLINE# strand = ( '-' if read . is_reverse else '+' ) #NEWLINE# if ( chrom == 'chrM' ) : #NEWLINE# #INDENT# tag = 'mitochondrial' #NEWLINE# #UNINDENT# if ( not tag ) : #NEWLINE# #INDENT# for ( op , length ) in read . cigar : #NEWLINE# #INDENT# if ( op == 3 ) : #NEWLINE# #INDENT# tag = 'junction' #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( not tag ) : #NEWLINE# #INDENT# for region in self . regions : #NEWLINE# #INDENT# ( tag , is_rev ) = region . get_tag ( chrom , strand , read . pos ) #NEWLINE# if tag : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( not tag ) : #NEWLINE# #INDENT# tag = 'intergenic' #NEWLINE# #UNINDENT# if tag : #NEWLINE# #INDENT# if is_rev : #NEWLINE# #INDENT# self . counts [ ( '%s-rev' % tag ) ] += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . counts [ tag ] += 1 #NEWLINE# #UNINDENT# #UNINDENT# return tag