kartograf.atom_mapper#
- class kartograf.atom_mapper.KartografAtomMapper(*, atom_max_distance: float = 0.95, atom_map_hydrogens: bool = True, map_hydrogens_on_hydrogens_only: bool = False, map_exact_ring_matches_only: bool = True, allow_partial_fused_rings: bool = True, additional_mapping_filter_functions: Iterable[Callable[[Mol, Mol, dict[int, int]], dict[int, int]]] | None = None, _mapping_algorithm: str = mapping_algorithm.linear_sum_assignment)#
Bases:
AtomMapper
Geometry Based Atom Mapper This mapper is a homebrew, that utilises rdkit in order to generate an atom-mapping based on the coordinates of two molecules.
- Parameters:
atom_max_distance (float, optional) – geometric criteria for two atoms, how far their distance can be maximal (in Angstrom). Default 0.95
map_hydrogens_on_hydrogens_only (bool, optional) – map hydrogens only on hydrogens. Default False
map_exact_ring_matches_only (bool, optional) – if true, only rings with matching ringsize and same bond-orders will be mapped. Additionally no ring-breaking is permitted. default False
additional_mapping_filter_functions (Iterable[Callable[[Chem.Mol,)
Chem.Mol – with this optional parameter you can further filter the distance based mappings with your own custom filters, provided as iterables. as default we suggest to avoid ring size/breaking changes and only allow whole rings to be mapped. These filters will be applied before any defaults
Dict[int – with this optional parameter you can further filter the distance based mappings with your own custom filters, provided as iterables. as default we suggest to avoid ring size/breaking changes and only allow whole rings to be mapped. These filters will be applied before any defaults
int]] – with this optional parameter you can further filter the distance based mappings with your own custom filters, provided as iterables. as default we suggest to avoid ring size/breaking changes and only allow whole rings to be mapped. These filters will be applied before any defaults
Dict[int – with this optional parameter you can further filter the distance based mappings with your own custom filters, provided as iterables. as default we suggest to avoid ring size/breaking changes and only allow whole rings to be mapped. These filters will be applied before any defaults
int]]] – with this optional parameter you can further filter the distance based mappings with your own custom filters, provided as iterables. as default we suggest to avoid ring size/breaking changes and only allow whole rings to be mapped. These filters will be applied before any defaults
optional – with this optional parameter you can further filter the distance based mappings with your own custom filters, provided as iterables. as default we suggest to avoid ring size/breaking changes and only allow whole rings to be mapped. These filters will be applied before any defaults
_mapping_algorithm (str, optional) – mapping_algorithm.linear_sum_assignment - this allows to swap the optimization algorithm. Not recommended.
allow_partial_fused_rings (bool) – If we should allow partially mapped fused rings (True) or not (False). Default True.
Notes
The
additional_mapping_filter_functions
will be applied before any default filters, to change this turn off all defaults and pass the full list of filters in the order they should be applied.- atom_map_hydrogens: bool#
- atom_max_distance: float#
- property map_exact_ring_matches_only: bool#
this property is a shortcut for setting exact ring matches only.
- property map_hydrogens_on_hydrogens_only: bool#
this property is a shortcut for setting hydrogen shall be mapped only on hydrogen filter.
- mapping_algorithm: Callable[[ndarray[Any, dtype[_ScalarType_co]], float], dict[int, int]]#
- suggest_mapping_from_rdmols(molA: Mol, molB: Mol, masked_atoms_molA: list | None = None, masked_atoms_molB: list | None = None, pre_mapped_atoms: dict | None = None) dict[int, int] #
Mapping Function with RDkit The function effectivly maps the two molecules on to each other and applies the given settings by the obj.
- Parameters:
molA (rdkit.Chem.Mol) – two rdkit molecules that should be mapped onto each other
molB (rdkit.Chem.Mol) – two rdkit molecules that should be mapped onto each other
masked_atoms_molA (list, optional) – remove categorical atoms by index of MolA from the mapping, by default []
masked_atoms_molB (list, optional) – remove categorical atoms by index of MolB from the mapping, by default []
pre_mapped_atoms (dict, optional) – pre_mapped atoms, that need to be part of the mapping, by default {}
- suggest_mappings(A: ExplicitMoleculeComponent, B: ExplicitMoleculeComponent) Iterator[LigandAtomMapping] #
Mapping generator - Gufe return a generator for atom mappings.
- Parameters:
A (ExplicitMoleculeComponent) – molecule A to be mapped.
B (ExplicitMoleculeComponent) – molecule B to be mapped.
- Returns:
returns an interator of possible atom mappings.
- Return type:
Iterator[AtomMapping]
- kartograf.atom_mapper.calculate_edge_weight(x, y)#
- class kartograf.atom_mapper.mapping_algorithm(*values)#
Bases:
Enum
This enum helps selecting the optimization algorithm for the distance graph based atom mapping.
- linear_sum_assignment = 'LSA'#
- minimal_spanning_tree = 'MST'#
- kartograf.atom_mapper.vector_eucledean_dist(x, y)#