Latest release | |
---|---|
Status | |
Community |
GGMolVis is a Python package that provides a high-level interface to MolecularNodes in Blender for molecular visualization.
It is inspired by the design patterns of ggplot2 and matplotlib. The goal is to create a stable Python API that enables users to visualize molecular trajectories (and potentially other entities in MN) with both automation and customization. Everything is designed to be dynamic during frame changes. The package also includes capabilities to visualize protein features and analysis results---such as distances, angles, and dihedrals---with texts, lines, and shapes.
- Trajectory visualization in jupyter notebook.
- Customizable feature visualization.
- Analysis result visualization.
ggmolvis is bound by a Code of Conduct.
To build ggmolvis from source,
we highly recommend using virtual environments.
If possible, we strongly recommend that you use
Anaconda as your package manager.
Below we provide instructions both for conda
and
for pip
.
Ensure that you have conda installed.
Create a virtual environment and activate it:
conda create --name ggmolvis
conda activate ggmolvis
Install the development and documentation dependencies:
conda env update --name ggmolvis --file devtools/conda-envs/test_env.yaml
conda env update --name ggmolvis --file docs/requirements.yaml
Build this package from source:
pip install -e .
If you want to update your dependencies (which can be risky!), run:
conda update --all
And when you are finished, you can exit the virtual environment with:
conda deactivate
To build the package from source, run:
pip install .
If you want to create a development environment, install the dependencies required for tests and docs with:
pip install ".[test,doc]"
import MDAnalysis as mda
from MDAnalysis.tests.datafiles import PSF, DCD
from MDAnalysis.analysis.rms import RMSD
from ggmolvis.ggmolvis import GGMolVis
u = mda.Universe(PSF, DCD)
# Trajectory visualization
residues_ag = u.select_atoms("resid 127 40")
residues_ag.visualize()
# Feature visualization
res_1 = residues_ag.residues[0].atoms
res_2 = residues_ag.residues[1].atoms
line = ggmv.distance(res_1, res_2, location=(5,0,0))
line.render()
# Analysis result visualization
rmsd = RMSD(u.select_atoms('name CA'))
rmsd.run()
vis = rmsd.visualize()
vis.render(mode='movie')
The ggmolvis source code is hosted at https://github.com/yuxuanzhuang/ggmolvis and is available under the GNU General Public License, version 2 (see the file LICENSE).
Copyright (c) 2024, Yuxuan Zhuang
Project based on the MDAnalysis Cookiecutter version 0.1. Please cite MDAnalysis when using ggmolvis in published work.