Baker-Hubbard Hydrogen Bond IdentificationΒΆ

hbonds_evaluated
In [1]:
%pylab inline
import itertools
import mdtraj as md
import mdtraj.testing
Populating the interactive namespace from numpy and matplotlib

In [2]:
# Load up some example data. This is a little 20 frame PDB, straight
# from the RCSB
path = mdtraj.testing.get_fn('2EQQ.pdb')
t = md.load(path)
print t
<mdtraj.Trajectory with 20 frames, 423 atoms, 28 residues, and unitcells>

In [3]:
# :func:`md.baker_hubbard` idenfies hydrogen bonds baced on cutoffs
# for the Donor-H...Acceptor distance and angle. The criterion employed
# is :math:`\theta > 120` and :math:`r_\text{H...Acceptor} < 2.5 A` in
# at least 10% of the trajectory. The return value is a list of the 
# indices of the atoms (donor, h, acceptor) that satisfy this criteria.

hbonds = md.baker_hubbard(t)
label = lambda hbond : '%s -- %s' % (t.topology.atom(hbond[0]), t.topology.atom(hbond[2]))
for hbond in hbonds:
    print label(hbond)
GLU1-N -- GLU1-OE2
GLU1-N -- GLU1-OE1
GLY6-N -- SER4-O
CYS7-N -- GLY5-O
TYR11-N -- VAL8-O
MET12-N -- LYS20-O
ARG13-NH1 -- TYR11-O
THR14-N -- ARG18-O
ASP16-N -- ASP16-OD1
GLY17-N -- THR14-O
ARG18-N -- THR14-OG1
ARG18-NE -- ASP16-OD2
LYS20-N -- MET12-O
THR22-N -- GLY10-O
THR14-OG1 -- ASP16-OD1
THR28-OG1 -- ILE27-O

In [4]:
# Let's compute the actual distances between the donors and acceptors

da_distances = md.compute_distances(t, hbonds[:, [0,2]], periodic=False)
In [5]:
# Plot a histogram for a few of them
figure()
color = itertools.cycle(['r', 'b', 'gold'])
for i in [2, 3, 4]:
    hist(da_distances[:, i], color=next(color), label=label(hbonds[i]), alpha=0.5)
ylabel('Freq');
legend()
pp.xlabel('Donor-acceptor distance [nm]')
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-5-a6171a4cb1ac> in <module>()
      6 ylabel('Freq');
      7 legend()
----> 8 pp.xlabel('Donor-acceptor distance [nm]')

NameError: name 'pp' is not defined
In [6]:
 

(hbonds.ipynb; hbonds_evaluated.ipynb; hbonds.py)

Versions