try pytraj online:

http://mybinder.org/badge.svg

Nucleic acid torsion angle distributionΒΆ

../_images/chi_nucleic_analysis.png chi_nucleic_analysis
In [1]:
%matplotlib inline

# need: matplotlib, seaborn
# how? `conda install matplotlib seaborn`
In [2]:
# for this example, we only compute chi value for first 1000 frames
traj = pt.iterload('GAAC3.5000frames.nc', 'GAAC.topo', frame_slice=(0, 1000))
traj
Out[2]:
<pytraj.TrajectoryIterator, 1000 frames, include:
<Topology: 58329 atoms, 19202 residues, 19168 mols, PBC with box type = ortho>>
           
In [3]:
chi = pt.calc_chin(traj, resrange=[10,], dtype='ndarray')
chi
Out[3]:
array([-105.83852039,  -93.26249778,  -96.61443972, ..., -102.04455854,
        -92.59667708,  -83.91612781])
In [4]:
# plot time series
from matplotlib import pyplot as plt

# turn off warning for pretty notebook
import warnings
warnings.filterwarnings('ignore')

plt.plot(chi)
plt.xlabel('frame number')
plt.ylabel('chi (degree)')
Out[4]:
<matplotlib.text.Text at 0x2aaad4ee7b70>
In [5]:
# Distribution plot
# require: seaborn, statsmodels
import seaborn as sb

# Plot a historgram and kernel density estimate
sb.distplot(chi, color="m")
plt.ylabel('P')
plt.xlabel('chi (degree)')
Out[5]:
<matplotlib.text.Text at 0x2aaadc3aa400>