Two following input files are required in this tutorial
L-BP_cdna.dat
L-BPS_cdna.dat
L-BPH_cdna.dat
HelAxis_cdna.dat
MGroove_cdna.dat
BackBoneCHiDihedrals_cdna.dat
These files should be present inside tutorial_data of the current/present working directory.
do_x3dna
is executed with -ref
option.
In [1]:
import os
import numpy as np
import matplotlib.pyplot as plt
import dnaMD
%matplotlib inline
try:
os.remove('cdna.h5')
except:
pass
To store the data in HDF5 file, just initialize the class with the filename as shown below. Here, we named the HDF5 file as cdna.h5
.
NOTE: Except initialization, all other methods and functions can be used in similar ways.
In [2]:
# Initialization
dna = dnaMD.DNA(60, filename='cdna.h5') #Initialization for 60 base-pairs DNA bound with the protein
No extra step neccessary to store the data in HDF5 file. Just read the parameters from do_x3dna output files as described in previous tutorials.
In [3]:
# Read Local base-pair parameters
dna.set_base_pair_parameters('tutorial_data/L-BP_cdna.dat', bp=[1, 60], bp_range=True)
# Read Local base-step parameters
dna.set_base_step_parameters('tutorial_data/L-BPS_cdna.dat', bp_step=[1, 59], parameters='All', step_range=True)
# Read Local helical base-step parameters
dna.set_base_step_parameters('tutorial_data/L-BPH_cdna.dat', bp_step=[1, 59], parameters='All', step_range=True, helical=True)
# Read Helical axis
dna.set_helical_axis('tutorial_data/HelAxis_cdna.dat')
# Generate global axis by interpolation (smoothening)
dna.generate_smooth_axis(smooth=500, spline=3, fill_point=6)
# Calculate curvature and tangent along global helical axis
dna.calculate_curvature_tangent(store_tangent=True)
# Major and minor grooves
parameters = [ 'minor groove', 'minor groove refined', 'major groove', 'major groove refined' ]
dna.set_major_minor_groove('tutorial_data/MGroove_cdna.dat', bp_step=[1, 59], parameters=parameters, step_range=True)
#Backbone dihedrals
dna.set_backbone_dihedrals('tutorial_data/BackBoneCHiDihedrals_cdna.dat', bp=[2, 59], parameters='All', bp_range=True)
As shown previously here, data can be extracted from HDF5 by same way as shown in the following.
Also, see that plot is similar.
Note that in this case, data is read from the HDF5 file, while in the previous tutorial, data was stored in memory (RAM).
In [4]:
# Extracting "Shear" of 22nd bp
shear_20bp = dna.data['bp']['22']['shear']
#Shear vs Time for 22nd bp
plt.title('22nd bp')
plt.plot(dna.time, shear_20bp)
plt.xlabel('Time (ps)')
plt.ylabel('Shear ($\AA$)')
plt.show()
As shown previously here), smae method (dnaMD.DNA.time_vs_parameter(...)) can be used to get parameter values as a function of time.
Also, see that plot is similar.
Note that in this case, data is read from the HDF5 file, while in the previous tutorial, data was stored in memory (RAM).
In [6]:
# Rise vs Time for 25-40 bp segment
plt.title('Rise for 25-40 bp segment')
# Rise is the distance between two base-pairs, so for a given segment it is sum over the base-steps
time, value = dna.time_vs_parameter('rise', [25, 40], merge=True, merge_method='sum')
plt.plot(time, value, label='bound DNA', c='k')
plt.xlabel('Time (ps)')
plt.ylabel('Rise ( $\AA$)')
plt.legend()
plt.show()
In [ ]: