supplier

supplier(version=None, *, prefix=None, **kwargs)[source]

Get a rdkit.Chem.ForwardSDMolSupplier for the given version of ChEMBL.

Parameters:
  • version (Optional[str]) – The version number of ChEMBL to get. If none specified, uses latest() to look up the latest.

  • prefix (Optional[Sequence[str]]) – The directory inside pystow to use

  • kwargs – keyword arguments to pass through to rdkit.Chem.ForwardSDMolSupplier, such as sanitize and removeHs.

Yields:

A supplier to be used in a context manager

In the following example, a supplier is used to get fingerprints and SMILES.

from rdkit import Chem

import chembl_downloader

data = []
with chembl_downloader.supplier() as suppl:
    for i, mol in enumerate(suppl):
        if mol is None or mol.GetNumAtoms() > 50:
            continue
        fp = Chem.PatternFingerprint(mol, fpSize=1024, tautomerFingerprints=True)
        smi = Chem.MolToSmiles(mol)
        data.append((smi, fp))