pygmtools.utils.build_aff_mat_from_rdkit

pygmtools.utils.build_aff_mat_from_rdkit(mol1, mol2, atom_dist_fn=None, bond_dist_fn=None, backend=None)[source]

Build affinity matrix from two RDKit molecule objects.

The default distance metrics are:

  • atom distance = 1 if atom types are different, else 0;

  • bond distance = 1 if bond types are different, or one side has a bond while the other side has no bond, else 0.

Users can pass custom distance functions via atom_dist_fn and bond_dist_fn.

Parameters
  • mol1 – RDKit Chem.Mol object.

  • mol2 – RDKit Chem.Mol object.

  • atom_dist_fn – callable with signature atom_dist_fn(atom1, atom2) -> float.

  • bond_dist_fn – callable with signature bond_dist_fn(bond1, bond2) -> float. bond1/bond2 can be None for non-edges.

  • backend – (default: pygmtools.BACKEND variable) backend for computation.

Returns

affinity matrix corresponding to mol1 and mol2.