Exemple #1
0
def ranking(D, perm_mode='normal1'):
    r""" Compute the ranking vector."""
    _check_input(D)

    R_hat = _rank_differential(D)
    res = permutation_2sided(D, R_hat,
                             remove_zero_col=False,
                             remove_zero_row=False,
                             mode=perm_mode)
    # Compute the rank
    _, rank = np.where(res["array_u"] == 1)
    rank += 1

    return rank
Exemple #2
0
def mol_align(A, B):
    r"""Align two molecules using two sided permutation Procrustes with one
    transformation.
    """
    # Compute the permutation matrix
    _, _, U, e_opt = permutation_2sided(A,
                                        B,
                                        transform_mode='single_undirected',
                                        remove_zero_col=False,
                                        remove_zero_row=False)
    # Compute the transformed molecule A
    A = _utils._get_input_arrays(A)
    new_A = np.dot(U.T, np.dot(A, U))
    # B
    new_B = B

    return new_A, new_B, U, e_opt
Exemple #3
0
def mol_align(A, B):
    r"""Align two molecules using two sided permutation Procrustes with one
    transformation.
    """
    # Compute the permutation matrix
    res = permutation_2sided(A,
                             B,
                             transform_mode='single_undirected',
                             remove_zero_col=False,
                             remove_zero_row=False)
    # Compute the transformed coordinates of molecule A
    A = utils.setup_input_arrays(A)
    new_A = np.dot(res["array_u"].T, np.dot(A, res["array_u"]))
    # coordinates of molecule B
    new_B = B

    return new_A, new_B, res["array_u"], res["e_opt"]