Tutorial 8

Molecular Generation

Search chemical space against a real (cheaply-configured) protein-ligand docking oracle — random search, a genetic algorithm, and a surrogate-guided active-learning loop, compared at the same oracle-call budget, then submitted to a leaderboard that's graded independently and accurately.

Jules Schleinitz
105 min
Python · Google Colab
Back to schedule

Open in Google Colab

The notebook has most of the code pre-filled. Complete the exercises marked ### YOUR CODE HERE ###.

Open Notebook

Getting started

Open the Colab notebook using the button above. Run each cell in order; cells marked Exercise require you to fill in code.

  1. Set up the oracle (a). Install smina/openbabel via condacolab, fetch and parse the EGFR (2ITO) structure, define the binding pocket, and benchmark cheap vs. the docking tutorial's own accurate settings.

  2. Random search (b). Generate random SELFIES-based molecules and dock them — every string decodes to a valid molecule by construction, so nothing is wasted on invalid candidates. This is your undirected baseline.

  3. Genetic algorithm (c). Implement mutation and tournament selection; evolve a population against the same oracle-call budget as random search.

  4. Surrogate-guided active learning (d). Train a random-forest surrogate on Morgan fingerprints, and use an uncertainty-aware acquisition score to decide which candidates are worth a real docking call.

  5. Challenge + bonus. Submit your single best candidate's SMILES to the leaderboard — it's graded independently, at the docking tutorial's own accurate settings, not your cheap exploration numbers. Then, in the bonus section, see how adding QED and toxicity-alert objectives changes what "best" means.


Answer these questions as you work through the notebook. Discuss with your neighbour — some have no single right answer.

    Warm-up

    Which of the three methods found its best molecule using the fewest real oracle calls in your run? Does that match how much feedback each method actually uses from previous evaluations?

    Easy
    Core

    Your notebook's cheap-settings docking score for your submitted candidate will very likely differ from its official leaderboard score (exhaustiveness=8, num_modes=10). By how much, and in which direction — is cheap docking optimistic or pessimistic here?

    Medium
    Core

    Look at the Pareto front from the bonus section. Pick one non-dominated point that isn't the single best docking score. What would you need to know about the underlying chemistry to decide whether it's actually a better drug candidate than the top-docking-score molecule?

    Medium
    Challenge

    Swap evaluate()'s return value for a weighted combination of docking score, QED, and toxicity alerts, and re-run the genetic algorithm from part (c). Does the population's docking score get worse? Does its QED get better? Report both.

    Challenge

Class challenge results

Submit your single best candidate's SMILES using the notebook's challenge cell. Unlike the fine-tuning tutorial, this score is not self-reported: it's graded independently by the instructor, using the docking tutorial's own accurate settings (exhaustiveness=8, num_modes=10), so every team's number is directly comparable. Grading isn't instant — check back a few minutes after submitting. Only each team's best (lowest) affinity is shown.

Loading leaderboard…
Loading…
No graded entries yet.

Notebook (Colab) Solutions (Colab) Paired lecture notes T015 docking talktorial Jensen 2019 (graph-based GA)