Clustering is a VMD plugin to calculate and visualize clusters of conformations for a trajectory. Each conformation is color coded according to the cluster to which it belongs. This is done by creating one representation for each cluster, and setting variable Draw Multiple frames to the corresponding frame numbers.
Website: http://physiology.med.cornell.edu/faculty/hweinstein/vmdplugins/clustering
Features include:
- Compute clusters using VMD's internal measure cluster command
- Import results from R, Xcluster, Gromacs, Charmm, NMRCLUSTER
- Color conformations by cluster
- Selection of clusters and/or conformations to display
- Multiple levels of clustering
- Custom representations
- Join single member clusters in a separate cluster
A small guide on how to install third party VMD plugins can be found here. In summary:
- Create a VMD plugins' directory if you don't have one, ie /path/to/plugins/directory.
- Clone or download the project into a subdirectory of your VMD plugins' directory (ie. /path/to/plugins/directory/clustering):
cd /path/to/plugins/directory
git clone https://github.com/luisico/clustering.git clustering
- Add the following to your $HOME/.vmdrc file (if you followed the instructions in the link above, you might already have the first line present):
set auto_path [linsert $auto_path 0 {/path/to/plugins/directory}]
vmd_install_extension clustering clustering "WMC PhysBio/Clustering"
The plugin should be accessible from the Extensions menu.
To use the Clustering plugin you need to:
- Load a trajectory of conformations used for clustering into VMD.
- Define the atom selection and molecule to use as representation in vmd.
- Generate the clusters with VMD's internal measure cluster command. More information about measure cluster can be found in VMD's manual. All options in Clustering's Use measure cluster section correspond to the options available to measure cluster.
- Import results from a third party solution (see below)
- Viewing clusters:
- Select the level you want to see. The list of clusters will be updated together with colored conformations. All clusters will be displayed when you change the level.
- Select/Deselect clusters to activate/deactivate them.
- Select/Deselect conformations to activate/deactivate individual conformations.
- All and None turn on/off all clusters and conformations.
- Activate Join 1 member clusters to display all single member clusters in a separate cluster (outl).
- The atom selection to represent can be changed in the atom selection box. Click Update Selection button to apply the changes.
Ref: R with hierarchical clustering
First obtain the rmsd between structures. You can use iTrajComp for an easy way of doing this (I suggest writing the results in matrix format).
Load the data into R and use one of the available functions in R to do hierarchical clustering (hclust, agnes, diana, ...). If you used the iTrajComp plugin to create the rmsd matrix, the following should work in R (see the documentation of the individual commands for further options):
data = scan('/path/to/rmsd.mat')
rmsd = matrix(data, nrow=sqrt(length(data)), ncol=sqrt(length(data)))
library(cluster)
cluster = agnes(rmsd, diss=T)
Cut the tree into groups (levels) using cutree. You can cut into one or more groupings. For example
levels = cutree(cluster, k=2:5)
will output the cluster membership of each object for levels 2 to 5.
Write results to a file to input into the Clustering plugin:
write.table(levels, file='levels.dat', quote=F)
Import levels.dat into the Clustering.
Ref: Xcluster
Import Xcluster's .clg output file into Clustering. All levels of interest must be saved in order to display them in VMD (look in Xcluster's manual for the Writecls command).
Ref: http://www.gromacs.org g_cluster: http://manual.gromacs.org/online/g_cluster.html
Import the "cluster.log" file. Only a level (0) will be available. g_cluster timesteps are automatically mapped into VMD frames.
Ref: Charmm with the clustering command
Import the output membership file into Clustering.
Ref: http://neon.chem.le.ac.uk/nmrclust (link has been down for some time)
Import Cluster.log into Clustering. Only a level (0) will be available. Outliers will be splitted in different clusters. Check Join 1 member clusters to cluster them together.
A text file containing one line per frame, where the n-th line contains one integer which is the index of the cluster containing the n-th frame. Supports a single level.
Luis Gracia (https://github.com/luisico)
Developed at Weill Cornell Medical College
Please, use issues and pull requests for feedback and contributions to this project.
Thanks to Andrea Carotti for all his help with testing the Gromacs importer.
See LICENSE.