Skip to content

question about function edlib_cigar_to_iterable #110

Description

@jingangdidi

Hi,
I have a question about function edlib_cigar_to_iterable, if edlib_cigar is 1X15=, will return [1, 1] and [6, 7], X is 6, but = not 7

def edlib_cigar_to_iterable(edlib_cigar):
    """Function that takes as input the edlib cigar and parses it to get it in a iterable manner"""
    #encoding of DNA and operations A,T,C,G,=,X,ID
    #nuc_and_ops =  np.array([1,2,3,4,5,6,7])

    length = []
    operations = []

    for i in re.findall(r'\d+[IDX=]',edlib_cigar):
        length.append(int(i[0]))           # `1X` --> i[0] is 1, `15=` --> i[0] is 1
        if i[1] == '=':
            operations.append(5)
        elif i[1] == 'X':
            operations.append(6)
        elif i[1] == 'I' or 'D':           # `15=` --> i[1] is 5, i[1] != 'I', but 'D' always True
            operations.append(7)


    return(np.array(length),np.array(operations))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions