def PDB_contacts_matrix(PDB_file, thresh=7.8, min_seq_separation=8, plot=True, mode='binary'):
    '\n    Input PDB file, plots contacts matrix\n    \n    '
    (coords, resis) = read_PDB(PDB_file, 'CA')
    M = metrics.pairwise.pairwise_distances(coords)
    M = np.tril(M, (- min_seq_separation))
    if (mode == 'binary'):
        contacts = np.zeros(np.shape(M))
        contacts[np.where(((M < thresh) & (M != 0)))] = 1
    elif (mode == 'distances'):
        contacts = np.zeros(np.shape(M))
        contacts[(M > 0)] = M[(M > 0)]
    if plot:
        plt.figure()
        plt.imshow(contacts)
        plt.title(PDB_file)
    return contacts
Input PDB file, plots contacts matrix
def PDB_contacts_matrix(PDB_file, thresh=7.8, min_seq_separation=8, plot=True, mode='binary'):
    '\n    \n    \n    '
    (coords, resis) = read_PDB(PDB_file, 'CA')
    M = metrics.pairwise.pairwise_distances(coords)
    M = np.tril(M, (- min_seq_separation))
    if (mode == 'binary'):
        contacts = np.zeros(np.shape(M))
        contacts[np.where(((M < thresh) & (M != 0)))] = 1
    elif (mode == 'distances'):
        contacts = np.zeros(np.shape(M))
        contacts[(M > 0)] = M[(M > 0)]
    if plot:
        plt.figure()
        plt.imshow(contacts)
        plt.title(PDB_file)
    return contacts