liveBook · Manning

Labeler

As explained in Build AI Drug Discovery Pipelines

An oracle is an authoritative labeling mechanism that converts an unlabeled data point into an accurate label at a specified computational, human, or financial cost.

An oracle is an authoritative mechanism that turns an unlabeled data point into an accurate label, at a cost in human time, computation, or money. In drug discovery, AutoDock Vina acts as the oracle: it docks a molecule and returns a docking score. Because docking every compound in a huge library is impractical, active learning uses oracle calls selectively. section 9.2.6 section 9.2.7

A proxy oracle can speed up development by returning scores from compounds that have already been docked. Once strategies are tested, replace the proxy with real docking calls; the active-learning framework stays the same. A deterministic proxy also supports reproducible benchmarking. section 9.2.6

Listing 9.9 Defining the Oracle
def vina_oracle(    #A
    smiles_list,    #B
    box,    #C
    receptor_file,    #D
    num_poses=5, **kwargs):
    params = Chem.SmilesParserParams()
    params.removeHs = False
 
    scores = []
    for smiles in smiles_list:
        mol = Chem.MolFromSmiles(smiles, params)
        mol = Chem.AddHs(mol)
 
        has_3d = False
        try: has_3d = mol.GetConformer().Is3D()
        except: has_3d = False
        if not has_3d:
            AllChem.EmbedMolecule(mol, randomSeed=42)
            AllChem.MMFFOptimizeMolecule(mol)
        docking_program = VinaDocking(
            receptor_file, box, num_poses=num_poses
        )
        score = docking_program.dock_mol(mol)    #E
        scores.append(score)
    return scores
 
def deepdock_oracle(smiles_list, **kwargs):    #F
    score_column = kwargs.get("score_column", "r_i_docking_score")
 
    score_lookup = (
        reference_df
        .drop_duplicates(subset="SMILES", keep="first")
        .set_index("SMILES")[score_column]
    )
 
    missing_smiles = [
        smiles for smiles in smiles_list 
        if smiles not in score_lookup.index
    ]
    if missing_smiles:
        raise KeyError(f"{len(missing_smiles)} SMILES not found.")
    return score_lookup.loc[smiles_list].to_numpy(dtype=float)

The listing shows a Vina oracle that prepares molecules and returns docking scores, alongside a proxy-oracle interface. section 9.2.6

How Build AI Drug Discovery Pipelines covers it

How deep it goes
Defines human and computational oracles, then explains a docking proxy and its replacement; it does not detail docking internals.
Examples
Uses human image labelers, linguistic text annotators, AutoDock Vina, and a pre-docked-data proxy as examples.
What you can do after
Build it from scratch by defining a Vina scoring function or a proxy that returns precomputed docking labels.
How it connects
Connects oracle calls to active learning, molecular docking, and surrogate models.

Also explained in

Compare how 2 books explain labeler →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build AI Drug Discovery Pipelines. The section links point to the parts of the book it draws on.