Calculating NMR observables with mdtraj.nmr()ΒΆ

MDTraj provides convenience functions for predicting various NMR observables such as chemical shifts. To do this, we provide wrapper functions for the SPARTA+, PPM, and ShiftX2 prediction algorithms.

In [1]:
%matplotlib inline
import mdtraj as md

Let's load a simple trajectory containing three identical frames of the villin headpiece protein.

In [2]:
trj = md.load("1vii_3frames.pdb")
/home/travis/miniconda3/envs/py27/lib/python2.7/site-packages/mdtraj/formats/pdb/pdbfile.py:193: UserWarning: Unlikely unit cell vectors detected in PDB file likely resulting from a dummy CRYST1 record. Discarding unit cell vectors.
  warnings.warn('Unlikely unit cell vectors detected in PDB file likely '

Now, let's calculate the chemical shifts with the program SPARTA+.

In [3]:
shifts = md.nmr.chemical_shifts_spartaplus(trj)
shifts[0:10]
##############################################################################

The code at shift_wrappers.py:280 requires the "pandas" package, which is
an open source, BSD-licensed library providing high-performance, easy-to-use
data structures and data analysis tools for the Python programming language.

pandas can be downloaded from https://pypi.python.org/pypi/pandas or installed
with the python "easy_install" or "pip" package managers using:

# easy_install pandas
or
# pip install pandas

##############################################################################
---------------------------------------------------------------------------
DelayImportError                          Traceback (most recent call last)
<ipython-input-3-622189b941f2> in <module>()
----> 1 shifts = md.nmr.chemical_shifts_spartaplus(trj)
      2 shifts[0:10]

/home/travis/miniconda3/envs/py27/lib/python2.7/site-packages/mdtraj/nmr/shift_wrappers.pyc in chemical_shifts_spartaplus(trj, rename_HN)
    278        J. Biomol. NMR, 48, 13-22 (2010)
    279     """
--> 280     pd = import_('pandas')
    281     binary = find_executable(SPARTA_PLUS)
    282     if binary is None:

/home/travis/miniconda3/envs/py27/lib/python2.7/site-packages/mdtraj/utils/delay_import.pyc in import_(module)
    196         print(m, file=sys.stderr)
    197         print(bar, file=sys.stderr)
--> 198         raise DelayImportError(m)

DelayImportError: 
The code at shift_wrappers.py:280 requires the "pandas" package, which is
an open source, BSD-licensed library providing high-performance, easy-to-use
data structures and data analysis tools for the Python programming language.

pandas can be downloaded from https://pypi.python.org/pypi/pandas or installed
with the python "easy_install" or "pip" package managers using:

# easy_install pandas
or
# pip install pandas

The data is returned as a Pandas Dataframe object. The rows correspond to the residue numbers and atom names, while each column corresponds to a different frame in your trajectory. Note that here our input had completely identical conformations in each frame, so we see identical values along each row.

In [4]:
 

(nmr.ipynb; nmr_evaluated.ipynb; nmr.py)

Versions