Beispiel #1
0
def GetDACC(input_data, **kwargs):
    """
    #################################################################
    Make DACC dictionary.

    :param input_data: file object or sequence list.
    :param phyche_index: physicochemical properties list.
    :param all_property: bool, choose all physicochemical properties or not.
    :param extra_phyche_index: dict, the key is the dinucleotide (string), and its corresponding value is a list.
                               It means user-defined phyche_index.
    #################################################################
    """

    if "k" in kwargs:
        k = kwargs["k"]
    else:
        k = 2

    if "lag" in kwargs:
        lag = kwargs["lag"]
    else:
        lag = 2
    if "phyche_index" in kwargs:
        phyche_index = kwargs["phyche_index"]
    else:
        phyche_index = None
    if "all_property" in kwargs:
        all_property = kwargs["all_property"]
    else:
        all_property = False
    if "extra_phyche_index" in kwargs:
        extra_phyche_index = kwargs["extra_phyche_index"]
    else:
        extra_phyche_index = None

    input_data = [input_data]
    sequence_list, phyche_value = ReadyAcc(input_data, k, phyche_index,
                                           all_property, extra_phyche_index)
    from PyDNAacutil import MakeACVector, MakeCCVector

    zipped = list(
        zip(
            MakeACVector(sequence_list, lag, phyche_value, k),
            MakeCCVector(sequence_list, lag, phyche_value, k),
        ))
    vec = [reduce(lambda x, y: x + y, e) for e in zipped]

    dict_keys = ["DACC_%s" % i for i in range(1, len(vec[0]) + 1)]
    res = dict(zip(dict_keys, vec[0]))
    return res
Beispiel #2
0
def GetDCC(input_data, **kwargs):
    """
    #################################################################
    Make DCC vector.

    :param input_data: file object or sequence list.
    :param phyche_index: physicochemical properties list.
    :param all_property: bool, choose all physicochemical properties or not.
    :param extra_phyche_index: dict, the key is the dinucleotide (string), and its corresponding value is a list.
                               It means user-defined phyche_index.
    #################################################################
    """
    if 'k' in kwargs:
        k = kwargs['k']
    else:
        k = 2

    if 'lag' in kwargs:
        lag = kwargs['lag']
    else:
        lag = 2
    if 'phyche_index' in kwargs:
        phyche_index = kwargs['phyche_index']
    else:
        phyche_index = None
    if 'all_property' in kwargs:
        all_property = kwargs['all_property']
    else:
        all_property = False
    if 'extra_phyche_index' in kwargs:
        extra_phyche_index = kwargs['extra_phyche_index']
    else:
        extra_phyche_index = None

    input_data = [input_data]
    sequence_list, phyche_value = ReadyAcc(input_data, k, phyche_index,
                                           all_property, extra_phyche_index)
    from PyDNAacutil import MakeCCVector

    vec = MakeCCVector(sequence_list, lag, phyche_value, k)
    dict_keys = ['DCC_%s' % i for i in range(1, len(vec[0]) + 1)]
    res = dict(zip(dict_keys, vec[0]))
    return res