def _calculate_similarity ( c ) : ma = { } for idc in c : set1 = _get_seqs ( c [ idc ] ) [ ma . update ( { ( idc , idc2 ) : _common ( set1 , _get_seqs ( c [ idc2 ] ) , idc , idc2 ) } ) for idc2 in c if idc != idc2 and ( idc2 , idc ) not in ma ] # logger.debug("_calculate_similarity_ %s" % ma) return ma
how to detect similarities in lists in python
Get a similarity matrix of % of shared sequence
def _calculate_similarity(c):
    """Get a similarity matrix of % of shared sequence

    :param c: cluster object

    :return ma: similarity matrix
    """
    ma = {}
    for idc in c:
        set1 = _get_seqs(c[idc])
        [ma.update({(idc, idc2): _common(set1, _get_seqs(c[idc2]), idc, idc2)}) for idc2 in c if idc != idc2 and (idc2, idc) not in ma]
    # logger.debug("_calculate_similarity_ %s" % ma)
    return ma