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_fnandbond_dist_fn.- Parameters
mol1 – RDKit
Chem.Molobject.mol2 – RDKit
Chem.Molobject.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/bond2can beNonefor non-edges.backend – (default:
pygmtools.BACKENDvariable) backend for computation.
- Returns
affinity matrix corresponding to
mol1andmol2.