PCA (contribution of each residue to PCA)

134 views
Skip to first unread message

Rezvan Chitsazi

unread,
Aug 9, 2022, 4:47:13 PM8/9/22
to MDnalysis discussion
Hello all,

How we can show/plot the contribution of each residue vs. PCA components (e.g. residue position vs. PC(1))? 
& how we can just show (color-code) those residues that contributed most (e.g. PC1, PC2) on the structure?

any suggestions/comments would be appreciated.

Thank you!!
Leila

Kabir Biswas

unread,
Sep 25, 2022, 7:05:40 AM9/25/22
to MDnalysis discussion
It would be nice to see a script to get individual residue contributions to PC1 and PC2.
Thanks,
Kabir

Oliver Beckstein

unread,
Sep 26, 2022, 12:53:44 PM9/26/22
to MDnalysis discussion
Hi Kabir and Leila,

If you provide the equations that are needed to calculate the desired quantities then members of the list can help with how to implement them using MDAnalysis.

In general, if you're looking for a new feature or want help with a question then it's best to provide as much information as possible. For instance, find papers that already describe the methods (and cite them together with a link to the paper itself so that anyone interested could easily look at it). Include equations in your email. Say clearly what the input is and what you expect as output. The more of the work you already do, the more likely it is that you get a useful answer.

(Just speaking for me: I have plenty of other things to do in my normal jobs and I don't get paid for working on MDAnalysis (and this is true for almost everyone on the list). I might have a maximum of 5 mins time to spare to answer a mailing list question. If I can see that a response requires longer that this time then I'll typically don't send a response at all.)

Best wishes,
Oliver

Kabir Biswas

unread,
Oct 1, 2022, 5:59:46 PM10/1/22
to MDnalysis discussion
Dear Prof. Beckstein,

Apologies for not providing enough details about the request/question. The question was related to mapping displacement (contribution) of individual backbone atom relating to the first and second principal components (like the ones shown in 2D,E,F in this paper: Comparative structural dynamic analysis of GTPases).

I think projecting atomic motions relating to individual principal components has been included in MDAnalysis v2.3 as project_single_frame(components=None, group=None, anchor=None) [https://docs.mdanalysis.org/stable/documentation_pages/analysis/pca.html]

I have used the following from the PCA tutorial [available at https://userguide.mdanalysis.org/stable/examples/analysis/reduced_dimensions/pca.html ; later section on generating a movie/gif to show backbone motion - thanks to Irfan for helping with the third line in the code below]:
pc1 = pc.p_components[:, 0]
trans1 = transformed[:, 0]
projected = np.outer(trans1, pc1) + pc.mean.flatten()
coordinates = projected.reshape(len(trans1), -1, 3)

I then used the actual Calpha coordinates from the variable 'coordinates' above over the trajectory to determine displacements of individual Calpha atoms (root mean squared).

I highly appreciate your (and other contributors) efforts towards MDAnalysis (for one, we are no longer worried about working with very long trajectories).

Thanks and best wishes,
Kabir

Oliver Beckstein

unread,
Oct 1, 2022, 8:07:50 PM10/1/22
to mdnalysis-...@googlegroups.com
Hi Kabir,

Thanks for the detailed reply. But please just call me “Oliver” — we all use first names or a preferred handle; we  don’t use honorifics like “Dr” or “Prof” (or “Your Grace” or “Your Majesty” ;-) ) here. When talking about code and science, it only matters that we all have a common interest (and that we treat everybody with respect, as explained in our Code of Conduct https://www.mdanalysis.org/pages/conduct/ ). I’m glad that MDA is helpful for your research. 

I had a quick look at the RAS paper but I didn’t see a specific definition of how the interesting figure 2d-f were calculated. Do you know how?

Oliver 

Am 10/1/22 um 15:16 schrieb Kabir Biswas <kabir.has...@gmail.com>:


--
You received this message because you are subscribed to the Google Groups "MDnalysis discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mdnalysis-discussion/da5ebcd2-cfb0-42a7-b008-432a7c5115dbn%40googlegroups.com.

Kabir Biswas

unread,
Oct 2, 2022, 4:25:57 AM10/2/22
to mdnalysis-...@googlegroups.com
Dear Oliver,

I think they too use the projection of PC1 and 2  to get displacements/contributions of individual residues. This is what they have written in the materials and methods section "Projection of the conformational ensemble onto the subspace defined by the top two largest PCs provides a low-dimensional display of structures, highlighting the major differences between conformers."

Best,
Kabir

You received this message because you are subscribed to a topic in the Google Groups "MDnalysis discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mdnalysis-discussion/CIDbEoaYF1Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mdnalysis-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mdnalysis-discussion/64E3BCE5-E58B-45A7-889D-D410C8BC7728%40gmail.com.


--
----
Kabir H Biswas, PhD
Assistant Professor
College of Health & Life Sciences
Hamad Bin Khalifa University
Doha, Qatar 
 
Reply all
Reply to author
Forward
0 new messages