OpenStructure
Loading...
Searching...
No Matches
Data Structures | Functions
ost.mol.alg.chain_mapping Namespace Reference

Data Structures

class  _lDDTGreedySearcher
 
class  _QSScoreGreedySearcher
 
class  ChainMapper
 
class  MappingResult
 
class  ReprResult
 

Functions

 _CSel (ent, cnames)
 
 _GetAlnPropsTwo (aln)
 
 _GetAlnPropsOne (aln)
 
 _GetRefMdlAlns (ref_chem_groups, ref_chem_group_msas, mdl_chem_groups, mdl_chem_group_alns, pairs=None)
 
 _CheckOneToOneMapping (ref_chains, mdl_chains)
 
 _lDDTNaive (trg, mdl, inclusion_radius, thresholds, chem_groups, chem_mapping, ref_mdl_alns, n_max_naive)
 
 _GetSeeds (ref_chem_groups, mdl_chem_groups, mapped_ref_chains=set(), mapped_mdl_chains=set())
 
 _lDDTGreedyFull (the_greed)
 
 _lDDTGreedyBlock (the_greed, seed_size, blocks_per_chem_group)
 
 _QSScoreNaive (trg, mdl, chem_groups, chem_mapping, ref_mdl_alns, contact_d, n_max_naive)
 
 _QSScoreGreedyFull (the_greed)
 
 _QSScoreGreedyBlock (the_greed, seed_size, blocks_per_chem_group)
 
 _SingleRigidRMSD (initial_transforms, initial_mappings, chem_groups, chem_mapping, trg_group_pos, mdl_group_pos)
 
 _SingleRigidCentroid (initial_transforms, initial_mappings, chem_groups, chem_mapping, trg_group_pos, mdl_group_pos)
 
 _IterativeRigidRMSD (initial_transforms, initial_mappings, chem_groups, chem_mapping, trg_group_pos, mdl_group_pos)
 
 _NaiveRMSD (chem_groups, chem_mapping, trg_group_pos, mdl_group_pos, n_max_naive)
 
 _GetRefPos (trg, mdl, trg_msas, mdl_alns, max_pos=None)
 
 _GetBBPos (ent)
 
 _GetFullyCoveredIndices (msa)
 
 _RefIndicesToColumnIndices (msa, indices)
 
 _ExtractMSAPos (msa, s_idx, indices, bb)
 
 _NChemGroupMappings (ref_chains, mdl_chains)
 
 _NMappings (ref_chains, mdl_chains)
 
 _NMappingsWithin (ref_chains, mdl_chains, max_mappings)
 
 _RefSmallerGenerator (ref_chains, mdl_chains)
 
 _RefLargerGenerator (ref_chains, mdl_chains)
 
 _RefEqualGenerator (ref_chains, mdl_chains)
 
 _RefEmptyGenerator (ref_chains, mdl_chains)
 
 _ConcatIterators (iterators)
 
 _ChainMappings (ref_chains, mdl_chains, n_max=None)
 
 _GetSuperposition (pos_one, pos_two, iterative)
 

Detailed Description

Chain mapping aims to identify a one-to-one relationship between chains in a
reference structure and a model.

Function Documentation

◆ _ChainMappings()

_ChainMappings (   ref_chains,
  mdl_chains,
  n_max = None 
)
protected
Returns all possible ways to map *mdl_chains* onto fixed *ref_chains*

:param ref_chains: List of list of chemically equivalent chains in reference
:type ref_chains: :class:`list` of :class:`list`
:param mdl_chains: Equally long list of list of chemically equivalent chains
                   in model that map on those ref chains.
:type mdl_chains: :class:`list` of :class:`list`
:param n_max: Aborts and raises :class:`RuntimeError` if max number of
              mappings is above this threshold.
:type n_max: :class:`int`
:returns: Iterator over all possible mappings of *mdl_chains* onto fixed
          *ref_chains*. Potentially contains None as padding when number of
          model chains for a certain mapping is smaller than the according
          reference chains.
          Example: _ChainMappings([['A', 'B', 'C'], ['D', 'E']],
                                  [['x', 'y'], ['i', 'j']])
          gives an iterator over: [[['x', 'y', None], ['i', 'j']],
                                   [['x', 'y', None], ['j', 'i']],
                                   [['y', 'x', None], ['i', 'j']],
                                   [['y', 'x', None], ['j', 'i']],
                                   [['x', None, 'y'], ['i', 'j']],
                                   [['x', None, 'y'], ['j', 'i']],
                                   [['y', None, 'x'], ['i', 'j']],
                                   [['y', None, 'x'], ['j', 'i']],
                                   [[None, 'x', 'y'], ['i', 'j']],
                                   [[None, 'x', 'y'], ['j', 'i']],
                                   [[None, 'y', 'x'], ['i', 'j']],
                                   [[None, 'y', 'x'], ['j', 'i']]]

Definition at line 3652 of file chain_mapping.py.

◆ _CheckOneToOneMapping()

_CheckOneToOneMapping (   ref_chains,
  mdl_chains 
)
protected
 Checks whether we already have a perfect one to one mapping

That means each list in *ref_chains* has either exactly one element
and the respective list in *mdl_chains* has also one element or
it has several elements and the respective list in *mdl_chains* is
empty (ref chain(s) has no mapped mdl chain). Returns None if no such
mapping can be found.

:param ref_chains: corresponds to :attr:`ChainMapper.chem_groups`
:type ref_chains: :class:`list` of :class:`list` of :class:`str`
:param mdl_chains: mdl chains mapped to chem groups in *ref_chains*, i.e.
                   the return value of :func:`ChainMapper.GetChemMapping`
:type mdl_chains: class:`list` of :class:`list` of :class:`str`
:returns: A :class:`list` of :class:`list` if a one to one mapping is found,
          None otherwise

Definition at line 2400 of file chain_mapping.py.

◆ _ConcatIterators()

_ConcatIterators (   iterators)
protected

Definition at line 3648 of file chain_mapping.py.

◆ _CSel()

_CSel (   ent,
  cnames 
)
protected
 Returns view with specified chains

Ensures that quotation marks are around chain names to not confuse
OST query language with weird special characters.

Definition at line 24 of file chain_mapping.py.

◆ _ExtractMSAPos()

_ExtractMSAPos (   msa,
  s_idx,
  indices,
  bb 
)
protected
 Helper for _GetRefPos

Returns a geom.Vec3List containing positions refering to given msa sequence.
=> Chain with corresponding name is mapped onto sequence and the position of
the first atom of each residue specified in indices is extracted.
Indices refers to column indices in msa!

Definition at line 3538 of file chain_mapping.py.

◆ _GetAlnPropsOne()

_GetAlnPropsOne (   aln)
protected
Returns basic properties of *aln* version one...

:param aln: Alignment to compute properties
:type aln: :class:`seq.AlignmentHandle`
:returns: Tuple with 2 elements. 1) sequence identify in range [0, 100] 
          considering aligned columns 2) Number of aligned columns.

Definition at line 2298 of file chain_mapping.py.

◆ _GetAlnPropsTwo()

_GetAlnPropsTwo (   aln)
protected
Returns basic properties of *aln* version two...

:param aln: Alignment to compute properties
:type aln: :class:`seq.AlignmentHandle`
:returns: Tuple with 3 elements. 1) sequence identity in range [0, 100] 
          considering aligned columns 2) Number of non gap characters in
          first sequence 3) Number of aligned characters.

Definition at line 2284 of file chain_mapping.py.

◆ _GetBBPos()

_GetBBPos (   ent)
protected
 Helper for _GetRefPos

Returns a dict with key: chain name and value: a geom.Vec3List of backbone
atom positions. Assumes that either CA or C3' is always there.

Definition at line 3485 of file chain_mapping.py.

◆ _GetFullyCoveredIndices()

_GetFullyCoveredIndices (   msa)
protected
 Helper for _GetRefPos

Returns a set containing the indices relative to first sequence in msa which
are fully covered in all other sequences

--AA-A-A
-BBBB-BB
CCCC-C-C

=> (0,1,3)

Definition at line 3502 of file chain_mapping.py.

◆ _GetRefMdlAlns()

_GetRefMdlAlns (   ref_chem_groups,
  ref_chem_group_msas,
  mdl_chem_groups,
  mdl_chem_group_alns,
  pairs = None 
)
protected
 Get all possible ref/mdl chain alignments given chem group mapping

:param ref_chem_groups: :attr:`ChainMapper.chem_groups`
:type ref_chem_groups: :class:`list` of :class:`list` of :class:`str`
:param ref_chem_group_msas: :attr:`ChainMapper.chem_group_alignments`
:type ref_chem_group_msas: :class:`ost.seq.AlignmentList`
:param mdl_chem_groups: Groups of model chains that are mapped to
                        *ref_chem_groups*. Return value of
                        :func:`ChainMapper.GetChemMapping`.
:type mdl_chem_groups: :class:`list` of :class:`list` of :class:`str`
:param mdl_chem_group_alns: A pairwise sequence alignment for every chain
                            in *mdl_chem_groups* that aligns these sequences
                            to the respective reference sequence.
                            Return values of
                            :func:`ChainMapper.GetChemMapping`.
:type mdl_chem_group_alns: :class:`list` of :class:`ost.seq.AlignmentList`
:param pairs: Pro param - restrict return dict to specified pairs. A set of
              tuples in form (<trg_ch>, <mdl_ch>)
:type pairs: :class:`set`
:returns: A dictionary holding all possible ref/mdl chain alignments. Keys
          in that dictionary are tuples of the form (ref_ch, mdl_ch) and
          values are the respective pairwise alignments with first sequence
          being from ref, the second from mdl.

Definition at line 2312 of file chain_mapping.py.

◆ _GetRefPos()

_GetRefPos (   trg,
  mdl,
  trg_msas,
  mdl_alns,
  max_pos = None 
)
protected
 Extracts reference positions which are present in trg and mdl

Definition at line 3419 of file chain_mapping.py.

◆ _GetSeeds()

_GetSeeds (   ref_chem_groups,
  mdl_chem_groups,
  mapped_ref_chains = set(),
  mapped_mdl_chains = set() 
)
protected

Definition at line 2619 of file chain_mapping.py.

◆ _GetSuperposition()

_GetSuperposition (   pos_one,
  pos_two,
  iterative 
)
protected
 Computes minimal RMSD superposition for pos_one onto pos_two

:param pos_one: Positions that should be superposed onto *pos_two*
:type pos_one: :class:`geom.Vec3List`
:param pos_two: Reference positions
:type pos_two: :class:`geom.Vec3List`
:iterative: Whether iterative superposition should be used. Iterative
            potentially raises, uses standard superposition as fallback.
:type iterative: :class:`bool`
:returns: Transformation matrix to superpose *pos_one* onto *pos_two*
:rtype: :class:`ost.mol.alg.SuperpositionResult`

Definition at line 3704 of file chain_mapping.py.

◆ _IterativeRigidRMSD()

_IterativeRigidRMSD (   initial_transforms,
  initial_mappings,
  chem_groups,
  chem_mapping,
  trg_group_pos,
  mdl_group_pos 
)
protected
 Takes initial transforms and sequentially adds chain pairs with
lowest RMSD. With each added chain pair, the transform gets updated.
Thus the naming iterative. The mapping from the initial transform that
leads to best overall RMSD score is returned.

Definition at line 3295 of file chain_mapping.py.

◆ _lDDTGreedyBlock()

_lDDTGreedyBlock (   the_greed,
  seed_size,
  blocks_per_chem_group 
)
protected
 try multiple seeds, i.e. try all ref/mdl chain combinations within the
respective chem groups and compute single chain lDDTs. The
*blocks_per_chem_group* best scoring ones are extend by *seed_size* chains
and the best scoring one is exhaustively extended.

Definition at line 2689 of file chain_mapping.py.

◆ _lDDTGreedyFull()

_lDDTGreedyFull (   the_greed)
protected
 Uses each reference chain as starting point for expansion

Definition at line 2631 of file chain_mapping.py.

◆ _lDDTNaive()

_lDDTNaive (   trg,
  mdl,
  inclusion_radius,
  thresholds,
  chem_groups,
  chem_mapping,
  ref_mdl_alns,
  n_max_naive 
)
protected
 Naively iterates all possible chain mappings and returns the best

Definition at line 2599 of file chain_mapping.py.

◆ _NaiveRMSD()

_NaiveRMSD (   chem_groups,
  chem_mapping,
  trg_group_pos,
  mdl_group_pos,
  n_max_naive 
)
protected

Definition at line 3380 of file chain_mapping.py.

◆ _NChemGroupMappings()

_NChemGroupMappings (   ref_chains,
  mdl_chains 
)
protected
 Number of mappings within one chem group

:param ref_chains: Reference chains
:type ref_chains: :class:`list` of :class:`str`
:param mdl_chains: Model chains that are mapped onto *ref_chains*
:type mdl_chains: :class:`list` of :class:`str`
:returns: Number of possible mappings of *mdl_chains* onto *ref_chains*

Definition at line 3556 of file chain_mapping.py.

◆ _NMappings()

_NMappings (   ref_chains,
  mdl_chains 
)
protected
 Number of mappings for a full chem mapping

:param ref_chains: Chem groups of reference
:type ref_chains: :class:`list` of :class:`list` of :class:`str`
:param mdl_chains: Model chains that map onto those chem groups
:type mdl_chains: :class:`list` of :class:`list` of :class:`str`
:returns: Number of possible mappings of *mdl_chains* onto *ref_chains*

Definition at line 3576 of file chain_mapping.py.

◆ _NMappingsWithin()

_NMappingsWithin (   ref_chains,
  mdl_chains,
  max_mappings 
)
protected
 Check whether total number of mappings is smaller than given maximum

In principle the same as :func:`_NMappings` but it stops as soon as the
maximum is hit.

:param ref_chains: Chem groups of reference
:type ref_chains: :class:`list` of :class:`list` of :class:`str`
:param mdl_chains: Model chains that map onto those chem groups
:type mdl_chains: :class:`list` of :class:`list` of :class:`str`
:param max_mappings: Number of max allowed mappings
:returns: Whether number of possible mappings of *mdl_chains* onto
          *ref_chains* is below or equal *max_mappings*.

Definition at line 3591 of file chain_mapping.py.

◆ _QSScoreGreedyBlock()

_QSScoreGreedyBlock (   the_greed,
  seed_size,
  blocks_per_chem_group 
)
protected
 try multiple seeds, i.e. try all ref/mdl chain combinations within the
respective chem groups and compute single chain lDDTs. The
*blocks_per_chem_group* best scoring ones are extend by *seed_size* chains
and the best scoring one with respect to QS score is exhaustively extended.

Definition at line 3075 of file chain_mapping.py.

◆ _QSScoreGreedyFull()

_QSScoreGreedyFull (   the_greed)
protected
 Uses each reference chain as starting point for expansion

Definition at line 3017 of file chain_mapping.py.

◆ _QSScoreNaive()

_QSScoreNaive (   trg,
  mdl,
  chem_groups,
  chem_mapping,
  ref_mdl_alns,
  contact_d,
  n_max_naive 
)
protected

Definition at line 3003 of file chain_mapping.py.

◆ _RefEmptyGenerator()

_RefEmptyGenerator (   ref_chains,
  mdl_chains 
)
protected

Definition at line 3645 of file chain_mapping.py.

◆ _RefEqualGenerator()

_RefEqualGenerator (   ref_chains,
  mdl_chains 
)
protected
 Returns all possible ways to map mdl_chains onto ref_chains

Specific for the case where len(ref_chains) == len(mdl_chains)

Definition at line 3637 of file chain_mapping.py.

◆ _RefIndicesToColumnIndices()

_RefIndicesToColumnIndices (   msa,
  indices 
)
protected
 Helper for _GetRefPos

Returns a list of mapped indices. indices refer to non-gap one letter
codes in the first msa sequence. The returnes mapped indices are translated
to the according msa column indices

Definition at line 3523 of file chain_mapping.py.

◆ _RefLargerGenerator()

_RefLargerGenerator (   ref_chains,
  mdl_chains 
)
protected
 Returns all possible ways to map mdl_chains onto ref_chains

Specific for the case where len(ref_chains) > len(mdl_chains)
Ref chains without mapped mdl chain are assigned None

Definition at line 3622 of file chain_mapping.py.

◆ _RefSmallerGenerator()

_RefSmallerGenerator (   ref_chains,
  mdl_chains 
)
protected
 Returns all possible ways to map mdl_chains onto ref_chains

Specific for the case where len(ref_chains) < len(mdl_chains)

Definition at line 3613 of file chain_mapping.py.

◆ _SingleRigidCentroid()

_SingleRigidCentroid (   initial_transforms,
  initial_mappings,
  chem_groups,
  chem_mapping,
  trg_group_pos,
  mdl_group_pos 
)
protected
Takes initial transforms and sequentially adds chain pairs with lowest
centroid distance.
The mapping from the transform that leads to lowest overall RMSD of
the centroids is returned.

Definition at line 3212 of file chain_mapping.py.

◆ _SingleRigidRMSD()

_SingleRigidRMSD (   initial_transforms,
  initial_mappings,
  chem_groups,
  chem_mapping,
  trg_group_pos,
  mdl_group_pos 
)
protected
Takes initial transforms and sequentially adds chain pairs with lowest RMSD.
The mapping from the transform that leads to lowest overall RMSD is
returned.

Definition at line 3165 of file chain_mapping.py.