def calculate_overlap(self1):
      """Create the array that describes how junctions overlap"""
      overs = []
      if not self1.tx_obj1.range.overlaps(self1.tx_obj2.range): return # if they dont overlap wont find anything
      for i in range(0,len(self1.tx_obj1.exons)):
        for j in range(0,len(self1.tx_obj2.exons)):
          osize = self1.tx_obj1.exons[i].range.overlap_size(self1.tx_obj2.exons[j].range)
          ofrac = 0
          if osize > 0:
            ofrac = min(float(osize)/float(self1.tx_obj1.exons[i].range.length)\
                       ,float(osize)/float(self1.tx_obj2.exons[j].range.length))

          if self1.tx_obj1.get_exon_count() == 1 or self1.tx_obj2.get_exon_count() == 1:
            # use single exon rules
            if osize >= self1.single_minover and ofrac >= self1.single_frac:
              #print 'single exon match'
              overs.append([i,j])
          else: # for multi exons
            if i == 0 or j == 0 or i == len(self1.tx_obj1.exons)-1 or j == len(self1.tx_obj2.exons)-1:
              #its on an end
              if osize >= self1.multi_minover and ofrac >= self1.multi_endfrac:
                #print 'end exon match'
                overs.append([i,j])
            #else its a middle
            elif osize >= self1.multi_minover and ofrac >= self1.multi_midfrac:
              #print 'mid exon match'
              overs.append([i,j])
      #print overs
      self1.overs = overs
def calculate_overlap ( self1 ) : overs = [ ] if not self1 . tx_obj1 . range . overlaps ( self1 . tx_obj2 . range ) : return for i in range ( 0 , len ( self1 . tx_obj1 . exons ) ) : for j in range ( 0 , len ( self1 . tx_obj2 . exons ) ) : osize = self1 . tx_obj1 . exons [ i ] . range . overlap_size ( self1 . tx_obj2 . exons [ j ] . range ) ofrac = 0 if osize > 0 : ofrac = min ( float ( osize ) / float ( self1 . tx_obj1 . exons [ i ] . range . length ) , float ( osize ) / float ( self1 . tx_obj2 . exons [ j ] . range . length ) ) if self1 . tx_obj1 . get_exon_count ( ) == 1 or self1 . tx_obj2 . get_exon_count ( ) == 1 : if osize >= self1 . single_minover and ofrac >= self1 . single_frac : overs . append ( [ i , j ] ) else : if i == 0 or j == 0 or i == len ( self1 . tx_obj1 . exons ) - 1 or j == len ( self1 . tx_obj2 . exons ) - 1 : if osize >= self1 . multi_minover and ofrac >= self1 . multi_endfrac : overs . append ( [ i , j ] ) elif osize >= self1 . multi_minover and ofrac >= self1 . multi_midfrac : overs . append ( [ i , j ] ) self1 . overs = overs
Create the array that describes how junctions overlap