Package Biskit :: Module ReduceCoordinates :: Class ReduceCoordinates
[hide private]
[frames] | no frames]

Class ReduceCoordinates

source code

ReduceCoordinates

Translate a PDBModel or frames from a trajectory to structure(s) with only one backbone and up to 2 side chain atoms per residue. The new atoms are the centers of mass of several atoms and carry the weight of the pooled atoms in an atom profile called 'mass'.

Examples

>>> ## create with reference PDBModel
>>> reducer = ReduceCoordinates( m_ref )
>>> ## creates reduced PDBModel from m_ref
>>> m_red = reducer.reduceToModel()
OR:
>>> m_red_1 = reducer.reduceToModel( m1.getXyz() ) ## reduce many models
>>> m_red_2 = reducer.reduceToModel( m2.getXyz() ) ## with identical atoms
OR:
>>> ## reduce a complete Trajectory
>>> reducer = ReduceCoordinates( traj.ref )
>>> red_ref= reducer.reduceToModel()
>>> frames = reducer.reduceXyz( traj.frames )
>>> traj_red = Trajectory( ref=red_ref )
>>> traj_red.frames = frames


Instance Methods [hide private]
  __init__(self, model, maxPerCenter=4)
Prepare reduction of coordinates from a given model.
  __addMassProfile(self, model)
Add a mass profile to the model.
[[int],[int]..] group(self, a_indices, maxPerCenter)
Group a bunch of integers (atom indices in PDBModel) so that each group has at most maxPerCenter items.
dict nextAtom(self, resName, resNumber, name, chainId, segid)
Create an atom dictionary.
  makeMap(self, maxPerCenter=4)
Calculate mapping between complete and reduced atom list.
array reduceXyz(self, xyz, axis=0)
Reduce the number of atoms in the given coordinate set.
PDBModel reduceToModel(self, xyz=None, reduce_profiles=1)
Create a reduced PDBModel from coordinates.
  reduceAtomProfiles(self, from_model, to_model)
reduce all atom profiles according to the calculated map by calculating the average over the grouped atoms.

Class Variables [hide private]
  aaAtoms = {'GLY': ['N', 'CA', 'C', 'O', 'OXT'], 'ALA': ['N', '...

Method Details [hide private]

__init__(self, model, maxPerCenter=4)
(Constructor)

source code 

Prepare reduction of coordinates from a given model.
Parameters:
  • model (PDBModel) - reference model defining atom content and order
  • maxPerCenter (int) - max number of atoms per side chain center atom (default: 4)

__addMassProfile(self, model)

source code 

Add a mass profile to the model.
Parameters:
  • model (PDBModel) - model

group(self, a_indices, maxPerCenter)

source code 

Group a bunch of integers (atom indices in PDBModel) so that each group has at most maxPerCenter items.
Parameters:
  • a_indices ([int]) - atom indices
  • maxPerCenter (int) - max entries per group
Returns: [[int],[int]..]
list of lists of int

nextAtom(self, resName, resNumber, name, chainId, segid)

source code 

Create an atom dictionary.
Parameters:
  • resName (str) - residue name
  • resNumber (int) - residue number
  • name (str) - atom name
  • chainId (str) - chain identifier
  • segid (str) - segnemt identifier
Returns: dict
atom dictionary

makeMap(self, maxPerCenter=4)

source code 

Calculate mapping between complete and reduced atom list. Creates a (list of lists of int, list of atom dictionaries) containing groups of atom indices into original model, new center atoms
Parameters:
  • maxPerCenter (int) - max number of atoms per side chain center atom (default: 4)

reduceXyz(self, xyz, axis=0)

source code 

Reduce the number of atoms in the given coordinate set. The set must have the same length and order as the reference model. It may have an additional (time) dimension as first axis.
Parameters:
  • xyz (array) - coordinates (N_atoms x 3) or (N_frames x N_atoms x 3)
  • axis (int) - axis with atoms (default: 0)
Returns: array
coordinate array (N_less_atoms x 3) or (N_frames x N_less_atoms x 3)

reduceToModel(self, xyz=None, reduce_profiles=1)

source code 

Create a reduced PDBModel from coordinates. Atom profiles the source PDBModel are reduced by averaging over the grouped atoms.
Parameters:
  • xyz (array OR None) - coordinte array (N_atoms x 3) or None (->use reference coordinates)
Returns: PDBModel
PDBModel with reduced atom set and profile 'mass'

reduceAtomProfiles(self, from_model, to_model)

source code 

reduce all atom profiles according to the calculated map by calculating the average over the grouped atoms.
Parameters:
  • from_model (PDBModel) - model
  • to_model (PDBModel) - model

Class Variable Details [hide private]

aaAtoms

Value:
{'GLY': ['N', 'CA', 'C', 'O', 'OXT'], 'ALA': ['N', 'CA', 'C', 'O', 'CB
', 'OXT'], 'VAL': ['N', 'CA', 'C', 'O', 'CB', 'CG1', 'CG2', 'OXT'], 'L
EU': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'CD1', 'CD2', 'OXT'], 'ILE': ['
N', 'CA', 'C', 'O', 'CB', 'CG1', 'CG2', 'CD1', 'OXT'], 'MET': ['N', 'C
A', 'C', 'O', 'CB', 'CG', 'SD', 'CE', 'OXT'], 'PRO': ['N', 'CA', 'C', 
'O', 'CB', 'CG', 'CD', 'OXT'], 'PHE': ['N', 'CA', 'C', 'O', 'CB', 'CG'
, 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'OXT'], 'TRP': ['N', 'CA', 'C', 'O
', 'CB', 'CG', 'CD1', 'CD2', 'NE1', 'CE2', 'CE3', 'CZ2', 'CZ3', 'CH2',
...