{"action":"created","issue":{"url":"https://api.github.com/repos/choderalab/MSMs/issues/8","labels_url":"https://api.github.com/repos/choderalab/MSMs/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/choderalab/MSMs/issues/8/comments","events_url":"https://api.github.com/repos/choderalab/MSMs/issues/8/events","html_url":"https://github.com/choderalab/MSMs/issues/8","id":114720352,"number":8,"title":"Use contact map features?","user":{"login":"maxentile","id":5759036,"avatar_url":"https://avatars.githubusercontent.com/u/5759036?v=3","gravatar_id":"","url":"https://api.github.com/users/maxentile","html_url":"https://github.com/maxentile","followers_url":"https://api.github.com/users/maxentile/followers","following_url":"https://api.github.com/users/maxentile/following{/other_user}","gists_url":"https://api.github.com/users/maxentile/gists{/gist_id}","starred_url":"https://api.github.com/users/maxentile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxentile/subscriptions","organizations_url":"https://api.github.com/users/maxentile/orgs","repos_url":"https://api.github.com/users/maxentile/repos","events_url":"https://api.github.com/users/maxentile/events{/privacy}","received_events_url":"https://api.github.com/users/maxentile/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-03T01:02:28Z","updated_at":"2015-11-04T16:53:35Z","closed_at":null,"body":"John relayed Frank's suggestion to use a subset of inter-residue contacts as input features for MSM-building: we would like to use just \"the subset of contacts that change during a simulation.\" I've been looking into this a bit for modeling the data from 10468 (Abl).\r\n\r\ntl;dr -- promising!\r\n\r\nMy biggest question is:\r\n\r\n**How should we choose the contact threshold?**\r\n\r\nTo determine whether a given inter-residue contact \"changes,\" we binarize the inter-residue distance as either > or <= a threshold distance, then select any residue pairs that aren't all 0s or all 1s throughout our simulations. PyEMMA has [a default setting](http://www.emma-project.org/v1.2.2/api/generated/pyemma.coordinates.featurizer.html#pyemma.coordinates.data.featurizer.MDFeaturizer.add_contacts) for this of 5 angstroms. However, the subset of contacts that will appear to be \"changing\" clearly depends on what threshold you use:\r\n\r\n![contact_map_thresh_movie_abl](https://cloud.githubusercontent.com/assets/5759036/10836532/f8a8c284-7e84-11e5-8fad-22fc0a7ad579.gif)\r\n\r\nNote that the set of selected contacts at a threshold x+epsilon is not simply a superset of the contacts selected at a lower threshold x:\r\n![image](https://cloud.githubusercontent.com/assets/5759036/10896873/ba3613d6-818a-11e5-89ef-3ce9b312acaa.png)\r\n\r\nHere I've just set the threshold=1.0nm since that induces an acceptably small number of features (~4000) that seem to represent the extent of the protein, but I don't know how to do this in a principled way.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/5759036/10837311/444c7c86-7e8e-11e5-8b36-9337b820bd8c.png)\r\n\r\n**Comparing feature sets:**\r\n\r\nA feature set that does a good job at linearly representing the slow relaxation processes of a system will have a high GMRQ, i.e. a large sum of leading eigenvalues in the tICA solution.\r\n\r\nI compared 3 feature sets in terms of their GMRQ for fixed-rank approximation (m=100) of the lag_time=100 propagator. I also computed the maximum cumulative sum of leading eigenvalues.\r\n\r\n*Feature set 1:* Backbone torsions (all available: ‘phi’, ‘psi’, ‘omega’, ‘chi1’, ‘chi2’, ‘chi3’, ‘chi4’)\r\n\r\nThe sum of the first 100 eigenvalues = 55.7.\r\n\r\nThe sum of the first 542 eigenvalues = 76.3.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/5759036/10837340/c05e7a86-7e8e-11e5-9873-a79105450bbb.png)\r\n\r\n*Feature set 2:* Inter-residue distances between contacts that change (threshold=1.0nm)\r\n(evaluated on a subset of 10 trajectories)\r\nThe sum of the first 100 eigenvalues = 61.9.\r\n\r\nThe sum of the first 1999 eigenvalues = 92.2.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/5759036/10837368/30960472-7e8f-11e5-9f63-f6388901cef9.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/5759036/10837164/a6a20c68-7e8c-11e5-94cb-121421c128d3.png)\r\n\r\n*Feature set 3:* Kabsch-Sander hydrogen-bond energies\r\nThe sum of the first 100 eigenvalues = 40.4.\r\n\r\nThe sum of the first 468 eigenvalues = 48.5.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/5759036/10837411/8dd82bc4-7e8f-11e5-8787-f25118043cd3.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/5759036/10837447/da7f653c-7e8f-11e5-9140-169a4df47812.png)\r\n\r\n**Visualizing the results**\r\n\r\nFrom the eigenvalue plots above we can see that the first 2 tICs represent only a *tiny* fraction of the kinetic behavior of the kinase, for any of these choices of input features-- projecting onto the first 2 tICs is a very lossy representation of the tICA model. Can we create a more trustworthy 2D picture?\r\n\r\nHere I'm using the first 100 tICs as inputs into [t-SNE](http://lvdmaaten.github.io/tsne/), which produces a nonlinear 2D embedding that preserves local neighborhoods at the cost of introducing global distortions. This is useful if we want a picture of the cluster structure of a dataset, but means we can't read into the x and y axes as \"components.\" Each dot represents a simulation frame, dots are colored by the order in which they were collected, and time-adjacent frames are connected by a thin grey line. Areas that are visited more than once should have a mix of colors in them. Areas that are color-homogenuous appear to have been visited during just one contiguous chunk of trajectory.\r\n\r\n*Backbone torsions*\r\n![image](https://cloud.githubusercontent.com/assets/5759036/10836941/45530b94-7e8a-11e5-87ce-12dd6cb866f8.png)\r\n\r\n*Contact maps*\r\n![image](https://cloud.githubusercontent.com/assets/5759036/10837116/198daf4e-7e8c-11e5-92e9-a25a38663fc5.png)\r\n\r\nNote that the above pictures were computed using just 10 out of the ~500 trajectories available.\r\n\r\nIf we recompute the \"Contact map --> top-100 tICs --> t-SNE\" projection for *all* available simulation data, then we get the following picture:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/5759036/10896997/87483282-818b-11e5-96eb-3bc0c42826b9.png)\r\n\r\nThis picture suggests that the majority of the available data samples transitions between large relevant states (the dense multi-colored regions in the map), and there may be a large number of negligibly occupied microstates that are visited ~once (the little \"sprinkles\" on the periphery). Caveat: It's possible that t-SNE is over-partitioning the dataset (i.e. hallucinating clusters)-- although I ran a quick sanity check that the k-nearest neighbor graph (for k=30) is mostly identical in the 2D embedding and in the 100D tICA model, there are some additional sanity checks I can run before we interpret these pictures too much.\r\n\r\n\r\n**Other comments**\r\n\r\nMDTraj offers [several schemes](http://mdtraj.org/latest/api/generated/mdtraj.compute_contacts.html) for computing inter-residue distances. I've been using the `scheme='ca'` (which returns the distance between their alpha carbons), since it's significantly cheaper than `scheme='closest-heavy'` (which I presume is still cheaper than `scheme='closest'`), but I don't know which of the available schemes is preferred here."},"comment":{"url":"https://api.github.com/repos/choderalab/MSMs/issues/comments/153790253","html_url":"https://github.com/choderalab/MSMs/issues/8#issuecomment-153790253","issue_url":"https://api.github.com/repos/choderalab/MSMs/issues/8","id":153790253,"user":{"login":"jchodera","id":3656088,"avatar_url":"https://avatars.githubusercontent.com/u/3656088?v=3","gravatar_id":"","url":"https://api.github.com/users/jchodera","html_url":"https://github.com/jchodera","followers_url":"https://api.github.com/users/jchodera/followers","following_url":"https://api.github.com/users/jchodera/following{/other_user}","gists_url":"https://api.github.com/users/jchodera/gists{/gist_id}","starred_url":"https://api.github.com/users/jchodera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jchodera/subscriptions","organizations_url":"https://api.github.com/users/jchodera/orgs","repos_url":"https://api.github.com/users/jchodera/repos","events_url":"https://api.github.com/users/jchodera/events{/privacy}","received_events_url":"https://api.github.com/users/jchodera/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T16:53:35Z","updated_at":"2015-11-04T16:53:35Z","body":"This is fantastic!  Thanks so much for putting this together.\r\n\r\nSome observations:\r\n\r\n**Projections onto the top few tICs are useless.** As the figures showing the fraction of cumulative eigenvalue sum vs number of tICs show, we need to use *many* tICs to capture the slow subspace.  **Let's *stop* making projections onto the first few tICs---it is useless.**  Instead, we need to think of tICA as a way of eliminating both some of the fast irrelevant degrees of freedom and removing some of the correlations between degrees of freedom.  \r\n\r\n**Interresidue distances are somewhat better than torsions.** The sum of the first 100 eigenvalues is higher for the distance-based tICs than for torsion-based tICs.  I think these distances are more natural to interpret/plot/understand as well, so there may be value in focusing on these instead of torsions.  The difference isn't huge, but the sum of all the positive eigenvalues is much higher, which may mean that this is much more useful when the kinetic distance is used.\r\n\r\n**Clustering in spaces involving many tICs (or using tIC-derived kinetic distances) may be useful.** We might be able build useful discrete-state MSMs by clustering in spaces that involve many tICs.  Computing tIC-eigenvalue-weighted \"kinetic distances\" may be the best way to do this, since it then eliminates the need to worry about how many tICs to use.\r\n\r\n**We will need to think about how best to define the set of distances to use.** As @maxentile notes, the number of contacts that change during the simulation depends on the cutoff, and peaks for some intermediate cutoff (~30 A at ~12K contacts).  30A is much larger than what one would typically think of as a \"contact\"---something like 3-8A is generally what one considers for a contact threshold, depending on the distance definition.  (@maxentile: Which distance definition did you use here?  The min distance between any atoms in the residue?)  One thing I'd be curious to see is how well the dominant eigenspaces match up between using different numbers of contacts.  To be more precise: As we change the contact threshold, do the dominant tICs change much?  This is a bit difficult to define very precisely because the number of contacts changes, but we could look at the scalar products between eigenvectors restricted to the set of shared contacts, though we really want to look at scalar products between *spaces* of dominant contacts or some sort of eigenvalue-weighted form of this.\r\n\r\n**The t-SNE projection is interesting, but I am not sure it is useful.**  Really, there's only so much we can do with 2D projections.  These may not be useful ways of trying to understand the system.  I think we should focus on trying to extract useful properties from the discrete-state MSMs we obtain this way.\r\n\r\n**How do clustering-by-kinetic-distance MSMs compare to RMSD-clustered MSMs?**  I still think there is great value in RMSD-clustering-based MSMs (even using the uniformly spaced in time selection of generators).  I'd love to see how this compares to MSMs built by kinetic distance clustering.\r\n\r\nAre there ways we can turn this work into a paper exploring the best ways to build MSMs for kinases?  We are accumulating a decent number of datasets here, so it may be worth trying to plan a useful benchmark and write it up.\r\n\r\n"}}