Measurement Tools
This module defines a class and methods and for comparing coordinate data and measuring quantities.
- prody.measure.measure.assignBlocks(atoms, res_per_block=None, secstr=False, **kwargs)[source]
Assigns blocks to protein from atoms using a block size of res_per_block or secondary structure information if secstr is True.
Returns an array of block IDs and an AtomMap corresponding to protein atoms.
- Parameters:
atoms (
Atomic) – atoms to be assigned blocksres_per_block (int) – number of residues per block The last block may be smaller or larger than this. Default is None, allowing secstr to be used easily instead.
secstr (bool) – use secondary structure information to assign blocks. Default is False, allowing res_per_block to be used easily instead. Any set of strings that can be retrieved by
getSecstr()is acceptable including from PDB header, DSSP or STRIDE.shortest_block (int) – smallest number of residues to be included in a block before merging with the previous block Default is 4 as smaller numbers can cause problems for distance matrices.
longest_block (int) – largest number of residues to be included in a block before splitting it in half. Default is the length of the protein so it isn’t triggered.
min_dist_cutoff (Number) – minimum distance of a residue from others beyond which it is not included in the same block as them using
findSubgroups(). Default is 20 A, which was found to work well with *res_per_block*=10.
- prody.measure.measure.buildADPMatrix(atoms)[source]
Returns a 3Nx3N symmetric matrix containing anisotropic displacement parameters (ADPs) along the diagonal as 3x3 super elements.
- prody.measure.measure.buildDistMatrix(atoms1, atoms2=None, unitcell=None, format='mat', seqsep=None)[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 dataatoms2 (
Atomic,numpy.ndarray) – atom or coordinate dataunitcell (
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)seqsep (int) – if provided, distances will only be measured between atoms with resnum differences that are greater than or equal to seqsep.
- prody.measure.measure.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- Keyword Arguments:
fract – 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 – For an atom, if the ratio of the second-largest 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 – 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 – 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.
These can be written in NMD format as follows:
- prody.measure.measure.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).
- prody.measure.measure.calcAngle(atoms1, atoms2, atoms3, radian=False)[source]
Returns the angle between atoms in degrees.
- prody.measure.measure.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().
- prody.measure.measure.calcDeformVector(from_atoms, to_atoms, weights=None)[source]
Returns deformation from from_atoms to atoms_to as a
Vectorinstance.
- prody.measure.measure.calcDihedral(atoms1, atoms2, atoms3, atoms4, radian=False)[source]
Returns the dihedral angle between atoms in degrees.
- prody.measure.measure.calcDistance(atoms1, atoms2, unitcell=None)[source]
Returns the Euclidean distance between atoms1 and atoms2. Arguments may be
Atomicinstances 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:
atoms1 (
Atomic,numpy.ndarray) – atom or coordinate dataatoms2 (
Atomic,numpy.ndarray) – atom or coordinate dataunitcell (
numpy.ndarray) – orthorhombic unitcell dimension array with shape(3,)
- prody.measure.measure.calcDistanceMatrix(coords, cutoff=None)[source]
Calculate matrix of distances between coordinates within cutoff. Other matrix entries are set to maximum of calculated distances.
- prody.measure.measure.calcGyradius(atoms, weights=None)[source]
Calculate radius of gyration of atoms.
- prody.measure.measure.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 32-bit 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 64-bit arrays. To ensure higher-precision calculations for
DCDFileinstances, you may use astype argument, i.e.astype=float, to auto recast coordinate data to double-precision (64-bit) floating-point format.
- prody.measure.measure.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.
- prody.measure.measure.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.
- prody.measure.measure.calcPrincAxes(coords, turbo=True, return_vals=False)[source]
Calculate principal axes from coords
- prody.measure.measure.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.
- prody.measure.measure.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 32-bit 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 64-bit arrays. To ensure higher-precision calculations for
DCDFileinstances, you may use astype argument, i.e.astype=float, to auto recast coordinate data to double-precision (64-bit) floating-point format.
- prody.measure.measure.getAngle(coords1, coords2, coords3, radian=False)[source]
Returns bond angle in degrees unless
radian=True
- prody.measure.measure.getDihedral(coords1, coords2, coords3, coords4, radian=False)[source]
Returns the dihedral angle in degrees unless
radian=True.
- prody.measure.measure.pickCentral(obj, weights=None)[source]
Returns
AtomorConformationthat is closest to the center of obj, which may be anAtomicorEnsembleinstance. See alsopickCentralAtom(), andpickCentralConf()functions.
- prody.measure.measure.pickCentralAtom(atoms, weights=None)[source]
Returns
Atomthat is closest to the center, which is calculated usingcalcCenter().