scout/parse/variant/coordinates.py
def get_length(alt_len, ref_len, category, pos, end, svtype=None, svlen=None):
    """Return the length of a variant

    Args:
        alt_len(int)
        ref_len(int)
        category(str)
        svtype(str)
        svlen(int)
    """
    # -1 would indicate uncertain length
    length = -1
    if category in ('snv', 'indel', 'cancer'):
        if ref_len == alt_len:
            length = alt_len
        else:
            length = abs(ref_len - alt_len)

    elif category == 'sv':
        if svtype == 'bnd':
            length = int(10e10)
        else:
            if svlen:
                length = abs(int(svlen))
            # Some software does not give a length but they give END
            elif end:
                if end != pos:
                    length = end - pos
    return length
def get_length(alt_len, ref_len, category, pos, end, svtype=None, svlen=None):
    # -1 would indicate uncertain length
    length = -1
    if category in ('snv', 'indel', 'cancer'):
        if ref_len == alt_len:
            length = alt_len
        else:
            length = abs(ref_len - alt_len)

    elif category == 'sv':
        if svtype == 'bnd':
            length = int(10e10)
        else:
            if svlen:
                length = abs(int(svlen))
            # Some software does not give a length but they give END
            elif end:
                if end != pos:
                    length = end - pos
    return length
def get_length ( alt_len , ref_len , category , pos , end , svtype = None , svlen = None ) : # -1 would indicate uncertain length length = - 1 if category in ( 'snv' , 'indel' , 'cancer' ) : if ref_len == alt_len : length = alt_len else : length = abs ( ref_len - alt_len ) elif category == 'sv' : if svtype == 'bnd' : length = int ( 10e10 ) else : if svlen : length = abs ( int ( svlen ) ) # Some software does not give a length but they give END elif end : if end != pos : length = end - pos return length
Return the length of a variant

    Args:
        alt_len(int)
        ref_len(int)
        category(str)
        svtype(str)
        svlen(int)
Return the length of a variant