Click Cell and then Run All
mybinder.org/repo/hainm/notebook-pytraj
conda install parmed -c ambermd # Python package for topology editing and force field development
conda install pytraj-dev -c ambermd # Python interface for cpptraj (MD trajectory data analysis)
conda install pysander -c ambermd # Python interface for SANDER
# all above will be also available in AMBER16 release (next few months)
conda install nglview -c ambermd # Protein/DNA/RAN viewer in notebook
# notebook
conda install jupyter notebook
In [1]:
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
warnings.filterwarnings("ignore", category=UserWarning)
import parmed as pmd
x = pmd.load_file('tz2.pdb')
[res.name for res in x.residues]
Out[1]:
In [2]:
[atom.name for atom in x.residues[0]]
Out[2]:
In [3]:
import pytraj as pt
traj = pt.load('tz2.nc', 'tz2.parm7')
distances = pt.distances(traj, ':1 :12', dtype='dataframe')
distances.head()
Out[3]:
In [4]:
%matplotlib inline
distances.hist()
Out[4]:
In [5]:
dihedrals = pt.multidihedral(traj, resrange='1-3', dtype='dataframe')
dihedrals.head(3) # show only first 3 snapshots
Out[5]:
In [6]:
%matplotlib inline
from matplotlib import pyplot as plt
plt.plot(dihedrals['phi_2'], dihedrals['psi_2'], '-bo', linewidth=0)
plt.xlim([-180, 180])
plt.ylim([-180, 180])
Out[6]:
In [7]:
help(pt.multidihedral)
In [8]:
import warnings
warnings.filterwarnings('ignore')
import nglview as nv
view = nv.show_pytraj(traj)
view
In [9]:
view.representations = []
view.add_representation('cartoon', color='residueindex')
view.add_representation('licorice')
In [10]:
t0 = pt.fetch_pdb('3pqr')
view0 = pt.view.to_nglview(t0)
view0
In [11]:
view0.representations = []
view0.add_representation('cartoon', selection='protein', color='residueindex')
view0.add_representation('surface', selection='protein', opacity='0.2')