scripts/processing/clan_competition.py
def cal_overlap_pos_strand(s1, e1, s2, e2):
    """
    Calculates the region overlap between two regions on the 5' strand and
    returns the degree of overlap

    s1: Seq1 start coordinates
    e1: Seq1 end coordinates
    s2: Seq2 start coordinates
    e2: Seq2 end coordinates
    """

    overlap = None

    len1 = abs(e1 - s1)
    len2 = abs(e2 - s2)

    min_len = min(len1, len2)

    # seq2 within seq1
    if s1 < s2 and e2 < e1:
        overlap = COMP_OVL

    # partial overlap, seq1 before seq2
    elif s1 <= s2 and s2 < e1 and e1 <= e2:
        overlap = float(e1 - s2 + 1) / float(min_len)

    # no overlap, seq1 before seq2
    elif s1 < s2 and e1 <= s2:
        overlap = NO_OVL

    # seq1 within seq2 region
    elif s2 < s1 and e1 < e2:
        overlap = COMP_OVL

    # no overlap, seq2 before seq1
    elif s2 < s1 and e2 <= s1:
        overlap = NO_OVL

    # partial overlap, seq2 before seq1
    elif s2 <= s1 and s1 < e2 and e2 <= e1:
        overlap = float(e2 - s1 + 1) / float(min_len)

    return overlap

    Calculates the region overlap between two regions on the 5' strand and
    returns the degree of overlap

    s1: Seq1 start coordinates
    e1: Seq1 end coordinates
    s2: Seq2 start coordinates
    e2: Seq2 end coordinates
    
Calculates the region overlap between two regions on the 5' strand and
returns the degree of overlap

Seq1 start coordinates
e1: Seq1 end coordinates
s2: Seq2 start coordinates
e2: Seq2 end coordinates
Calculates the region overlap between two regions on the 5 ' strand and returns the degree of overlap Seq1 start coordinates e1 : Seq1 end coordinates s2 : Seq2 start coordinates e2 : Seq2 end coordinates
def cal_overlap_pos_strand(s1, e1, s2, e2):
    overlap = None
    len1 = abs(e1 - s1)
    len2 = abs(e2 - s2)
    min_len = min(len1, len2)
    if s1 < s2 and e2 < e1:
        overlap = COMP_OVL
    elif s1 <= s2 and s2 < e1 and e1 <= e2:
        overlap = float(e1 - s2 + 1) / float(min_len)
    elif s1 < s2 and e1 <= s2:
        overlap = NO_OVL
    elif s2 < s1 and e1 < e2:
        overlap = COMP_OVL
    elif s2 < s1 and e2 <= s1:
        overlap = NO_OVL
    elif s2 <= s1 and s1 < e2 and e2 <= e1:
        overlap = float(e2 - s1 + 1) / float(min_len)
    return overlap
def cal_overlap_pos_strand ( s1 , e1 , s2 , e2 ) : overlap = None len1 = abs ( e1 - s1 ) len2 = abs ( e2 - s2 ) min_len = min ( len1 , len2 ) if s1 < s2 and e2 < e1 : overlap = COMP_OVL elif s1 <= s2 and s2 < e1 and e1 <= e2 : overlap = float ( e1 - s2 + 1 ) / float ( min_len ) elif s1 < s2 and e1 <= s2 : overlap = NO_OVL elif s2 < s1 and e1 < e2 : overlap = COMP_OVL elif s2 < s1 and e2 <= s1 : overlap = NO_OVL elif s2 <= s1 and s1 < e2 and e2 <= e1 : overlap = float ( e2 - s1 + 1 ) / float ( min_len ) return overlap
Calculates the region overlap between two regions on the 5' strand and
returns the degree of overlap
Calculates the region overlap between two regions on the 5 ' strand and returns the degree of overlap
"""
    Calculates the region overlap between two regions on the 5' strand and
    returns the degree of overlap

    s1: Seq1 start coordinates
    e1: Seq1 end coordinates
    s2: Seq2 start coordinates
    e2: Seq2 end coordinates
    """ # seq2 within seq1 # partial overlap, seq1 before seq2 # no overlap, seq1 before seq2 # seq1 within seq2 region # no overlap, seq2 before seq1 # partial overlap, seq2 before seq1
s1
e1
s2
e2