ProDy icon indicating copy to clipboard operation
ProDy copied to clipboard

added gromos rmsd clustering

Open jamesmkrieger opened this issue 4 years ago • 3 comments

This method is the same as the one used in https://manual.gromacs.org/documentation/current/onlinehelp/gmx-cluster.html

jamesmkrieger avatar Sep 14 '21 14:09 jamesmkrieger

Perhaps we should give this a better name

jamesmkrieger avatar Feb 02 '22 15:02 jamesmkrieger

Definitely, something isn't right here for the labels=None case. Perhaps make labels a necessary argument rather than defaulting to None

Actually, we do want to support the case where we have no labels, e.g. from an MD trajectory. It was just done wrong.

jamesmkrieger avatar Mar 31 '22 15:03 jamesmkrieger

It should be good now, but needs testing

jamesmkrieger avatar Mar 31 '22 15:03 jamesmkrieger

This works to cluster a set of trajectories now: gromos_clusters_2p2A

jamesmkrieger avatar Oct 27 '22 15:10 jamesmkrieger

from prody import *
import matplotlib.pyplot as plt
plt.ion()
import numpy as np

ref_pca = loadModel('prody_pca/ref.pca.npz')

ens = parseDCD("combined.dcd", step=100)
ens.iterpose(rmsd=0.01)
rmsd_matrix = ens.getRMSDs(pairwise=True)

x = calcRMSDclusters(rmsd_matrix, 2.1)

colors = np.zeros(num_confs, dtype=int)
for i, c in enumerate(x):
    colors[list(np.array(c, dtype=int))] = i
colors = list(colors)

plt.figure()
showProjection(ens, ref_pca[:3], markersize=3, color=colors)
plt.savefig('gromos_clusters_2p1A.png')

jamesmkrieger avatar Oct 27 '22 16:10 jamesmkrieger