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

  • mol (Molecule object) – A Molecule containing a single or multiple frames

  • ref (Molecule object) – A reference Molecule containing a single frame. Will automatically keep only ref.frame.

  • molsel (str) – Atomselect string for which atoms of mol to calculate TMScore

  • refsel (str) – Atomselect string for which atoms of ref to calculate TMScore

  • return_alignments (bool) – If True it will return the aligned structures of mol and the transformation matrices used to produce them

  • frames (list) – 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.


  • tmscore (numpy.ndarray) – TM score (if normalized by length of ref) for each frame in mol

  • rmsd (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

  • alignments (list of Molecules) – Each frame of mol aligned to ref

  • transformation (list of numpy.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.


>>> 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')#