mlchem.chem.calculator.descriptors.get_fingerprint

get_fingerprint(mol_input: Mol | str, fp_type: Literal['m', 'ap', 'rk', 'tt', 'mac'] = 'm', radius: int = 2, nBits: int = 2048, include_chirality: bool = False, include_bit_info: bool = False) tuple | Mol

Generate a molecular fingerprint using RDKit.

This function generates a fingerprint for a molecule using one of several RDKit-supported types. Optionally, bit information can be returned for interpretability.

Parameters:
  • mol_input (str or rdkit.Chem.rdchem.Mol) – Molecule in SMILES format or as an RDKit Mol object.

  • fp_type ({'m', 'ap', 'rk', 'tt', 'mac'}, optional) – Type of fingerprint to generate: - ‘m’: Morgan - ‘ap’: Atom Pair - ‘rk’: RDKit - ‘tt’: Topological Torsion - ‘mac’: MACCS keys Default is ‘m’.

  • radius (int, optional) – Radius or path length depending on fingerprint type. Default is 2.

  • nBits (int, optional) – Size of the fingerprint. Default is 2048.

  • include_chirality (bool, optional) – Whether to include chirality. Default is False.

  • include_bit_info (bool, optional) – Whether to return bit information. Default is False.

Returns:

Fingerprint of the molecule. If include_bit_info is True, returns a tuple (fingerprint, bit_info_dict).

Return type:

tuple or rdkit.DataStructs.cDataStructs.ExplicitBitVect

Examples

>>> get_fingerprint("CCO", fp_type='m', include_bit_info=True)