fraggle_distance#
- skfp.distances.fraggle_distance(mol_query: Mol, mol_ref: Mol, tversky_threshold: float = 0.8) float #
Fraggle distance between molecules.
Computes the Fraggle distance [1] [2] between two RDKit
Mol
objects by subtracting similarity value from 1, using the formula:\[dist(a, b) = 1 - sim(a, b)\]See also
fraggle_binary_similarity()
. The calculated distance falls within the range \([0, 1]\). Passing all-zero vectors to this function results in a distance of 0. Note that this measure is asymmetric, and order of query and reference molecules matters.- Parameters:
mol_query (RDKit
Mol
object) – Query molecule.mol_ref (RDKit
Mol
object) – Reference molecule.tversky_threshold (float, default=0.8) – Required minimal Tversky similarity [3] between a fragment and the reference molecule.
- Returns:
similarity – Fraggle similarity between
mol_query
andmol_ref
.- Return type:
float
References
Examples
>>> from rdkit.Chem import MolFromSmiles >>> from skfp.distances import fraggle_distance >>> mol_query = MolFromSmiles("COc1cc(CN2CCC(NC(=O)c3cncc(C)c3)CC2)c(OC)c2ccccc12") >>> mol_ref = MolFromSmiles("COc1ccccc1") >>> dist = fraggle_distance(mol_query, mol_ref) >>> dist 0.8359375