Overlay: Difference between revisions
JeremyTame (talk | contribs) mNo edit summary |
JeremyTame (talk | contribs) mNo edit summary |
||
| Line 19: | Line 19: | ||
== Usage == | == Usage == | ||
Superimpose one | Superimpose one selection (of protein residues, whole ligands or individual atoms) onto another: | ||
<source lang="python"> | <source lang="python"> | ||
| Line 25: | Line 25: | ||
</source> | </source> | ||
The mobile object | The mobile selection and its entire parent object are transformed; the target remains fixed. | ||
The moving and target selections must therefore come from separate objects. | |||
For proteins, the fit uses corresponding C-alpha atoms. | For proteins, the fit uses corresponding C-alpha atoms. | ||
| Line 35: | Line 36: | ||
Protein residue correspondence can be specified using | Protein residue correspondence can be specified using | ||
strict residue-number matching or ordered matching. | strict residue-number matching (the default) or ordered matching. | ||
<source lang="python"> | <source lang="python"> | ||
Latest revision as of 06:53, 18 November 2026
overlay is a PyMOL Python script for least-squares superposition of molecular structures.
The script determines corresponding atoms, calculates the optimal rigid-body transformation, and applies the transformation to the mobile PyMOL object.
Installation
Download overlay.py from the project's GitHub repository: https://github.com/JezTame/pymol-overlay
Load the script in PyMOL:
run overlay.py
Usage
Superimpose one selection (of protein residues, whole ligands or individual atoms) onto another:
overlay mobile, target
The mobile selection and its entire parent object are transformed; the target remains fixed. The moving and target selections must therefore come from separate objects.
For proteins, the fit uses corresponding C-alpha atoms. For ligands, heavy atoms are matched by atom name.
The RMSD is reported in the PyMOL terminal.
Options
Protein residue correspondence can be specified using strict residue-number matching (the default) or ordered matching.
overlay mobile, target, mode=ordered
A text report is generated by default containing the rotation matrix, translation vector and screw-axis information.
Atom selection and correspondence
`overlay.py` can superimpose not only complete molecules but also selected portions of molecules, such as the adenosine or phosphate groups of ADP, ATP or NAD. For non-protein structures, the least-squares fit uses all selected non-hydrogen atoms.
The order of atom picking in the two selections is immaterial. Corresponding atoms are identified by their atom names, not by their order in the PDB file or in the PyMOL selection. The two selections being compared may contain atoms in completely different order, provided that every selected atom has a uniquely named counterpart in the other selection.
The script checks that atom names and element types agree before calculating the transformation. If the selections contain unmatched or duplicate atom names, an error is reported, and no fitting is performed.
The resulting rotation and translation are applied to the **entire parent object** of the moving selection, not just to the atoms used to calculate the fit. This allows, for example, the adenosine portions of ADP and NAD to be superimposed while retaining and transforming the complete molecules and the protein model of which they are a part.
Notes
The script performs least-squares superposition without iterative rejection of outliers.
Atom correspondence is validated before applying the fit.