[Citation](#cite) | [Installation](#installation) | [Example](#example) | [Usage](#usage) | [Command line](#command-line) | [API doc](#api-doc) | [Interface classes](docs/interface_classes.md) | [Website](#website) | [Acknowledgment](#acknowledgment)


## Try nglview online: [](https://mybinder.org/v2/gh/hainm/nglview-binder/master?urlpath=lab/tree/nglview/notebooks)
An [IPython/Jupyter](http://jupyter.org/) widget to interactively view molecular structures and trajectories. Utilizes the embeddable [NGL Viewer](https://github.com/nglviewer/ngl) for rendering. Support for showing data from the file-system, [RCSB PDB](http:www.rcsb.org), [simpletraj](https://github.com/arose/simpletraj) and from objects of analysis libraries [mdtraj](http://mdtraj.org/), [pytraj](http://amber-md.github.io/pytraj/latest/index.html), [mdanalysis](http://www.mdanalysis.org/), [ParmEd](http://parmed.github.io/ParmEd/), [rdkit](https://github.com/rdkit/rdkit), [ase](https://wiki.fysik.dtu.dk/ase/), [HTMD](https://www.htmd.org), [biopython](https://github.com/biopython/biopython.github.io/), [cctbx](https://cci.lbl.gov/cctbx_docs/iotbx/), [pyrosetta](http://pyrosetta.org), [schrodinger's Structure](http://content.schrodinger.com/Docs/r2015-4/python_api/api/schrodinger.structure.Structure-class.html)
Should work with Python 3. If you experience problems, please file an [issue](https://github.com/nglviewer/nglview/issues).
Ask question about usage? Please post [here](https://github.com/nglviewer/nglview/discussions)

Table of contents
=================
* [Installation](#installation)
* [Example](#example)
* [Showcase from users](#showcase-from-users)
* [Usage](#usage)
* [Contributing](#contributing)
* [Command line](#command-line)
* [API doc](#api-doc)
* [Interface classes](docs/interface_classes.md)
* [Changelog](CHANGELOG.md)
* [FAQ](#faq)
* [Website](#website)
* [Acknowledgment](#acknowledgment)
* [Cite](#cite)
* [License](#license)
Installation
============
Released version
----------------
- Available on `conda-forge` channel
```bash
conda install nglview -c conda-forge
```
- Available on [PyPI](https://pypi.python.org/pypi/nglview/)
```bash
pip install nglview
```
Jupyterlab: `nglview` works best with jupyterlab >= 3.0 and no further steps needed.
Known to work versions
|nglview|lab|notebook|ipywidgets|Known issue(s)|VSCode
|--|--|--|--|--|--|
|3.1.0|4.0.10|7.0.6|8.1.1|[HTML embed doesn't work](https://github.com/jupyter-widgets/ipywidgets/issues/3878)|No|
|3.0.8|4.0.10|7.0.6|8.1.1|[show_pdbid doesn't work](https://github.com/nglviewer/nglview/issues/1082)|Yes|
## Notes
If you are using `notebook` v5.0, you need to increase the `iopub_data_rate_limit`
to [visualize big structure (e.g: solvated system)](https://github.com/arose/nglview/issues/633)
```
jupyter notebook --NotebookApp.iopub_data_rate_limit=10000000
```
Development version
-------------------
Requirement: `ipywidgets >= 7.0`, `notebook >= 4.2`
The development version can be installed directly from github:
### notebook user
```bash
git clone https://github.com/arose/nglview
cd nglview
python setup.py install
# if you edit files in ./js folder, make sure to rebuild the code
cd js
npm install
# probably need to activate widgetsnbextension
# python -m ipykernel install --sys-prefix
# jupyter nbextension enable --py --sys-prefix widgetsnbextension
# jupyter nbextension enable --py --sys-prefix nglview
# tested with ipywidgets 5.2.2, notebook 4.2.1
```
Example
=======
- Notebooks: please see our [Jupyter notebook examples](examples/README.md)
- Simple demo for trajectory (take time to load): [biomembrane](http://amber-md.github.io/pytraj/latest/ngl_player.html)
Showcase from users
===================
- Please check [user examples](examples/user_examples.md). Feel free to contribute.
- Also check [a series of excelent tutorials about/using nglview from volkamerlab](https://projects.volkamerlab.org/teachopencadd/search.html?q=nglview)
Usage
=====
Open a notebook
jupyter notebook
and issue
```Python
import nglview
view = nglview.show_pdbid("3pqr") # load "3pqr" from RCSB PDB and display viewer widget
view
```
A number of convenience functions are available to quickly display data from
the file-system, [RCSB PDB](http:www.rcsb.org), [simpletraj](https://github.com/arose/simpletraj) and from objects of analysis libraries [mdtraj](http://mdtraj.org/), [pytraj](http://amber-md.github.io/pytraj/latest/index.html), [mdanalysis](http://www.mdanalysis.org/), [ParmEd](http://parmed.github.io/ParmEd/), [rdkit](https://github.com/rdkit/rdkit), [HTMD](https://github.com/Acellera/htmd), [biopython](https://github.com/biopython/biopython.github.io/).
| Function | Description |
|------------------------------------------|-------------------------------------------------------|
| `show_file(path)` | Shows any NGL supported file formats (pdb, gro, mol2, sdf, dx, ..) in `path` |
| `show_pdbid(pdbid)` | Shows `pdbid` fetched from RCSB PDB |
| `show_simpletraj(struc_path, traj_path)` | Shows structure & trajectory loaded with `simpletraj` |
| `show_mdtraj(traj)` | Shows `MDTraj` trajectory `traj` |
| `show_pytraj(traj)` | Shows `PyTraj` trajectory `traj` |
| `show_parmed(structure)` | Shows `ParmEd` structure |
| `show_mdanalysis(univ)` | Shows `MDAnalysis` Universe or AtomGroup `univ` |
| `show_rdkit(mol)` | Shows `rdkit` rdkit.Chem.rdchem.Mol |
| `show_ase(atoms)` | Shows `ase` Atoms |
| `show_asetraj(traj)` | Shows `ase` trajectory `traj` |
| `show_pymatgen(struct)` | Shows `pymatgen` Structure |
| `show_htmd(mol)` | Shows `HTMD` Molecules |
| `show_biopython(mol)` | Shows `Biopython` structural entities |
| `show_iotbx(mol)` | Shows `cctbx's iotbx` structure |
| `show_rosetta(pose)` | Shows `pyrosetta's Pose` |
| `show_iodata(obj)` | Shows `iodata's IOData` |
| `show_psi4(obj)` | Shows `psi4's Molecule` |
| `show_qcelemental` | Shows `QCelementary's Molecule` |
| `show_openbabel` | Shows `openbabel's OMol` |
| `show_prody` | Shows `prody's Ensemble or AtomGroup` |
API
===
Representations
---------------
```python
view.add_representation('cartoon', selection='protein')
# or shorter
view.add_cartoon(selection="protein")
view.add_surface(selection="protein", opacity=0.3)
# specify color
view.add_cartoon(selection="protein", color='blue')
# specify residue
view.add_licorice('ALA, GLU')
# clear representations
view.clear_representations()
# update parameters for ALL cartoons of component 0 (default)
view.update_cartoon(opacity=0.4, component=0)
# remove ALL cartoons of component 0 (default)
view.remove_cartoon(opacity=0.4, component=0)
# Not using default representation
view = nv.show_file('your.pdb', default=False)
view.center()
view.add_rope()
```
Representations can also be changed by overwriting the `representations` property
of the widget instance `view`. The available `type` and `params` are described
in the NGL Viewer [documentation](http://nglviewer.org/ngl/api/index.html).
```Python
view.representations = [
{"type": "cartoon", "params": {
"sele": "protein", "color": "residueindex"
}},
{"type": "ball+stick", "params": {
"sele": "hetero"
}}
]
```
The widget constructor also accepts a `representation` argument:
```Python
initial_repr = [
{"type": "cartoon", "params": {
"sele": "protein", "color": "sstruc"
}}
]
view = nglview.NGLWidget(struc, representation=initial_repr)
view
```
Properties
----------
```Python
# set the frame number
view.frame = 100
```
```Python
# parameters for the NGL stage object
view.stage.set_parameters(**{
# "percentages, "dist" is distance to camera in Angstrom
"clipNear": 0, "clipFar": 100, "clipDist": 10,
# percentages, start of fog and where on full effect
"fogNear": 0, "fogFar": 100,
# background color
"backgroundColor": "black",
})
# note: NGLView accepts both origin camel NGL keywords (e.g. "clipNear")
# and snake keywords (e.g "clip_near")
```
```python
# parameters to control the `delay` between snapshots
# change `step` to play forward (positive value) or backward (negative value)
# note: experimental code
view.player.parameters = dict(delay=0.04, step=-1)
```
```python
# update camera type
view.camera = 'orthographic'
```
```python
# change background color
view.background = 'black'
```
Trajectory
----------
```python
# adding new trajectory
view.add_trajectory(traj)
# traj could be a `pytraj.Trajectory`, `mdtraj.Trajectory`, `MDAnalysis.Universe`,
# `parmed.Structure`, `htmd.Molecule` or derived class of `nglview.Trajectory`
# change representation
view[0].add_cartoon(...) # equal to view.add_cartoon(component=0)
view[1].add_licorice(...) # equal to view.add_licorice(component=1)
```
Add extra component
-------------------
```python
# Density volumes (MRC/MAP/CCP4, DX/DXBIN, CUBE)
# Or adding derived class of `nglview.Structure`
view.add_component('my.ccp4')
# add component from url
view.add_component('rcsb://1tsu.pdb')
# NOTE: Trajectory is a special case of component.
```
Mouse
-----
```python
# coot mouse style (https://en.wikipedia.org/wiki/Coot_(software))
view.stage.set_parameters(mouse_preset='coot')
```
Interaction controls
--------------------
- [Mouse](https://github.com/arose/ngl/blob/master/docs/usage/interaction-controls.md#mouse)
- [Keyboard](https://github.com/arose/ngl/blob/master/docs/usage/interaction-controls.md#keyboard)
Movie making
------------
Require: moviepy (`pip install moviepy`)
```python
from nglview.contrib.movie import MovieMaker
movie = MovieMaker(view, output='my.gif', in_memory=True)
movie.make()
```
Embed widget
------------
[embed](docs/embed.md)
API doc
=======
- [Latest version](http://nglviewer.github.io/nglview/latest/api.html)
- [All releases versions](http://nglviewer.github.io/nglview/release/index.html)
- [Development version](http://nglviewer.github.io/nglview/dev/api.html)
Command line
============
```bash
# open a notebook and import nglview
nglview
# Require installing pytraj (PR for other backends is welcome)
# open notebook, load `my.pdb` to pytraj's trajectory then display `view`
nglview my.pdb
# load density data
nglview my.ccp4
# open notebook, create trajectory with given topology `my.parm7` and trajecotry file `traj.nc`,
# then display `view`
nglview my.parm7 -c traj.nc
# load all trajectories with filename ending with 'nc'
# make sure to use quote " "
nglview my.parm7 -c "*.nc"
# open notebook, copy content from `myscript.py`
nglview myscript.py
# create a remote notebook
# just follow its instruction
nglview my.pdb --remote
nglview my.parm7 -c traj.nc --remote
nglview mynotebook.ipynb --remote
# demo (don't need pytraj)
nglview demo
# specify web browser
nglview my.pdb --browser=google-chrome
```
FAQ
===
[Q&A](docs/FAQ.md)
Website
=======
- http://nglviewer.github.io/nglview/latest
- http://nglviewer.github.io/nglview/dev
Talks
=====
[Talks about NGL and nglview](./talks.md)
Contributing
============
[Join us here](./CONTRIBUTING.md)
Projects integrating NGLView
============================
(Feel free to make a PR to add/remove your project here. Thanks.)
- [AMBER](http://ambermd.org/) - A package of programs for molecular dynamics simulations of proteins and nucleic acids
- [mbuild](https://github.com/iModels/mbuild) - A hierarchical, component based molecule builder
- [deepchem](https://github.com/deepchem/deepchem) - Deep-learning models for Drug Discovery and Quantum Chemistry
- [htmd](https://github.com/Acellera/htmd) - High throughput molecular dynamics simulations
- [Moleidoscope](https://github.com/kbsezginel/Moleidoscope) - Molecular kaleidoscope
- [ssbio](https://github.com/nmih/ssbio) - Tools for enabling structural systems biology
- [hublib](https://github.com/martin-hunt/hublib) - hublib is a Python library for the [HUBzero](https://hubzero.org/) science gateway platform.
- [molPX](https://github.com/markovmodel/molPX): ipython API to visualize MD-trajectories along projected trajectories
- [nanoribbon](https://github.com/oschuett/nanoribbon)
- [ase](https://github.com/rosswhitfield/ase): Atomic Simulation Environment
- [pida](https://github.com/jharman25/pida): Software for analyzing multiple protein-protein interaction docking solutions,
- [pytim](https://github.com/Marcello-Sega/pytim)
- [MobleyLab/drug-computing](https://github.com/MobleyLab/drug-computing) Educational materials for, and related to, UC Irvine's Drug Discovery Computing Techniques course.
- [pyiron](https://pyiron.github.io/): an integrated development environment for implementing, testing, and running simulations in computational materials science.
- [BioSimSpace](https://biosimspace.org/): An interoperable framework for biomolecular simulation
- [pyrod](https://github.com/schallerdavid/pyrod): PyRod - Tracing water molecules in molecular dynamics simulations
- [kugupu](https://github.com/kugupu/kugupu): kugupu - a molecular network generator to study charge transport pathways in amorphous materials
- [pnab](https://github.com/alenaizan/pnab): proto-Nucleic Acid Builder
- [opencadd](https://github.com/volkamerlab/opencadd): A Python library for structural cheminformatics
- [teachopencadd](https://github.com/volkamerlab/teachopencadd): TeachOpenCADD: a teaching platform for computer-aided drug design (CADD) using open source packages and data
- [query.libretexts.org](https://query.libretexts.org/Sandboxes/jupyterteam@ucdavis.edu): query.libretexts.org
- [datamol](https://github.com/datamol-org/datamol): A python library to work with molecules.
- [dynophores](https://github.com/dominiquesydow/dynophores): Dynamic pharmacophore modeling of molecular interactions
- [pychemcurv](https://github.com/gVallverdu/pychemcurv): Discrete and local curvature applied to chemistry and chemical reactivity
- [AutoSolvate](https://github.com/Liu-group/AutoSolvate): Automated workflow for generating quantum chemistry calculation of explicitly solvated molecules
- [plipify](https://github.com/volkamerlab/plipify): PLIPify: Protein-Ligand Interaction Frequencies across Multiple Structures
- [Melodia](https://github.com/rwmontalvao/Melodia): Differential Geometry of Proteins Backbones
- [pyrosetta_viewer3d](https://github.com/RosettaCommons/pyrosetta_viewer3d): Display PackedPose objects, Pose objects, or PDB files within a Jupyter notebook and Google Colab
- [py4vasp](https://vasp.at/py4vasp): Python interface for VASP
- [eminus](https://github.com/wangenau/eminus): A plane wave density functional theory code.
- [MolSysMT](https://github.com/uibcdf/MolSysMT): Molecular Systems Multi-Tool
Acknowledgment
==============
- Funding: Hai Nguyen is supported by NIH Grant GM103297, "The Center for HIV RNA Studies" (2015 to 02-2017).
- Many thanks to `nglview` [contributors](https://github.com/arose/nglview/graphs/contributors)
- [dunovank/jupyter-themes](https://github.com/dunovank/jupyter-themes): for `oceans16` theme
- [base64-arraybuffer](https://github.com/niklasvh/base64-arraybuffer)
- [ipywidgets](https://github.com/jupyter-widgets/ipywidgets)
Cite
====
If you would like to acknowledge our work, feel free to cite:
Hai Nguyen, David A Case, Alexander S Rose; NGLview - Interactive molecular graphics for Jupyter notebooks, Bioinformatics, , btx789, https://doi.org/10.1093/bioinformatics/btx789
License
=======
Generally MIT, see the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/arose/nglview",
"name": "nglview",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "ipython, jupyter, widgets",
"author": "Alexander S. Rose, Hai Nguyen",
"author_email": "alexander.rose@weirdbyte.de",
"download_url": "https://files.pythonhosted.org/packages/55/fe/bd1c2aaa7e38055116e22467ccbc3600936d977afddf91ec049ee900c909/nglview-3.1.4.tar.gz",
"platform": null,
"description": "[Citation](#cite) | [Installation](#installation) | [Example](#example) | [Usage](#usage) | [Command line](#command-line) | [API doc](#api-doc) | [Interface classes](docs/interface_classes.md) | [Website](#website) | [Acknowledgment](#acknowledgment)\n\n\n\n\n## Try nglview online: [](https://mybinder.org/v2/gh/hainm/nglview-binder/master?urlpath=lab/tree/nglview/notebooks)\n\n\nAn [IPython/Jupyter](http://jupyter.org/) widget to interactively view molecular structures and trajectories. Utilizes the embeddable [NGL Viewer](https://github.com/nglviewer/ngl) for rendering. Support for showing data from the file-system, [RCSB PDB](http:www.rcsb.org), [simpletraj](https://github.com/arose/simpletraj) and from objects of analysis libraries [mdtraj](http://mdtraj.org/), [pytraj](http://amber-md.github.io/pytraj/latest/index.html), [mdanalysis](http://www.mdanalysis.org/), [ParmEd](http://parmed.github.io/ParmEd/), [rdkit](https://github.com/rdkit/rdkit), [ase](https://wiki.fysik.dtu.dk/ase/), [HTMD](https://www.htmd.org), [biopython](https://github.com/biopython/biopython.github.io/), [cctbx](https://cci.lbl.gov/cctbx_docs/iotbx/), [pyrosetta](http://pyrosetta.org), [schrodinger's Structure](http://content.schrodinger.com/Docs/r2015-4/python_api/api/schrodinger.structure.Structure-class.html)\n\nShould work with Python 3. If you experience problems, please file an [issue](https://github.com/nglviewer/nglview/issues).\n\nAsk question about usage? Please post [here](https://github.com/nglviewer/nglview/discussions)\n\n\n\nTable of contents\n=================\n\n* [Installation](#installation)\n* [Example](#example)\n* [Showcase from users](#showcase-from-users)\n* [Usage](#usage)\n* [Contributing](#contributing)\n* [Command line](#command-line)\n* [API doc](#api-doc)\n* [Interface classes](docs/interface_classes.md)\n* [Changelog](CHANGELOG.md)\n* [FAQ](#faq)\n* [Website](#website)\n* [Acknowledgment](#acknowledgment)\n* [Cite](#cite)\n* [License](#license)\n\n\nInstallation\n============\n\nReleased version\n----------------\n\n- Available on `conda-forge` channel\n\n ```bash\n conda install nglview -c conda-forge\n ```\n\n- Available on [PyPI](https://pypi.python.org/pypi/nglview/)\n\n```bash\n pip install nglview\n```\n\nJupyterlab: `nglview` works best with jupyterlab >= 3.0 and no further steps needed.\nKnown to work versions\n\n|nglview|lab|notebook|ipywidgets|Known issue(s)|VSCode\n|--|--|--|--|--|--|\n|3.1.0|4.0.10|7.0.6|8.1.1|[HTML embed doesn't work](https://github.com/jupyter-widgets/ipywidgets/issues/3878)|No|\n|3.0.8|4.0.10|7.0.6|8.1.1|[show_pdbid doesn't work](https://github.com/nglviewer/nglview/issues/1082)|Yes|\n\n## Notes\n\nIf you are using `notebook` v5.0, you need to increase the `iopub_data_rate_limit`\nto [visualize big structure (e.g: solvated system)](https://github.com/arose/nglview/issues/633)\n\n```\njupyter notebook --NotebookApp.iopub_data_rate_limit=10000000\n```\n\nDevelopment version\n-------------------\n\nRequirement: `ipywidgets >= 7.0`, `notebook >= 4.2`\n\nThe development version can be installed directly from github:\n\n### notebook user\n\n```bash\n git clone https://github.com/arose/nglview\n cd nglview\n python setup.py install\n\n # if you edit files in ./js folder, make sure to rebuild the code\n cd js\n npm install\n\n # probably need to activate widgetsnbextension\n # python -m ipykernel install --sys-prefix\n # jupyter nbextension enable --py --sys-prefix widgetsnbextension\n # jupyter nbextension enable --py --sys-prefix nglview\n\n # tested with ipywidgets 5.2.2, notebook 4.2.1\n```\n\nExample\n=======\n\n- Notebooks: please see our [Jupyter notebook examples](examples/README.md)\n- Simple demo for trajectory (take time to load): [biomembrane](http://amber-md.github.io/pytraj/latest/ngl_player.html)\n\nShowcase from users\n===================\n- Please check [user examples](examples/user_examples.md). Feel free to contribute.\n- Also check [a series of excelent tutorials about/using nglview from volkamerlab](https://projects.volkamerlab.org/teachopencadd/search.html?q=nglview)\n\nUsage\n=====\n\nOpen a notebook\n\n jupyter notebook\n\nand issue\n\n```Python\nimport nglview\nview = nglview.show_pdbid(\"3pqr\") # load \"3pqr\" from RCSB PDB and display viewer widget\nview\n```\n\nA number of convenience functions are available to quickly display data from\nthe file-system, [RCSB PDB](http:www.rcsb.org), [simpletraj](https://github.com/arose/simpletraj) and from objects of analysis libraries [mdtraj](http://mdtraj.org/), [pytraj](http://amber-md.github.io/pytraj/latest/index.html), [mdanalysis](http://www.mdanalysis.org/), [ParmEd](http://parmed.github.io/ParmEd/), [rdkit](https://github.com/rdkit/rdkit), [HTMD](https://github.com/Acellera/htmd), [biopython](https://github.com/biopython/biopython.github.io/).\n\n| Function | Description |\n|------------------------------------------|-------------------------------------------------------|\n| `show_file(path)` | Shows any NGL supported file formats (pdb, gro, mol2, sdf, dx, ..) in `path` |\n| `show_pdbid(pdbid)` | Shows `pdbid` fetched from RCSB PDB |\n| `show_simpletraj(struc_path, traj_path)` | Shows structure & trajectory loaded with `simpletraj` |\n| `show_mdtraj(traj)` | Shows `MDTraj` trajectory `traj` |\n| `show_pytraj(traj)` | Shows `PyTraj` trajectory `traj` |\n| `show_parmed(structure)` | Shows `ParmEd` structure |\n| `show_mdanalysis(univ)` | Shows `MDAnalysis` Universe or AtomGroup `univ` |\n| `show_rdkit(mol)` | Shows `rdkit` rdkit.Chem.rdchem.Mol |\n| `show_ase(atoms)` | Shows `ase` Atoms |\n| `show_asetraj(traj)` | Shows `ase` trajectory `traj` |\n| `show_pymatgen(struct)` | Shows `pymatgen` Structure |\n| `show_htmd(mol)` | Shows `HTMD` Molecules |\n| `show_biopython(mol)` | Shows `Biopython` structural entities |\n| `show_iotbx(mol)` | Shows `cctbx's iotbx` structure |\n| `show_rosetta(pose)` | Shows `pyrosetta's Pose` |\n| `show_iodata(obj)` | Shows `iodata's IOData` |\n| `show_psi4(obj)` | Shows `psi4's Molecule` |\n| `show_qcelemental` | Shows `QCelementary's Molecule` |\n| `show_openbabel` | Shows `openbabel's OMol` |\n| `show_prody` | Shows `prody's Ensemble or AtomGroup` |\n\n\nAPI\n===\n\nRepresentations\n---------------\n\n```python\nview.add_representation('cartoon', selection='protein')\n\n# or shorter\nview.add_cartoon(selection=\"protein\")\nview.add_surface(selection=\"protein\", opacity=0.3)\n\n# specify color\nview.add_cartoon(selection=\"protein\", color='blue')\n\n# specify residue\nview.add_licorice('ALA, GLU')\n\n# clear representations\nview.clear_representations()\n\n# update parameters for ALL cartoons of component 0 (default)\nview.update_cartoon(opacity=0.4, component=0)\n\n# remove ALL cartoons of component 0 (default)\nview.remove_cartoon(opacity=0.4, component=0)\n\n# Not using default representation\nview = nv.show_file('your.pdb', default=False)\nview.center()\nview.add_rope()\n```\n\nRepresentations can also be changed by overwriting the `representations` property\nof the widget instance `view`. The available `type` and `params` are described\nin the NGL Viewer [documentation](http://nglviewer.org/ngl/api/index.html).\n\n```Python\nview.representations = [\n {\"type\": \"cartoon\", \"params\": {\n \"sele\": \"protein\", \"color\": \"residueindex\"\n }},\n {\"type\": \"ball+stick\", \"params\": {\n \"sele\": \"hetero\"\n }}\n]\n```\n\nThe widget constructor also accepts a `representation` argument:\n\n```Python\ninitial_repr = [\n {\"type\": \"cartoon\", \"params\": {\n \"sele\": \"protein\", \"color\": \"sstruc\"\n }}\n]\n\nview = nglview.NGLWidget(struc, representation=initial_repr)\nview\n```\n\n\nProperties\n----------\n\n```Python\n# set the frame number\nview.frame = 100\n```\n\n```Python\n# parameters for the NGL stage object\nview.stage.set_parameters(**{\n # \"percentages, \"dist\" is distance to camera in Angstrom\n \"clipNear\": 0, \"clipFar\": 100, \"clipDist\": 10,\n # percentages, start of fog and where on full effect\n \"fogNear\": 0, \"fogFar\": 100,\n # background color\n \"backgroundColor\": \"black\",\n})\n\n# note: NGLView accepts both origin camel NGL keywords (e.g. \"clipNear\")\n# and snake keywords (e.g \"clip_near\")\n```\n\n```python\n# parameters to control the `delay` between snapshots\n# change `step` to play forward (positive value) or backward (negative value)\n# note: experimental code\nview.player.parameters = dict(delay=0.04, step=-1)\n```\n\n```python\n# update camera type\nview.camera = 'orthographic'\n```\n\n```python\n# change background color\nview.background = 'black'\n```\nTrajectory\n----------\n\n```python\n# adding new trajectory\nview.add_trajectory(traj)\n# traj could be a `pytraj.Trajectory`, `mdtraj.Trajectory`, `MDAnalysis.Universe`,\n# `parmed.Structure`, `htmd.Molecule` or derived class of `nglview.Trajectory`\n\n# change representation\nview[0].add_cartoon(...) # equal to view.add_cartoon(component=0)\nview[1].add_licorice(...) # equal to view.add_licorice(component=1)\n```\n\nAdd extra component\n-------------------\n\n```python\n# Density volumes (MRC/MAP/CCP4, DX/DXBIN, CUBE)\n# Or adding derived class of `nglview.Structure`\nview.add_component('my.ccp4')\n\n# add component from url\nview.add_component('rcsb://1tsu.pdb')\n# NOTE: Trajectory is a special case of component.\n```\n\nMouse\n-----\n```python\n# coot mouse style (https://en.wikipedia.org/wiki/Coot_(software))\nview.stage.set_parameters(mouse_preset='coot')\n```\n\nInteraction controls\n--------------------\n- [Mouse](https://github.com/arose/ngl/blob/master/docs/usage/interaction-controls.md#mouse)\n- [Keyboard](https://github.com/arose/ngl/blob/master/docs/usage/interaction-controls.md#keyboard)\n\n\nMovie making\n------------\n\nRequire: moviepy (`pip install moviepy`)\n\n```python\nfrom nglview.contrib.movie import MovieMaker\nmovie = MovieMaker(view, output='my.gif', in_memory=True)\nmovie.make()\n```\n\nEmbed widget\n------------\n[embed](docs/embed.md)\n\nAPI doc\n=======\n- [Latest version](http://nglviewer.github.io/nglview/latest/api.html)\n- [All releases versions](http://nglviewer.github.io/nglview/release/index.html)\n- [Development version](http://nglviewer.github.io/nglview/dev/api.html)\n\nCommand line\n============\n\n```bash\n\n# open a notebook and import nglview\nnglview\n\n# Require installing pytraj (PR for other backends is welcome)\n# open notebook, load `my.pdb` to pytraj's trajectory then display `view`\nnglview my.pdb\n\n# load density data\nnglview my.ccp4\n\n# open notebook, create trajectory with given topology `my.parm7` and trajecotry file `traj.nc`,\n# then display `view`\nnglview my.parm7 -c traj.nc\n\n# load all trajectories with filename ending with 'nc'\n# make sure to use quote \" \"\nnglview my.parm7 -c \"*.nc\"\n\n# open notebook, copy content from `myscript.py`\nnglview myscript.py\n\n# create a remote notebook\n# just follow its instruction\nnglview my.pdb --remote\nnglview my.parm7 -c traj.nc --remote\nnglview mynotebook.ipynb --remote\n\n# demo (don't need pytraj)\nnglview demo\n\n# specify web browser\nnglview my.pdb --browser=google-chrome\n```\n\nFAQ\n===\n\n[Q&A](docs/FAQ.md)\n\nWebsite\n=======\n\n- http://nglviewer.github.io/nglview/latest\n- http://nglviewer.github.io/nglview/dev\n\nTalks\n=====\n[Talks about NGL and nglview](./talks.md)\n\nContributing\n============\n\n[Join us here](./CONTRIBUTING.md)\n\nProjects integrating NGLView\n============================\n\n(Feel free to make a PR to add/remove your project here. Thanks.)\n\n- [AMBER](http://ambermd.org/) - A package of programs for molecular dynamics simulations of proteins and nucleic acids\n- [mbuild](https://github.com/iModels/mbuild) - A hierarchical, component based molecule builder\n- [deepchem](https://github.com/deepchem/deepchem) - Deep-learning models for Drug Discovery and Quantum Chemistry\n- [htmd](https://github.com/Acellera/htmd) - High throughput molecular dynamics simulations\n- [Moleidoscope](https://github.com/kbsezginel/Moleidoscope) - Molecular kaleidoscope\n- [ssbio](https://github.com/nmih/ssbio) - Tools for enabling structural systems biology\n- [hublib](https://github.com/martin-hunt/hublib) - hublib is a Python library for the [HUBzero](https://hubzero.org/) science gateway platform.\n- [molPX](https://github.com/markovmodel/molPX): ipython API to visualize MD-trajectories along projected trajectories\n- [nanoribbon](https://github.com/oschuett/nanoribbon)\n- [ase](https://github.com/rosswhitfield/ase): Atomic Simulation Environment\n- [pida](https://github.com/jharman25/pida): Software for analyzing multiple protein-protein interaction docking solutions,\n- [pytim](https://github.com/Marcello-Sega/pytim)\n- [MobleyLab/drug-computing](https://github.com/MobleyLab/drug-computing) Educational materials for, and related to, UC Irvine's Drug Discovery Computing Techniques course.\n- [pyiron](https://pyiron.github.io/): an integrated development environment for implementing, testing, and running simulations in computational materials science.\n- [BioSimSpace](https://biosimspace.org/): An interoperable framework for biomolecular simulation\n- [pyrod](https://github.com/schallerdavid/pyrod): PyRod - Tracing water molecules in molecular dynamics simulations\n- [kugupu](https://github.com/kugupu/kugupu): kugupu - a molecular network generator to study charge transport pathways in amorphous materials\n- [pnab](https://github.com/alenaizan/pnab): proto-Nucleic Acid Builder\n- [opencadd](https://github.com/volkamerlab/opencadd): A Python library for structural cheminformatics\n- [teachopencadd](https://github.com/volkamerlab/teachopencadd): TeachOpenCADD: a teaching platform for computer-aided drug design (CADD) using open source packages and data\n- [query.libretexts.org](https://query.libretexts.org/Sandboxes/jupyterteam@ucdavis.edu): query.libretexts.org\n- [datamol](https://github.com/datamol-org/datamol): A python library to work with molecules.\n- [dynophores](https://github.com/dominiquesydow/dynophores): Dynamic pharmacophore modeling of molecular interactions\n- [pychemcurv](https://github.com/gVallverdu/pychemcurv): Discrete and local curvature applied to chemistry and chemical reactivity\n- [AutoSolvate](https://github.com/Liu-group/AutoSolvate): Automated workflow for generating quantum chemistry calculation of explicitly solvated molecules\n- [plipify](https://github.com/volkamerlab/plipify): PLIPify: Protein-Ligand Interaction Frequencies across Multiple Structures\n- [Melodia](https://github.com/rwmontalvao/Melodia): Differential Geometry of Proteins Backbones\n- [pyrosetta_viewer3d](https://github.com/RosettaCommons/pyrosetta_viewer3d): Display PackedPose objects, Pose objects, or PDB files within a Jupyter notebook and Google Colab\n- [py4vasp](https://vasp.at/py4vasp): Python interface for VASP\n- [eminus](https://github.com/wangenau/eminus): A plane wave density functional theory code.\n- [MolSysMT](https://github.com/uibcdf/MolSysMT): Molecular Systems Multi-Tool\n\nAcknowledgment\n==============\n- Funding: Hai Nguyen is supported by NIH Grant GM103297, \"The Center for HIV RNA Studies\" (2015 to 02-2017).\n- Many thanks to `nglview` [contributors](https://github.com/arose/nglview/graphs/contributors)\n- [dunovank/jupyter-themes](https://github.com/dunovank/jupyter-themes): for `oceans16` theme\n- [base64-arraybuffer](https://github.com/niklasvh/base64-arraybuffer)\n- [ipywidgets](https://github.com/jupyter-widgets/ipywidgets)\n\nCite\n====\nIf you would like to acknowledge our work, feel free to cite:\n\nHai Nguyen, David A Case, Alexander S Rose; NGLview - Interactive molecular graphics for Jupyter notebooks, Bioinformatics, , btx789, https://doi.org/10.1093/bioinformatics/btx789\n\nLicense\n=======\n\nGenerally MIT, see the LICENSE file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "IPython widget to interactively view molecular structures and trajectories.",
"version": "3.1.4",
"project_urls": {
"Homepage": "https://github.com/arose/nglview"
},
"split_keywords": [
"ipython",
" jupyter",
" widgets"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "55febd1c2aaa7e38055116e22467ccbc3600936d977afddf91ec049ee900c909",
"md5": "362884d38327d3262aa7463d032d6bf0",
"sha256": "e12b725c92add01174a933899db84bd63beba266d8fa9c3d2926ea453fa0829d"
},
"downloads": -1,
"filename": "nglview-3.1.4.tar.gz",
"has_sig": false,
"md5_digest": "362884d38327d3262aa7463d032d6bf0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 21897115,
"upload_time": "2024-11-25T05:49:23",
"upload_time_iso_8601": "2024-11-25T05:49:23.046027Z",
"url": "https://files.pythonhosted.org/packages/55/fe/bd1c2aaa7e38055116e22467ccbc3600936d977afddf91ec049ee900c909/nglview-3.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-25 05:49:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "arose",
"github_project": "nglview",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"circle": true,
"lcname": "nglview"
}