- class openfe.setup.atom_mapping.LigandAtomMapping(componentA: SmallMoleculeComponent, componentB: SmallMoleculeComponent, componentA_to_componentB: dict[int, int], annotations: dict[str, Any] | None = None)#
Container for an atom mapping between two small molecule components.
This is a specialized version of
AtomMappingforSmallMoleculeComponentwhich stores the mapping as a dict of integers.- Parameters:
componentA (SmallMoleculeComponent) – the ligand molecules on either end of the mapping
componentB (SmallMoleculeComponent) – the ligand molecules on either end of the mapping
componentA_to_componentB (dict[int, int]) – correspondence of indices of atoms between the two ligands; the keys are indices in componentA and the values are indices in componentB. These are checked that they are within the possible indices of the respective components.
annotations (dict[str, Any]) – Mapping of annotation identifier to annotation data. Annotations may contain arbitrary JSON-serializable data. Annotation identifiers starting with
ofe-may have special meaning in other parts of OpenFE.scoreis a reserved annotation identifier.
- property componentA_to_componentB: dict[int, int]#
Maps the index of an item from Component A onto Component B
Keys are indices from Component A, values are indices from Component B.
Not all indices will be resolvable, these items have no corresponding entity in the other component (e.g. the atom disappears), therefore resulting in a KeyError on query
- property componentA_unique#
Indices of atoms in component A that aren’t mappable to B
- property componentB_unique#
Indices of atoms in component B that aren’t mappable to A
- property annotations#
Any extra metadata, for example the score of a mapping
- draw_to_file(fname: str, d2d=None)#
Save atom map visualization to disk
- Parameters:
d2d (
rdkit.Chem.Draw.rdMolDraw2D.MolDraw2D) – If desired specify an instance of a MolDraw2D object. DefaultNonewill write a .png file using the MolDraw2DCairo backend.fname (str) – Name of file to save atom map
- view_3d(spheres: bool | None = True, show_atomIDs: bool | None = False, style: str | None = 'stick', shift: Tuple[float, float, float] | NDArray[np.float64] | None = None) py3Dmol.view#
Render relative transformation edge in 3D using py3Dmol.
By default matching atoms will be annotated using colored spheres.
- py3Dmol is an optional dependency, it can be installed with:
pip install py3Dmol
- Parameters:
spheres (bool, optional) – Whether or not to show matching atoms as spheres.
show_atomIDs (bool, optional) – Whether or not to show atom ids in the mapping visualization
style (str, optional) – Style in which to represent the molecules in py3Dmol.
shift (Tuple of floats, optional) – Amount to shift molB by in order to visualize the two ligands. If None, the default shift will be estimated as the largest intraMol distance of both mols.
- Returns:
view – View of the system containing both molecules in the edge.
- Return type:
py3Dmol.view
- with_annotations(annotations: dict[str, Any]) LigandAtomMapping#
Create a new mapping based on this one with extra annotations.