Visualization of MDAnalysis results in Blender #4862
Replies: 3 comments 6 replies
-
I don't have enough internet signal for the next week to watch the videos, but it looks like a seriously impressive amount of work you've already done. There is a lot of potential in leveraging the GPU module for more molecular-specific overlays and I would be very interested in seeing the code behind it. |
Beta Was this translation helpful? Give feedback.
-
To complete the thread, I made a slightly detailed list of potential visualizations possible based on the examples in the Analysis section of the User Guide. Any place where Alignments and RMS fittingAligning structures and trajectoriesSince the results of alignment can be made as new universes (either with RMSD and RMSFRMSD values with respect to refs can be shown as overlays depending on the context as there is no inherent visualization aspect to it. RMSF values as B-Factors can already be visualized using Distances and contactsDistancesDistances between atoms, residues, custom selections (between center-of-mass, center-of-geometry, etc) as they vary across a trajectory can be annotated as shown in the PoC above. ContactsNative contacts (with respect to a Trajectory similarityGeometric similarity of trajectories can potentially be visualized by showing individual paths of different trajectories (for atoms, residues, custom selections, etc) either as raw paths or NURBS splines. Since this is a 3ND space, having an option to visualize individual paths might provide insights into similarity/differences evaluated by other methods. StructureRDFSince RDF results are volumetric in nature, they can be depicted similar to the ones in the Volumetric analysis section below with varying sphere radii and color ramps. Dihedral angle analysisDihedral angles (canonical or otherwise) can be annotated as shown in the PoC above which provide a visualization of how they vary over a trajectory. Helix analysisThe geometry of helices characterized by Volumetric analysesMass, charge and other densities can be depicted as shown in the PoC above for solvent density around a protein. Different iso levels, range of iso levels at different alpha levels, sliced in any direction can help with detailed visual analysis. Dimension reductionSince principal component analysis already includes a Polymers and membranesThe PoC above shows a visualization of pore analysis with HOLE2. Hydrogen Bond AnalysisDetected hydrogen bonds by Though I've outlined some of the visualizations above, the goal of any standalone module that could potentially be built is to not implement the above directly, but provide building blocks that serve as a high level interface over the low level Blender API. All of the visualizations above could be built over such building blocks that other MDAnalysis users can also use for their own custom visualizations. I would love to hear any thoughts / feedback from this community. |
Beta Was this translation helpful? Give feedback.
-
That’s an incredible accomplishment, especially with the advanced visualization and density-related aspects. I’ll take a closer look at the code snippet you shared, but it’s already clear that there’s so much potential. The main gist behind You’re also welcome to join our next biweekly discussion on the project. Just DM me or Brady on Discord if you’d like to participate. |
Beta Was this translation helpful? Give feedback.
-
Hi. I was introduced to MDAnalysis by a professor of mine who also encouraged me to attend the Streaming workshop that happened last month. I looked around and one of the projects that I found quite interesting is the visualization of MDAnalysis results in Blender that was presented during the MDAnalysis and Molecular Nodes workshop using the very impressive Molecular Nodes extension by @BradyAJohnston and was also a GSoC 2024 project idea. I noticed that there weren't any major updates to this since.
I wanted to take a crack at this now and build a quick proof-of-concept to see what is feasible since a lot has changed in Blender and Molecular Nodes since then and if there is still interest around this idea.
Looking through the User Guide, I made a very rough categorization for visualizations as follows:
I hacked up some code to visualize these.
Basic Annotations
This is to annotate any basic MDAnalysis results as visualizations in the universe displayed in Blender. This could include things like atomic measures (atom names, bonds, bond lengths, bond angles, etc), center of mass (of proteins, residues, distances between them, etc), dihedrals, radii of gyration, geometric MDAnalysis selections (
sphzone
,sphlayer
, etc) as they vary across the trajectory.These are done similar to how Blender natively displays annotation overlays in the 3D viewport and how popular extensions like
ScreenCast Keys1
,measureit
, etc display such information usingblf
,gpu
modules and such.Here is an example of basic atomic measures:
Here is a short video of this visualization in Blender:
mda_bm_atoms.mp4
Here is an example showing the protein center-of-mass, center-of-mass of two residues and the distance between them:
Here is a short video of this visualization in Blender:
mda_bm_coms.mp4
Here is an example showing the various dihedral angles for a residue:
Here is a short video of this visualization in Blender:
mda_bm_dihedrals.mp4
Here is an example showing all the three radii of gyration along with the combined one:
Here is a short video of this visualization in Blender:
mda_bm_rogs.mp4
Here is an example showing the
sphzone
andsphlayer
selections:Here is a short video of this visualization in Blender:
mda_bm_selections.mp4
All the annotations can be part of the final renders as shown below:
mda_dihedrals_rendering.mp4
Advanced Visualizations
Blender is an ideal tool to visualize anything in 3D space. Some of the MDAnalysis analysis results that have volumetric outputs like densities, structures, etc could benefit from this.
Here is an example of pore dimensions with HOLE2:
The data from
.sph
(generated by thehole
binary) that has the center and radius information for each of the spheres is used directly within Blender to generate the pore surface with the appropriate color coding and the pore center line.Here is a short video of this visualization in Blender:
mda_ha.mp4
Here is an example of solvent density around a protein:
The
water.dx
file generated by MDAnalysis is converted to an OpenVDB file format that Blender natively supports. This allows interactive visualization of differentiso
levels, slice through the volumetric data (like in 3D MRI data), etc. The example above shows positiveiso
values in blue and negative ones in red.Here is a short video of this visualization in Blender:
mda_da_water.mp4
Here is another example of charge densities using data from here:
Here is a short video of this visualization in Blender:
mda_da_apbs.mp4
Charting / Plotting and others
A lot of charts / plots that are used for MDAnalysis analysis results can also be generated within Blender - especially the ones that are 3D in nature. For example distances between residues, which is a heatmap that can be visualized in 3D. This data varying with frames along the trajectory would then be an animated heatmap. I am not sure if there is a lot of value that visualizations of these in Blender would provide apart from some specific use cases.
Blender can already be interfaced with Jupyter Notebooks as demonstrated in the MDAnalysis and Molecular Nodes workshop and also more recently in the Blender Conference 2024. Blender can be used either in the headless mode or GUI mode as outlined here in this workshop. We cannot expose everything that Blender offers as python API in the headless mode, but we can have some sensible defaults that are usable. A Blender extension (while exposing the python API) could provide a more user-friendly GUI for users who aren't Blender experts and bridge that gap.
Would love to hear what you folks think. If there is interest around this, I could write up a detailed proposal of how this could potentially work.
Beta Was this translation helpful? Give feedback.
All reactions