Superposing structures¶
- Superpose(ent_a, ent_b, match='number', atoms='all', iterative=False, max_iterations=5, distance_threshold=3.0)¶
Superposes the model entity onto the reference. To do so, two views are created, returned with the result. atoms describes what goes into these views and match the selection method. For superposition,
SuperposeSVD()
orIterativeSuperposeSVD()
are called (depending on iterative). For matching, the following methods are recognised:number
- select residues by residue number, includes atoms, callsMatchResidueByNum()
index
- select residues by index in chain, includes atoms, callsMatchResidueByIdx()
local-aln
- select residues from a Smith/Waterman alignment, includes atoms, callsMatchResidueByLocalAln()
global-aln
- select residues from a Needleman/Wunsch alignment, includes atoms, callsMatchResidueByGlobalAln()
- Parameters:
ent_a (
EntityView
orEntityHandle
) – The model entity (superposition transform is applied on full entity handle here)ent_b (
EntityView
orEntityHandle
) – The reference entitymatch (
str
) – Method to gather residues/ atomsatoms (
str
,list
,set
) – The subset of atoms to be used in the superpositioniterative (
bool
) – Whether or not to use iterative superpositon.max_iterations (
int
) – Max. number of iterations forIterativeSuperposeSVD()
(only if iterative = True)distance_threshold (
float
) – Distance threshold forIterativeSuperposeSVD()
(only if iterative = True)
- Returns:
An instance of
SuperpositionResult
.
- ParseAtomNames(atoms)¶
Parses different representations of a list of atom names and returns a
set
, understandable byMatchResidueByNum()
. In essence, this function translatesNone to
None
‘all’ to
None
‘backbone’ to
set(['N', 'CA', 'C', 'O'])
‘aname1, aname2’ to
set(['aname1', 'aname2'])
['aname1', 'aname2']
toset(['aname1', 'aname2'])
- Parameters:
atoms (
str
,list
,set
) – Identifier or list of atoms- Returns:
A
set
of atoms.
- MatchResidueByNum(ent_a, ent_b, atoms='all')¶
Returns a tuple of views containing exactly the same number of atoms. Residues are matched by residue number. A subset of atoms to be included in the views can be specified in the atoms argument. Regardless of what the list of atoms says, only those present in two matched residues will be included in the views. Chains are processed in the order they occur in the entities. If ent_a and ent_b contain a different number of chains, processing stops with the lower count.
- Parameters:
ent_a (
EntityView
orEntityHandle
) – The first entityent_b (
EntityView
orEntityHandle
) – The second entityatoms (
str
,list
,set
) – The subset of atoms to be included in the two views.
- Returns:
Two
EntityView
instances with the same amount of residues matched by number. Each residue will have the same number & type of atoms.
- MatchResidueByIdx(ent_a, ent_b, atoms='all')¶
Returns a tuple of views containing exactly the same number of atoms. Residues are matched by position in the chains of an entity. A subset of atoms to be included in the views can be specified in the atoms argument. Regardless of what the list of atoms says, only those present in two matched residues will be included in the views. Chains are processed in order of appearance. If ent_a and ent_b contain a different number of chains, processing stops with the lower count. The number of residues per chain is supposed to be the same.
- Parameters:
ent_a (
EntityView
orEntityHandle
) – The first entityent_b (
EntityView
orEntityHandle
) – The second entityatoms (
str
,list
,set
) – The subset of atoms to be included in the two views.
- Returns:
Two
EntityView
instances with the same amount of residues matched by position. Each residue will have the same number & type of atoms.
- MatchResidueByLocalAln(ent_a, ent_b, atoms='all')¶
Match residues by local alignment. Takes ent_a and ent_b, extracts the sequences chain-wise and aligns them in Smith/Waterman manner using the BLOSUM62 matrix for scoring. Only residues which are marked as
peptide linking
are considered for alignment. The residues of the entities are then matched based on this alignment. Only atoms present in both residues are included in the views. Chains are processed in order of appearance. If ent_a and ent_b contain a different number of chains, processing stops with the lower count.- Parameters:
ent_a (
EntityView
orEntityHandle
) – The first entityent_b (
EntityView
orEntityHandle
) – The second entityatoms (
str
,list
,set
) – The subset of atoms to be included in the two views.
- Returns:
Two
EntityView
instances with the same number of residues. Each residue will have the same number & type of atoms.
- MatchResidueByGlobalAln(ent_a, ent_b, atoms='all')¶
Match residues by global alignment. Same as
MatchResidueByLocalAln()
but performs a global Needleman/Wunsch alignment of the sequences using the BLOSUM62 matrix for scoring.- Parameters:
ent_a (
EntityView
orEntityHandle
) – The first entityent_b (
EntityView
orEntityHandle
) – The second entityatoms (
str
,list
,set
) – The subset of atoms to be included in the two views.
- Returns:
Two
EntityView
instances with the same number of residues. Each residue will have the same number & type of atoms.
- class SuperpositionResult¶
- rmsd¶
RMSD of the superposed entities.
- view1¶
- view2¶
Two
EntityView
used in superposition (not set if methods withVec3List
used).
- fraction_superposed¶
- rmsd_superposed_atoms¶
- ncycles¶
For iterative superposition (
IterativeSuperposeSVD()
): fraction and RMSD of atoms that were superposed with a distance below the given threshold and the number of iteration cycles performed.
- SuperposeSVD(view1, view2, apply_transform=True)¶
- SuperposeSVD(list1, list2)
Superposition of two sets of atoms minimizing RMSD using a classic SVD based algorithm.
Note that the atom positions in the view are taken blindly in the order in which the atoms appear.
- Parameters:
view1 (
EntityView
) – View on the model entityview2 (
EntityView
) – View on the reference entitylist1 (
Vec3List
) – List of atom positions for model entitylist2 (
Vec3List
) – List of atom positions for reference entityapply_transform (
bool
) – If True, the superposition transform is applied to the (full!) entity handle linked to view1.
- Returns:
An instance of
SuperpositionResult
.
- IterativeSuperposeSVD(view1, view2, max_iterations=5, distance_threshold=3.0, apply_transform=True)¶
- IterativeSuperposeSVD(list1, list2, max_iterations=5, distance_threshold=3.0)
Iterative superposition of two sets of atoms. In each iteration cycle, we keep a fraction of atoms with distances below distance_threshold and get the superposition considering only those atoms.
Note that the atom positions in the view are taken blindly in the order in which the atoms appear.
- Parameters:
view1 (
EntityView
) – View on the model entityview2 (
EntityView
) – View on the reference entitylist1 (
Vec3List
) – List of atom positions for model entitylist2 (
Vec3List
) – List of atom positions for reference entitymax_iterations (
int
) – Max. number of iterations to be performeddistance_threshold (
float
) – Distance threshold defining superposed atomsapply_transform (
bool
) – If True, the superposition transform is applied to the (full!) entity handle linked to view1.
- Returns:
An instance of
SuperpositionResult
.- Raises:
Exception if atom counts do not match or if less than 3 atoms.
- CalculateRMSD(view1, view2, transformation=geom.Mat4())¶
- Returns:
RMSD of atom positions (taken blindly in the order in which the atoms appear) in the two given views.
- Return type:
float
- Parameters:
view1 (
EntityView
) – View on the model entityview2 (
EntityView
) – View on the reference entitytransformation (
Mat4
) – Optional transformation to apply on each atom position of view1.