%load_ext autoreload
%autoreload 2
The autoreload extension is already loaded. To reload it, use: %reload_ext autoreload
from importlib import reload
import DNAtools
reload(DNAtools)
<module 'DNAtools' from '/home/_shared/package_dev/DNAtools/DNAtools/__init__.py'>
#!wget https://files.rcsb.org/view/1KX5.pdb
a=DNAtools.X3DNA_find_pair('1KX5.pdb')
created temporary directory /tmp/tmp6_j36wte Writing coords to input.pdb OUT: ERR: handling file <input.pdb> Time used: 00:00:00:00
ref=DNAtools.X3DNA_find_pair('1KX5.pdb')
created temporary directory /tmp/tmpzbwjslbm Writing coords to input.pdb OUT: ERR: handling file <input.pdb> Time used: 00:00:00:01
df=DNAtools.X3DNA_analyze('1KX5.pdb',ref)
Running findpair on the original input created temporary directory /tmp/tmp0alrk1_a Writing coords to input.pdb OUT: ERR: handling file <input.pdb> Time used: 00:00:00:00 created temporary directory /tmp/tmp6b39htrm Writing coords to input.pdb Writing provided find pair file Writing new find pair file OUT: ......Processing structure #1: <output>...... [i] missing ' P ' atom : residue name ' DA', chain I, number [ -73 ] [i] missing ' OP1' atom : residue name ' DA', chain I, number [ -73 ] [i] missing ' OP2' atom : residue name ' DA', chain I, number [ -73 ] [i] missing ' P ' atom : residue name ' DA', chain J, number [ -73 ] [i] missing ' OP1' atom : residue name ' DA', chain J, number [ -73 ] [i] missing ' OP2' atom : residue name ' DA', chain J, number [ -73 ] [i] missing ' P ' atom : residue name ' DA', chain I, number [ -73 ] [i] missing ' P ' atom : residue name ' DA', chain J, number [ -73 ] Time used: 00:00:00:00 Processing /tmp/tmp6b39htrm/ref_frames.dat Processing /tmp/tmp6b39htrm/bp_step.par Reference BP list [] Current BP list [] OUT: b'' b'\nTime used: 00:00:00:00\n'
df
x | y | z | BPname | Shear | Stretch | Stagger | Buckle | Prop-Tw | Opening | ... | v1_2 | v2_2 | v3_2 | v4_2 | tm_2 | P_2 | Puckering_2 | ssZp_2 | Dp_2 | BPnum | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 22.1666 | 138.3645 | 19.4060 | A-T | -0.324 | -0.578 | -0.336 | -3.796 | 4.482 | -0.730 | ... | 26.7 | -34.8 | 31.6 | -15.6 | 35.0 | 187.1 | C3'-exo | --- | --- | 1 |
1 | 19.7852 | 136.3331 | 18.5373 | T-A | -0.541 | -0.144 | -0.640 | 6.210 | -10.273 | -2.306 | ... | 32.6 | -31.3 | 19.8 | 0.5 | 33.2 | 160.5 | C2'-endo | 2.33 | 2.27 | 2 |
2 | 18.4681 | 133.0477 | 18.8262 | C-G | -0.142 | -0.030 | -0.364 | 2.765 | -4.612 | 1.046 | ... | 43.0 | -34.2 | 14.9 | 12.2 | 42.1 | 144.4 | C2'-endo | 2.35 | 2.26 | 3 |
3 | 16.7463 | 130.1687 | 18.7765 | A-T | 0.066 | -0.106 | -0.326 | 7.185 | -14.350 | 5.752 | ... | 33.9 | -24.9 | 7.8 | 14.0 | 33.8 | 137.5 | C1'-exo | 1.94 | 2.19 | 4 |
4 | 15.0555 | 127.3319 | 18.4452 | A-T | -0.003 | -0.100 | 0.191 | 3.607 | -10.754 | 1.667 | ... | 32.0 | -27.6 | 14.2 | 6.2 | 31.8 | 150.5 | C2'-endo | 1.64 | 2.11 | 5 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
142 | 82.3838 | 118.7939 | -12.7824 | T-A | 0.101 | -0.133 | 0.131 | -2.372 | -16.606 | 4.162 | ... | 35.8 | -31.9 | 17.5 | 5.1 | 35.7 | 153.4 | C2'-endo | 1.82 | 2.06 | 143 |
143 | 81.4247 | 121.7625 | -13.2160 | T-A | 0.060 | -0.131 | -0.205 | 0.944 | -9.836 | 1.560 | ... | 29.8 | -31.4 | 22.4 | -4.0 | 32.0 | 168.4 | C2'-endo | 1.63 | 1.97 | 144 |
144 | 79.6564 | 124.7293 | -14.3770 | G-C | -0.208 | -0.224 | -0.754 | -3.159 | 0.028 | -2.537 | ... | 42.6 | -37.2 | 20.4 | 6.4 | 41.9 | 152.5 | C2'-endo | 2.10 | 1.92 | 145 |
145 | 79.3453 | 127.9819 | -14.4217 | A-T | 0.226 | -0.174 | -0.178 | 4.337 | -2.041 | -1.905 | ... | 28.8 | -30.2 | 21.7 | -3.8 | 30.9 | 168.5 | C2'-endo | 2.30 | 2.24 | 146 |
146 | 77.2924 | 130.4636 | -15.8293 | T-A | 0.332 | -0.217 | -0.476 | 8.898 | -2.664 | 4.651 | ... | 28.3 | -25.8 | 14.7 | 3.1 | 28.4 | 155.4 | C2'-endo | 3.12 | 2.60 | 147 |
147 rows × 58 columns
ref=DNAtools.X3DNA_find_pair('1KX5.pdb')
df=DNAtools.X3DNA_analyze('1KX5.pdb',ref)
created temporary directory /tmp/tmp5dnd7vz3 Writing coords to input.pdb OUT: ERR: handling file <input.pdb> Time used: 00:00:00:01 Running findpair on the original input created temporary directory /tmp/tmpai631bx5 Writing coords to input.pdb OUT: ERR: handling file <input.pdb> Time used: 00:00:00:00 created temporary directory /tmp/tmpay316vnn Writing coords to input.pdb Writing provided find pair file Writing new find pair file OUT: ......Processing structure #1: <output>...... [i] missing ' P ' atom : residue name ' DA', chain I, number [ -73 ] [i] missing ' OP1' atom : residue name ' DA', chain I, number [ -73 ] [i] missing ' OP2' atom : residue name ' DA', chain I, number [ -73 ] [i] missing ' P ' atom : residue name ' DA', chain J, number [ -73 ] [i] missing ' OP1' atom : residue name ' DA', chain J, number [ -73 ] [i] missing ' OP2' atom : residue name ' DA', chain J, number [ -73 ] [i] missing ' P ' atom : residue name ' DA', chain I, number [ -73 ] [i] missing ' P ' atom : residue name ' DA', chain J, number [ -73 ] Time used: 00:00:00:00 Processing /tmp/tmpay316vnn/ref_frames.dat Processing /tmp/tmpay316vnn/bp_step.par Reference BP list [] Current BP list [] OUT: b'' b'\nTime used: 00:00:00:00\n'
df.iloc[:,1:20]
y | z | BPname | Shear | Stretch | Stagger | Buckle | Prop-Tw | Opening | Shift | Slide | Rise | Tilt | Roll | Twist | Pairing | chi_1 | A/S_1 | alpha_1 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 138.3645 | 19.4060 | A-T | -0.324 | -0.578 | -0.336 | -3.796 | 4.482 | -0.730 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | -121.9 | anti | --- |
1 | 136.3331 | 18.5373 | T-A | -0.541 | -0.144 | -0.640 | 6.210 | -10.273 | -2.306 | -0.873 | -0.607 | 3.070 | 2.354 | 0.785 | 32.522 | NaN | -105.4 | anti | -67.0 |
2 | 133.0477 | 18.8262 | C-G | -0.142 | -0.030 | -0.364 | 2.765 | -4.612 | 1.046 | 0.780 | 0.020 | 3.465 | -0.631 | 5.205 | 37.916 | NaN | -104.9 | anti | -60.4 |
3 | 130.1687 | 18.7765 | A-T | 0.066 | -0.106 | -0.326 | 7.185 | -14.350 | 5.752 | -0.171 | 0.126 | 3.348 | 1.728 | 6.594 | 30.949 | NaN | -98.5 | anti | -47.0 |
4 | 127.3319 | 18.4452 | A-T | -0.003 | -0.100 | 0.191 | 3.607 | -10.754 | 1.667 | -0.538 | 0.255 | 3.265 | -5.563 | 2.174 | 35.662 | NaN | -105.6 | anti | -39.7 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
142 | 118.7939 | -12.7824 | T-A | 0.101 | -0.133 | 0.131 | -2.372 | -16.606 | 4.162 | -0.293 | -0.630 | 3.245 | 0.285 | -0.532 | 32.207 | NaN | -109.3 | anti | -44.8 |
143 | 121.7625 | -13.2160 | T-A | 0.060 | -0.131 | -0.205 | 0.944 | -9.836 | 1.560 | 0.283 | -0.074 | 3.136 | 3.224 | 0.452 | 35.143 | NaN | -108.7 | anti | -50.5 |
144 | 124.7293 | -14.3770 | G-C | -0.208 | -0.224 | -0.754 | -3.159 | 0.028 | -2.537 | 1.070 | 0.474 | 3.451 | 6.453 | 4.023 | 33.410 | NaN | -94.6 | anti | -64.8 |
145 | 127.9819 | -14.4217 | A-T | 0.226 | -0.174 | -0.178 | 4.337 | -2.041 | -1.905 | -0.825 | -0.031 | 3.162 | -5.565 | 5.335 | 33.867 | NaN | -125.3 | anti | -44.0 |
146 | 130.4636 | -15.8293 | T-A | 0.332 | -0.217 | -0.476 | 8.898 | -2.664 | 4.651 | 0.894 | -0.966 | 3.259 | 2.007 | 2.211 | 33.877 | NaN | -126.7 | anti | 47.3 |
147 rows × 19 columns
### Let's remove Roll and Tilt from frist 20 bp steps
df.loc[1:20,'Roll']=0
df.loc[1:20,'Tilt']=0
df.loc[:,'Roll']
0 NaN 1 0.000 2 0.000 3 0.000 4 0.000 ... 142 -0.532 143 0.452 144 4.023 145 5.335 146 2.211 Name: Roll, Length: 147, dtype: float64
DNAtools.build_dna(df,'1KX5_20unw.pdb', new_seq=None)
created temporary directory /tmp/tmpwnz_mljz OUT: b'' b'' OUT: b'' b"O3' (#311) and P (#322) on chain A have distance 4.6 over 4.5: no linkage assigned\n\nTime used: 00:00:00:01\n"
import MDAnalysis as mda
from MDAnalysis.analysis import align
from MDAnalysis.analysis.rms import rmsd
import nglview as nv
nucl=mda.Universe("1KX5_20unw.pdb")
nv.show_mdanalysis(nucl,gui=False)
NGLWidget()
os.system("fiber -seq='AAAAAAAA' dna.pdb")
0
dna=mda.Universe("dna.pdb")
nv.show_mdanalysis(dna,gui=False)
NGLWidget()