pytraj.
nastruct
(traj=None, ref=0, resrange=None, resmap=None, hbcut=3.5, frame_indices=None, pucker_method='altona', dtype='nupars', baseref=None, groove_3dna=True, top=None)¶compute nucleic acid parameters. (adapted from cpptraj doc)
Parameters: | traj : Trajectory-like ref : {Frame, int}, default 0 (first frame) resrange : None, str or array-like of integers resmap : residue map, example: ‘AF2:A’ hbcut : float, default=3.5 Angstrong
pucker_method : str, {‘altona’, ‘cremer’}, default ‘altona’
frame_indices : array-like, default None (all frames) baseref : {None, str}, default None
groove_3dna : bool, default True
dtype : str, {‘nupars’, ‘cpptraj_dataset’}, default ‘nupars’ |
---|---|
Returns: | out : nupars object. One can assess different values (major groove width, xdips values ...) by accessing its attribute. See example below. |
Examples
>>> import pytraj as pt
>>> import numpy as np
>>> traj = pt.datafiles.load_rna()
>>> data = pt.nastruct(traj, groove_3dna=False)
>>> data.keys()[:5]
['buckle', 'minor', 'major', 'xdisp', 'stagger']
>>> # get minor groove width values for each pairs for each snapshot
>>> # data.minor is a tuple, first value is a list of basepairs, seconda value is
>>> # numpy array, shape=(n_frames, n_pairs)
>>> data.minor
(['1G16C', '2G15C', '3G14C', '4C13G', '5G12C', '6C11G', '7C10G', '8C9G'],
array([[ 13.32927036, 13.403409 , 13.57159901, ..., 13.26655865,
13.43054485, 13.4557209 ],
[ 13.32002068, 13.45918751, 13.63253593, ..., 13.27066231,
13.42743683, 13.53450871],
[ 13.34087658, 13.53778553, 13.57062435, ..., 13.29017353,
13.38542843, 13.46101475]]))
>>> data.twist
(['1G16C-2G15C', '2G15C-3G14C', '3G14C-4C13G', '4C13G-5G12C', '5G12C-6C11G', '6C11G-7C10G', '7C10G-8C9G'],
array([[ 34.77773666, 33.98158646, 30.18647003, ..., 35.14608765,
33.9628334 , 33.13056946],
[ 33.39176178, 32.68476105, 28.36385536, ..., 36.59774399,
30.20827484, 26.48732948],
[ 36.20665359, 32.58955002, 27.47707367, ..., 33.42843246,
30.90047073, 33.73724365]]))
>>> # change dtype
>>> data = pt.nastruct(traj, dtype='cpptraj_dataset')
In [1]: import pytraj as pt
In [2]: traj = pt.iterload('data/adh026.3.pdb')
In [3]: traj
Out[3]:
pytraj.TrajectoryIterator, 3 frames:
Size: 0.000035 (GB)
<Topology: 518 atoms, 16 residues, 2 mols, non-PBC>
# check unique residue names
In [4]: traj.top.residue_names