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
  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.
  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.
  _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.
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.
dict
_dictmap(func, dictionary)
Map each key-value pair in a dictionary with a function func.
list
analyze(tr, analyzer, *arg)
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.
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}.

_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)

 

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
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 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.

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.