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 AtomMapping for SmallMoleculeComponent which 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. score is a reserved annotation identifier.

property componentA: Component#

A copy of the first Component in the mapping

property componentB: Component#

A copy of the second Component in the mapping

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 componentB_to_componentA: dict[int, int]#

Similar to A to B, but reversed.

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. Default None will write a .png file using the MolDraw2DCairo backend.

  • fname (str) – Name of file to save atom map

with_annotations(annotations: dict[str, Any]) LigandAtomMapping#

Create a new mapping based on this one with extra annotations.

Parameters:

annotations (dict[str, Any]) – Annotation update for this mapping. New annotation keys will be added to the annotations dict; existing keys will be replaced by the data provided here.

get_distances() ndarray[Any, dtype[float64]]#

Return the distances between pairs of atoms in the mapping