moleculekit.align module#
- moleculekit.align.molTMalign(mol, ref, molsel='protein', refsel='protein', return_alignments=True, frames=None, matchingframes=False)#
Calculates the TMscore between two protein Molecules
- Parameters:
mol (
Molecule) – A Molecule containing a single or multiple framesref (
Molecule) – A reference Molecule containing a single frame. Will automatically keep only ref.frame.molsel (
str|ndarray) – Atoms of mol to use, as an atom selection string, a boolean mask, or an integer index array (seeMolecule.atomselect).refsel (
str|ndarray) – Atoms of ref to use, as an atom selection string, a boolean mask, or an integer index array (seeMolecule.atomselect).return_alignments (
bool) – If True it will return the aligned structures of mol and the transformation matrices used to produce themframes (
list|range|ndarray|None) – A list of frames of mol to align to ref. If None it will align all frames.matchingframes (
bool) – If set to True it will align the selected frames of this molecule to the corresponding frames of the refmol. This requires both molecules to have the same number of frames.
- Returns:
tmscore (
numpy.ndarray) – TM score (if normalized by length of ref) for each frame in molrmsd (
numpy.ndarray) – RMSD only OF COMMON RESIDUES for all frames. This is not the same as a full protein RMSD!!!nali (
numpy.ndarray) – Number of aligned residues for each frame in molalignments (
listofMolecules) – Each frame of mol aligned to reftransformation (
listofnumpy.ndarray) – Contains the transformation for each frame of mol to align to ref. The first element is the rotation and the second is the translation. Look at examples on how to manually produce the aligned structure.
Examples
>>> tmscore, rmsd, nali, alignments, transformation = molTMalign(mol, ref)
To manually generate the aligned structure for the first frame, first rotate, then translate >>> mol.rotateBy(transformation[0][0]) >>> mol.moveBy(transformation[0][1])
- moleculekit.align.molTMscore(mol, ref, molsel='protein', refsel='protein')#
Calculates the TMscore between two protein Molecules
This is a thin wrapper around
molTMalign()that does not return the aligned structures or transformation matrices (i.e. it callsmolTMalignwithreturn_alignments=False).- Parameters:
mol (
Molecule) – A Molecule containing a single or multiple framesref (
Molecule) – A reference Molecule containing a single frame. Will automatically keep only ref.frame.molsel (
str|ndarray) – Atoms of mol to use, as an atom selection string, a boolean mask, or an integer index array (seeMolecule.atomselect).refsel (
str|ndarray) – Atoms of ref to use, as an atom selection string, a boolean mask, or an integer index array (seeMolecule.atomselect).
- Returns:
tmscore (
numpy.ndarray) – TM score (normalized by length of ref) for each frame in molrmsd (
numpy.ndarray) – RMSD only OF COMMON RESIDUES for all frames. This is not the same as a full protein RMSD!!!nali (
numpy.ndarray) – Number of aligned residues for each frame in mol
Examples
>>> tmscore, rmsd, nali = molTMscore(mol, ref)