AMBER Tutorial

Interactive data analysis with NGLView, pytraj and Jupyter notebook

By Hai Nguyen (BSD 2-clause)

What is NGLView?

NGLView is a viewer for molecular structures and trajectories in Jupyter notebook.

Requirement

  • AmberTools >= 16
  • If you allow AMBER to install Python distribution from Miniconda, you have most needed packages (except NGLView) for this tutorial.
  • If not, you need to install (either using pip or conda)
    conda install jupyter notebook
    
  • Install NGLView development version:
    amber.conda install nglview==0.5.1 -c ambermd
    
  • You know how to use Linux command line. If not, please check basic AMBER tutorial
  • You know how to open a Jupyter notebook

How to follow this tutorial?

  • Open notebook
    amber.jupyter notebook notebook.ipynb
     # where notebook.ipynb is the name of this notebook
    
  • Just copy and paste commands to your notebook, then hit "Ctrl-Enter"

  • Files: tutorial_files.zip

Example: View a single pdb file

In [1]:
import warnings
warnings.filterwarnings('ignore') # make the notebook nicer
from __future__ import print_function

import pytraj as pt
import nglview as nv

print("nglview version = {}".format(nv.__version__))
print("pytraj version = {}".format(pt.__version__))

traj = pt.load('data/wt1mg.pdb')
view = nv.show_pytraj(traj)
view
nglview version = 0.5.1
pytraj version = 1.0.4

You should expect to see

In [2]:
view.render_image()
In [3]:
view._display_image()
Out[3]: