kartograf.mapping_metrics#

kartograf.mapping_metrics.metric_mapping_rmsd#

class kartograf.mapping_metrics.metric_mapping_rmsd.MappingRMSDScorer#

Bases: _AbstractAtomMappingScorer

get_rmsd(mapping: AtomMapping) float#

this function calculates the rmsd between the mapped atoms of the two molecules

Parameters:

mapping (AtomMapping) – A mapping to be scored

Returns:

returns non-normalized rmsd

Return type:

float

get_rmsd_p(mapping: AtomMapping, accepted_distance_rmsd: float = 0.5, k_hook: float = 1, T: float = 298) float#

estimate likelihood of this shift by calculating the probability of the rmsd of the mapping with a harmonic oscillator

Parameters:
  • mapping (AtomMapping) – A mapping to be scored

  • k_hook (float, optional) – hook constant of the harmonic oscillator

  • T (float, optional) – Temperature

Returns:

likelihood of the shift (1-p)

Return type:

float

get_score(mapping, accepted_distance_rmsd: float = 0, k_hook: float = 1, T: float = 298) float#
Calculate mapping RMSD based score

returns a normalized value between 0 and 1, where 1.0 is the best and 0.0 is the worst score.

Parameters:
  • mapping (AtomMapping) – A mapping to be scored

  • k_hook (float, optional) – hook constant of the harmonic oscillator

  • T (float, optional) – Temperature

Returns:

normalized score between 0 and 1.

Return type:

float

kartograf.mapping_metrics.metric_shape_difference#

class kartograf.mapping_metrics.metric_shape_difference.MappingShapeMismatchScorer(grid_spacing: float = 0.5, vdw_scale: float = 0.8, ignore_hs: bool = False, max_layers: int = -1, step_size: float = 0.25)#

Bases: _MappingShapeDistanceScorer

Shape mismatch based scorer This class uses the _MappingShapeDistanceScorer with the settings such, that the volume mismatches of the two molecules are taken into consideration.

Parameters:
  • gridSpacing (float, optional) – spacing of the grid for shape calculation, defaults to 0.5

  • vdwScale (float, optional) – range of vdw interactions, defaults to 0.8

  • ignoreHs (bool, optional) – shall Hs be counted as well?, defaults to True

  • maxLayers (int, optional) – number of bits per gridpoints, defaults to -1

  • stepSize (int, optional) – step size between layers, defaults to 0.25

class kartograf.mapping_metrics.metric_shape_difference.MappingShapeOverlapScorer(grid_spacing: float = 0.5, vdw_scale: float = 0.8, ignore_hs: bool = False, max_layers: int = -1, step_size: float = 0.25)#

Bases: _MappingShapeDistanceScorer

Shape overlap based scorer This class uses the _MappingShapeDistanceScorer with the settings such, that the overlap of the two molecules are taken into consideration.

Parameters:
  • gridSpacing (float, optional) – spacing of the grid for shape calculation, defaults to 0.5

  • vdwScale (float, optional) – range of vdw interactions, defaults to 0.8

  • ignoreHs (bool, optional) – shall Hs be counted as well?, defaults to True

  • maxLayers (int, optional) – number of bits per gridpoints, defaults to -1

  • stepSize (int, optional) – step size between layers, defaults to 0.25

kartograf.mapping_metrics.metric_volume_ratio#

class kartograf.mapping_metrics.metric_volume_ratio.MappingRatioMappedAtomsScorer#

Bases: _AbstractAtomMappingScorer

get_score(mapping: AtomMapping) float#

calculate the number of mapped atoms/number of atoms in the larger molecule

Parameters:

mapping (AtomMapping) – AtomMapping to be scored

Returns:

normalized ratio of mapped atoms.

Return type:

float

class kartograf.mapping_metrics.metric_volume_ratio.MappingVolumeRatioScorer#

Bases: _AbstractAtomMappingScorer

get_score(mapping: AtomMapping) float#
Calculate a Volume ratio based score

returns a normalized value between 0 and 1, where 0 is the best and 1 ist the worst score.

Parameters:
  • mapping (AtomMapping) – A mapping to be scored

  • k_hook (float, optional) – hook constant of the harmonic oscillator

  • T (float, optional) – Temperature

Returns:

normalized score between 0 and 1.

Return type:

float

get_volume_ratio(mapping: AtomMapping) float#

Calculate volume ratio this function calculates the ratio of the volume of the convex hull of the mapped atoms to the volume of the convex hull of the complete molecule

Parameters:

mapping (AtomMapping) – mapped to be scored

Returns:

returns the ratio of the volume of the convex hull of the mapped atoms to the volume of the convex hull of the complete molecule

Return type:

float

Raises:

ValueError – _description_

kartograf.mapping_metrics.metrics_mapping_comparisons#

kartograf.mapping_metrics.metrics_mapping_comparisons.jaccard_score(mappingA: AtomMapping, mappingB: AtomMapping) float#
Calculate the Jaccard score for mapping diversity

The Jaccard score is a normalized score ([0,1]) , that gives insight on the selected atom pair diversity of two compared mappings. Diversity is expressed here as the change in atom assignments, if the score is 1 the mappings are identical. If the score is 0, the two mapping consist of entirely different atom mapping pairs.

Parameters:
  • mappingA (AtomMapping)

  • mappingB (AtomMapping)

Returns:

the calculated Jaccard Score [0, 1]

Return type:

float