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", no_boxchk=True)

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

In [3]:
shifts = md.nmr.chemical_shifts_spartaplus(trj)
shifts[0:10]
/home/travis/miniconda3/envs/py27/lib/python2.7/site-packages/mdtraj/nmr/shift_wrappers.py:302: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators; you can avoid this warning by specifying engine='python'.
  d = pd.read_table("./trj%d_pred.tab" % i, names=names, header=None, sep="\s*", skiprows=lines_to_skip)
/home/travis/miniconda3/envs/py27/lib/python2.7/site-packages/mdtraj/nmr/shift_wrappers.py:309: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  results.name[results.name == "HN"] = "H"
Out[3]:
frame 0 1 2
resSeq name
41 C 176.357 176.357 176.357
CA 55.342 55.342 55.342
CB 32.633 32.633 32.633
HA 4.529 4.529 4.529
42 C 176.712 176.712 176.712
CA 55.349 55.349 55.349
CB 41.825 41.825 41.825
H 8.738 8.738 8.738
HA 4.518 4.518 4.518
N 126.258 126.258 126.258

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.

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

Versions