Measurement Tools¶
This module defines a class and methods and for comparing coordinate data and measuring quantities.

buildDistMatrix
(atoms1, atoms2=None, unitcell=None, format='mat')[source]¶ Returns distance matrix. When atoms2 is given, a distance matrix with shape
(len(atoms1), len(atoms2))
is built. When atoms2 is None, a symmetric matrix with shape(len(atoms1), len(atoms1))
is built. If unitcell array is provided, periodic boundary conditions will be taken into account.Parameters:  atoms1 (
Atomic
,numpy.ndarray
) – atom or coordinate data  atoms2 (
Atomic
,numpy.ndarray
) – atom or coordinate data  unitcell (
numpy.ndarray
) – orthorhombic unitcell dimension array with shape(3,)
 format (bool) – format of the resulting array, one of
'mat'
(matrix, default),'rcd'
(arrays of row indices, column indices, and distances), or'arr'
(only array of distances)
 atoms1 (

calcDistance
(atoms1, atoms2, unitcell=None)[source]¶ Returns the Euclidean distance between atoms1 and atoms2. Arguments may be
Atomic
instances or NumPy arrays. Shape of numpy arrays must be([M,]N,3)
, where M is number of coordinate sets and N is the number of atoms. If unitcell array is provided, periodic boundary conditions will be taken into account.Parameters:

calcCenter
(atoms, weights=None)[source]¶ Returns geometric center of atoms. If weights is given it must be a flat array with length equal to number of atoms. Mass center of atoms can be calculated by setting weights equal to atom masses, i.e.
weights=atoms.getMasses()
.

calcAngle
(atoms1, atoms2, atoms3, radian=False)[source]¶ Returns the angle between atoms in degrees.

calcDihedral
(atoms1, atoms2, atoms3, atoms4, radian=False)[source]¶ Returns the dihedral angle between atoms in degrees.

calcOmega
(residue, radian=False, dist=4.1)[source]¶ Returns ω (omega) angle of residue in degrees. This function checks the distance between Cα atoms of two residues and raises an exception if the residues are disconnected. Set dist to None, to avoid this.

calcPhi
(residue, radian=False, dist=4.1)[source]¶ Returns φ (phi) angle of residue in degrees. This function checks the distance between Cα atoms of two residues and raises an exception if the residues are disconnected. Set dist to None, to avoid this.

calcPsi
(residue, radian=False, dist=4.1)[source]¶ Returns ψ (psi) angle of residue in degrees. This function checks the distance between Cα atoms of two residues and raises an exception if the residues are disconnected. Set dist to None, to avoid this.

calcMSF
(coordsets)[source]¶ Calculate mean square fluctuation(s) (MSF). coordsets may be an instance of
Ensemble
,TrajBase
, orAtomic
. For trajectory objects, e.g.DCDFile
, frames will be considered after they are superposed. For other ProDy objects, coordinate sets should be aligned prior to MSF calculation.Note that using trajectory files that store 32bit coordinate will result in lower precision in calculations. Over 10,000 frames this may result in up to 5% difference from the values calculated using 64bit arrays. To ensure higherprecision calculations for
DCDFile
instances, you may use astype argument, i.e.astype=float
, to auto recast coordinate data to doubleprecision (64bit) floatingpoint format.

calcRMSF
(coordsets)[source]¶ Returns root mean square fluctuation(s) (RMSF). coordsets may be an instance of
Ensemble
,TrajBase
, orAtomic
. For trajectory objects, e.g.DCDFile
, frames will be considered after they are superposed. For other ProDy objects, coordinate sets should be aligned prior to MSF calculation.Note that using trajectory files that store 32bit coordinate will result in lower precision in calculations. Over 10,000 frames this may result in up to 5% difference from the values calculated using 64bit arrays. To ensure higherprecision calculations for
DCDFile
instances, you may use astype argument, i.e.astype=float
, to auto recast coordinate data to doubleprecision (64bit) floatingpoint format.

calcDeformVector
(from_atoms, to_atoms, weights=None)[source]¶ Returns deformation from from_atoms to atoms_to as a
Vector
instance.

buildADPMatrix
(atoms)[source]¶ Returns a 3Nx3N symmetric matrix containing anisotropic displacement parameters (ADPs) along the diagonal as 3x3 super elements.
In [1]: from prody import * In [2]: protein = parsePDB('1ejg') In [3]: calphas = protein.select('calpha') In [4]: adp_matrix = buildADPMatrix(calphas)

calcADPAxes
(atoms, **kwargs)[source]¶ Returns a 3Nx3 array containing principal axes defining anisotropic displacement parameter (ADP, or anisotropic temperature factor) ellipsoids.
Parameters:  atoms (
Atomic
) – a ProDy object for handling atomic data  fract (float) – For an atom, if the fraction of anisotropic displacement explained by its largest axis/eigenvector is less than given value, all axes for that atom will be set to zero. Values larger than 0.33 and smaller than 1.0 are accepted.
 ratio2 (float) – For an atom, if the ratio of the secondlargest eigenvalue to the largest eigenvalue axis less than or equal to the given value, all principal axes for that atom will be returned. Values less than 1 and greater than 0 are accepted.
 ratio3 (float) – For an atom, if the ratio of the smallest eigenvalue to the largest eigenvalue is less than or equal to the given value, all principal axes for that atom will be returned. Values less than 1 and greater than 0 are accepted.
 ratio (float) – Same as ratio3.
Keyword arguments fract, ratio2, or ratio3 can be used to set principal axes to 0 for atoms showing relatively lower degree of anisotropy.
3Nx3 axis contains N times 3x3 matrices, one for each given atom. Columns of these 3x3 matrices are the principal axes which are weighted by square root of their eigenvalues. The first columns correspond to largest principal axes.
The direction of the principal axes for an atom is determined based on the correlation of the axes vector with the principal axes vector of the previous atom.
In [1]: from prody import * In [2]: protein = parsePDB('1ejg') In [3]: calphas = protein.select('calpha') In [4]: adp_axes = calcADPAxes( calphas ) In [5]: adp_axes.shape Out[5]: (138, 3)
These can be written in NMD format as follows:
In [6]: nma = NMA('ADPs') In [7]: nma.setEigens(adp_axes) In [8]: nma Out[8]: <NMA: ADPs (3 modes; 46 atoms)> In [9]: writeNMD('adp_axes.nmd', nma, calphas) Out[9]: 'adp_axes.nmd'
 atoms (

calcADPs
(atom)[source]¶ Calculate anisotropic displacement parameters (ADPs) from anisotropic temperature factors (ATFs).
atom must have ATF values set for ADP calculation. ADPs are returned as a tuple, i.e. (eigenvalues, eigenvectors).

pickCentral
(obj, weights=None)[source]¶ Returns
Atom
orConformation
that is closest to the center of obj, which may be anAtomic
orEnsemble
instance. See alsopickCentralAtom()
, andpickCentralConf()
functions.

pickCentralAtom
(atoms, weights=None)[source]¶ Returns
Atom
that is closest to the center, which is calculated usingcalcCenter()
.