Package schrodinger :: Package application :: Package desmond :: Package packages :: Module analysis
[hide private]
[frames] | no frames]

Module analysis

Classes and functions for trajectory-based analysis

Copyright Schrodinger, LLC. All rights reserved.

Classes [hide private]
  Pbc
  GeomAnalyzerBase
Base class of all geometry analyzer classes
  Distance
Calculate the distance between two atoms.
  Angle
Calculate the angle formed between three atoms.
  Torsion
Calculate the torsion formed between four atoms.
  CenterOf
N.B.: The calculated center is an unwrapped coordinate.
  Com
Class for computing averaged position weighted by atomic mass, under the periodic boundary condition.
  Coc
Class for computing center of charge under periodic boundary condition.
  Centroid
Class for computing centroid under periodic boundary condition.
  Gyradius
Class for computing radius of gyration under periodic boundary condition.
  MassAvgVel
Class for computing mass-averaged velocity
  PosTrack
Class for tracking positions of selected atoms in a trajectory.
  RadiusOfGyration
Class for computing radius of gyration under periodic boundary condition.
  CenterOfMotion
Class for computing mass-averaged velocity
  Position
Class for tracking positions of selected atoms in a trajectory.
  Ramachandran
Calculate the Phi and Psi torsions for selected atoms.
  _MaestroAnalysis
All analyzer classes whose calculations require the full-system CT could inherit this base class, which will provide an intermediate data that contains a trajectory frame and a full-system CT.
  PosAlign
This analyzer first aligns the geometric center of the solute atoms to that of cms_model, then calculates the rotation/translation transformation for converting the structure (fit_aids) of a centered trajectory frame to a given geometry (fit_ref_pos) and finally applies the transformation to a position array of only the selected atoms (aids).
  RMSD
Root Mean Square Deviation from reference positions, with optional alignment fitting.
  RMSF
Root Mean Square Fluctation from reference positions (averaged position over the trajectory) for each atom, with optional alignment fitting.
  LigandRMSD
Ligand Root Mean Square Deviation from reference positions, with optional alignment fitting.
  ProteinRMSF
Root Mean Square Fluctation from reference positions (averaged positions over the trajectory) for each residue, with optional alignment fitting
  SecondaryStructure
Calculate the secondary-structure property for selected atoms.
  SolventAccessibleSurfaceAreaByResidue
Calculate the relative SASA broken down by residues.
  MolecularSurfaceArea
Calculate the molecular surface area.
  SolventAccessibleSurfaceArea
Calculate solvent accessible surface area for selected atoms.
  PolarSurfaceArea
Calculate polar surface area for selected atoms.
  HydrogenBondFinder
Find hydrogen bonds present between two sets of atoms.
  VolumeMapper
This class takes the coordinates of provided particles and maps them onto a discretized grid using kernel density estimation as implemented in scipy.
  _CustomCalc
An instance of this class will store custom calculation requests (keys) and results (values).
  GeomCalc
We use this class to batch the geometry calculations and avoid duplications.
  Positer
A class to create a positer object for use with the GeomCalc class.
  Rdf
Calculate radial distribution function (RDF) of provided selection.
Functions [hide private]
 
is_small_struc(atoms)
A simple API to determine whether a molecular structure is small.
 
_pos2circ(data, pbc, fr, *_)
Convert a 3D vector (x, y, z) into a circular coordinate:
dict. Key = GID, value = a copy of the input frame instance fr. If previous frame is available in data, the atom coordinates are unwrapped with respect to their coordinates in the previous frame.
_unwrap_wrt_prevpos(data, pbc, fr, *_)
Unwrap every point wrt its coordinate in the prev frame, if available.
 
_center(data, pbc, fr, *_)
Center selected particles in the simulation box, and it will automatically make all molecules whole.
Nx3 numpy.ndarray
_align_pos(pos, fit_pos, fit_ref_pos, weights=None)
Align pos using transformations (rotation and translation) derived from converting fit_pos to fit_ref_pos.
dict
_dictmap(func, dictionary)
Map each key-value pair in a dictionary with a function func.
 
progress_report_frame_number(i, *_)
list
analyze(tr, analyzer, *arg, **kwarg)
Do analyses on the given trajectory tr, and return the results.
numpy.ndarray of floats
rmsd_matrix(msys_model, tr, rmsd_gids, fit_gids)
For all pairs of frames in the trajectory tr, we first superimpose the structures from the two frames on the atoms as specified by fit_gids, and then we calculate the RMSD for atoms as specified by rmsd_gids.
 
cluster(affinity_matrix)
Do clustering using the affinity propagation method.
Variables [hide private]
  __package__ = 'schrodinger.application.desmond.packages'
Function Details [hide private]

is_small_struc(atoms)

 

A simple API to determine whether a molecular structure is small.

Parameters:
  • atoms (list) - A list of atoms in the structure. The atoms can be atom IDs or atom-class instances.

_pos2circ(data, pbc, fr, *_)

 

Convert a 3D vector (x, y, z) into a circular coordinate:

  (array([cos_x', cos_y', cos_z',]), arary([sin_x', sin_y', sin_z']),)

. This is needed for the center of mass (or charge, or centroid, for that matter)
calculations.

@type data: C{dict}. Key = GID, value = circular coordinate of the atom

_unwrap_wrt_prevpos(data, pbc, fr, *_)

 

Unwrap every point wrt its coordinate in the prev frame, if available.

Parameters:
  • data (dict. Key = GID, value = None for the first frame, otherwise value = the previous frame with unwrapped atom coordinates. All GIDs map to the same frame instance.)
Returns: dict. Key = GID, value = a copy of the input frame instance fr. If previous frame is available in data, the atom coordinates are unwrapped with respect to their coordinates in the previous frame.

_center(data, pbc, fr, *_)

 

Center selected particles in the simulation box, and it will automatically
make all molecules whole.
This function will copy the input trajectory frame (C{fr}), and in the copy
frame the selected particles will be centered. Optionally this function will
create a full-system CT of the centered frame.

@type data: C{dict}
    key = C{(msys_model, cms_model, center_gids, allaid_gids)}
    value = (<centered-frame>, <centered-full-system-CT> or C{None})
where C{msys_model} and C{center_gids} are mandated, and C{cms_model} and
C{allaid_gids} can be C{None}s. C{center_gids} specifies the GIDs of the
particles to be centered, whereas C{allaid_gids} specifies the GIDs of all
the atoms in the full-system CT (this list does not equals to the all GIDs).
If C{cms_model} is C{None}, this function will NOT create the centered
full-system CT.

@return: Updated C{data}, where values are updated for the given C{fr}.

_align_pos(pos, fit_pos, fit_ref_pos, weights=None)

 

Align pos using transformations (rotation and translation) derived from converting fit_pos to fit_ref_pos. Weighted Kabsch algorithm is used to obtain the transformations.

Parameters:
  • fit_pos (Mx3 numpy.ndarray)
  • weights (length M numpy.ndarray, or None)
  • pos (Nx3 numpy.ndarray)
  • fit_ref_pos (Mx3 numpy.ndarray)
Returns: Nx3 numpy.ndarray
aligned pos

_dictmap(func, dictionary)

 

Map each key-value pair in a dictionary with a function func. This will create a new dict object with the same keys as in dictionary, but the corresponding value of each key will be ``mapped'' by calling func(key).

Parameters:
  • dictionary (dict)
  • func (Any callable object that takes a key from dictionary as the input argument and returns a new value.)
Returns: dict
A new dict object. dictionary will NOT be mutated.

analyze(tr, analyzer, *arg, **kwarg)

 

Do analyses on the given trajectory tr, and return the results. The analyses are specified as one or more positional arguements. Each analyzer should satisfy the interface requirements (see the docstring of GeomCalc.addAnalyzer).

Parameters:
  • tr (list of traj.Frames) - The simulation trajectory to analyze
  • arg - A list of analyzer objects
  • kwarg["progress_feedback"] (callable, e.g., func(i, fr, tr), where i is the current frame index, fr the current frame, tr the whole trajectory.) - This function will be called at start of analysis on the current frame. This function is intended to report the progress of the analysis.
Returns: list
For a single analyzer, this function will return a list of analysis results, and each element in the list corresponds to the result of the corresponding frame. For multiple analyzers, this function will return a list of lists, and each element is a list of results of the corresponding analyzer. If an analyzer has a reduce method, the reduce method will be called, and its result will be returned.

rmsd_matrix(msys_model, tr, rmsd_gids, fit_gids)

 

For all pairs of frames in the trajectory tr, we first superimpose the structures from the two frames on the atoms as specified by fit_gids, and then we calculate the RMSD for atoms as specified by rmsd_gids.

Parameters:
  • tr (list of traj.Frame objects) - Trajectory
  • rmsd_gids (list of ints) - GIDs of atoms for which to calculate the RMSD
  • fit_gids (list of ints) - GIDs of atoms on which to we align the structures
  • msys_model (msys.System)
Returns: numpy.ndarray of floats
A symetric square matrix of RMSDs

cluster(affinity_matrix)

 

Do clustering using the affinity propagation method.

Parameters:
  • affinity_matrix (numpy.ndarray of floats) - A square matrix of affinity/similarity values

    @rtype (list-of-ints, list-of-ints)

Returns:
The first list is the sample indices of the clusters' centers, the second list is a cluster label of all samples.