Skip to content

Helper

MASSIVE.helper

Helper functions for MASSIVE.

Warning

This section is under active development and is not yet documented. Come back later :)

key_to_dntp(key, dntp_cols, exclude=())

Converts a key to an unambiguous dNTP assignment based on information in the dntp_cols dictionary.

Source code in MASSIVE/helper.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
def key_to_dntp(key:str, dntp_cols, exclude=()) -> str:
    """
    Converts a key to an unambiguous dNTP assignment based on information in the dntp_cols dictionary.
    """
    dntp = None # default value to return is None
    key_col = int(key[1:])

    for dntp_key in dntp_cols.keys():
        if key in exclude:
            pass
        else:
            if key_col in dntp_cols[dntp_key]:
                dntp = dntp_key
                break
    return dntp

key_to_enz_code(key, enz_rows, enz_cols)

Converts a key to an unambiguous enzyme code based on information in the enz_rows and enz_cols dictionaries.

Source code in MASSIVE/helper.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
def key_to_enz_code(key:str, enz_rows, enz_cols) -> int:
    """
    Converts a key to an unambiguous enzyme code based on information in the enz_rows and enz_cols dictionaries.
    """
    # break down key into row and column
    row = key[0]
    col = int(key[1:])
    # select possible enzymes based on row
    row_candidates = []
    for key in enz_rows.keys():
        if row in enz_rows[key]:
            row_candidates.append(key)
    # select possible enzymes based on column
    col_candidates = []
    for key in enz_cols.keys():
        if col in enz_cols[key]:
            col_candidates.append(key)
    # identify enzyme based on row and column
    enz_code = [code for code in row_candidates if code in col_candidates][0]
    return enz_code