Skip to content

yuxuanzhuang/ggmolvis

Repository files navigation

ggmolvis

Latest release Last release tag GitHub commits since latest release (by date) for a branch Documentation Status
Status GH Actions Status codecov
Community License: GPL v2 Powered by MDAnalysis

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.

example

Features (planned)

  • Trajectory visualization in jupyter notebook.
  • Customizable feature visualization.
  • Analysis result visualization.

ggmolvis is bound by a Code of Conduct.

Installation

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.

With conda

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

With pip

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]"

Quickstart

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')

Copyright

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

Acknowledgements

Project based on the MDAnalysis Cookiecutter version 0.1. Please cite MDAnalysis when using ggmolvis in published work.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages