Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic selections from MDAnalysis #625

Open
m-a-r-i-u-s opened this issue Sep 30, 2024 · 4 comments
Open

Dynamic selections from MDAnalysis #625

m-a-r-i-u-s opened this issue Sep 30, 2024 · 4 comments

Comments

@m-a-r-i-u-s
Copy link

Hi all,

I have a question/request regarding selections in Molecular Nodes. We recently published a MDAKit to identify domains in membranes. I think it would look cool to import the output to Blender for visualising the identified domains in the membrane trajectory. The output is (right now) a dictionary of resids corresponding to the domain lipids at every time step. What would be the easiest/cleanest/fastest way to use this resids in Molecular Nodes? I have some (basic) experience with Blender and Molecular Nodes, but I am a little bit puzzled for this type of task. I would be very glad about some guidance (e.g., which part of Molecular Nodes to look at,...).

Many thanks and have a great start into the week,
Marius

@BradyAJohnston
Copy link
Owner

Hello! Currently importing CSV of data isn't the easiest thing in the world, but is certainly doable.

When you are computing this data, does it remain associated with the MDA Universe and then you are writing it out as a dictionary, or is the output of the analysis the dictionary itself?

I have recently added a somewhat experimental and still undocumented method for add a 'calculation' that can be run each time the frame changes inside of blender: #535

We should be able to have the per-frame calculation read in the dictionary / json file, pull the relevant bits of information, then store them on the mesh as an attribute. This isn't ideal as the current setup would re-read the data file each frame (something to be improved in the future), but if it is a relatively small system then it shouldn't be an issue.

I can give some more directed advice if you can maybe provide an example universe / data output that I can experiment with, otherwise I can help you setup something.

This is an experimental method of working with importing data / calculations so I welcome any and all feedback / suggestions for how this should work.

@m-a-r-i-u-s
Copy link
Author

Hi, thanks for your quick reply. :)
The (main) output of the analysis is returned as a dictionary, e.g. [{0: [1, 2,3,]} , {1: [1,2,3,4]}, ...]. So it is not (directly) associated with a MDA Universe, however if life would get easier with that I can add a small function to our codebase that converts the list of residues to a MDA selection.

Depends on what you would consider as small... ^_^ Membrane simulations usually contain between 100-4000 lipids, depending mainly on the resolution (coarse-grained vs atomistic). The example below contains 7992 atoms and is a rather small coarse-grained membrane. The trajectory, the topology and the output of DomHMM is uploaded to a platform hosted by my university:
https://faubox.rrze.uni-erlangen.de/getlink/fiD5Yb1kAgLPZhFbAiEoNk/

The .xtc and the .tpr is taken from the unit tests of our main repository, but I reduced the number of frames to 400. The output is stored in a pickle file and can be loaded via:

import pickle
with open('model_dump.pickle', 'rb') as file:
    loaded_module = pickle.load(file)

The resids of the clustered lipids in the upper leaflet in the first frame can be accessed like this:

loaded_module.results["Clustering"]["0"][0]`

If you need more advice on the example or if you encounter any errors, please let me know!

My general idea on this would be to highlight the lipids in the cluster somehow (e.g., adding a glow effect or color them just differently). For example, one performs the workflow for the lipid clustering and then switches to Blender to make a nice video or some images with Molecular Nodes using the data directly obtained from DomHMM.

Many thanks for your help!

@BradyAJohnston
Copy link
Owner

Thanks for the extra details. I should definitely be able to get something working, but won't have time to look into this for another week or two.

@m-a-r-i-u-s
Copy link
Author

No problem! ;) I am also quite busy right now, and if I have some more time I will try to take a look by myself. This is not very very urgent, just a cool idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants