# Binding affinity in the molecular laboratory ## Goal The laboratory's screening team needs a method that predicts binding affinity from the structure of a ligand bound to a protein. The team supplies paired spatial graphs and measured practice responses. Develop a method whose predictions track the measured responses on new complexes. The laboratory's data curator keeps related complexes in cohorts and assigns each complete cohort to one side of the split. The team provides no live experiment or query interface. ## What You Have | Path | Contents | |---|---| | `/app/methods/main/` | Your submission directory, initially containing the starter and its executable `run.sh`. | | `/app/core/` | Shared input readers, geometry helpers, and metric code; `CORE_DIR=/app/core` is set. | | `/app/data/` | Practice input directories, named by instance identifier. | | `/app/data-answers/` | Matching practice answer directories. | | `/app/selfcheck.py` | The rehearsal command described below. | The curator supplies `items.json` in each input directory. It is a JSON list of records with keys `id`, `cohort`, `left`, and `right`. The identifiers are opaque; preserve `id` when writing predictions. `left` is the ligand graph and `right` is the protein graph. Both use a shared spatial coordinate system. Each graph has `nodes` and `edges`. A node is `[kind, flag, x, y, z, weight]`: an atom-type category, a binary hydrogen indicator, spatial coordinates, and a signed partial-charge attribute. An edge is `[u, v, kind]`: zero-based node endpoints and a bond-type category. Edges are undirected. Equal category codes have consistent meanings across records and graphs; their numerical ordering has no meaning. Graph sizes vary, so read their arrays rather than assuming sizes. The tables below give the chemical meaning of every code. Atom types name an element and, for C, N, O, P and S, its hybridisation or chemical environment. The metal ions occur only in protein graphs. | code | atom type | meaning | code | atom type | meaning | |---:|---|---|---:|---|---| | 0 | `Br` | bromine | 14 | `N.2` | sp2 nitrogen | | 1 | `C.1` | sp carbon | 15 | `N.3` | sp3 nitrogen | | 2 | `C.2` | sp2 carbon | 16 | `N.4` | positively charged sp3 nitrogen | | 3 | `C.3` | sp3 carbon | 17 | `N.am` | amide nitrogen | | 4 | `C.ar` | aromatic carbon | 18 | `N.ar` | aromatic nitrogen | | 5 | `C.cat` | carbocation carbon of a guanidinium group | 19 | `N.pl3` | trigonal planar nitrogen | | 6 | `Ca` | calcium ion | 20 | `Na` | sodium ion | | 7 | `Cl` | chlorine | 21 | `O.2` | sp2 oxygen | | 8 | `F` | fluorine | 22 | `O.3` | sp3 oxygen | | 9 | `H` | hydrogen | 23 | `O.co2` | carboxylate or phosphate oxygen | | 10 | `I` | iodine | 24 | `P.3` | sp3 phosphorus | | 11 | `Mg` | magnesium ion | 25 | `S.3` | sp3 sulfur | | 12 | `Mn` | manganese ion | 26 | `S.o2` | sulfone sulfur | | 13 | `N.1` | sp nitrogen | 27 | `Zn` | zinc ion | | code | bond type | meaning | |---:|---|---| | 0 | `1` | single | | 1 | `2` | double | | 2 | `3` | triple | | 3 | `am` | amide | | 4 | `ar` | aromatic, also used for delocalised bonds such as carboxylate C-O | | 5 | `un` | unknown; here almost only contacts between a metal ion and the atoms it coordinates | Each practice instance contains 15 records. Inspect the actual arrays in `/app/data/visible-0000/items.json` for a complete input example. The curator supplies practice responses separately in `values.tsv`, with the exact header `idvalue`, where `` denotes a literal tab. The response is an unrestricted finite real number: the complex's measured binding affinity as pKd or pKi, that is -log10 of its dissociation or inhibition constant in mol/L, so a higher value means tighter binding. Answers are absent from method inputs. ## What You Submit The screening team accepts a general method in `/app/methods/main/`, containing an executable `run.sh` and all learned parameters and helper files it needs. You may replace the starter entirely. The entry contract is `run.sh `. The grading service transfers only this submission directory into a clean container with the installed runtime and `/app/core/`; other session files are unavailable. The grader calls your method once per instance, as an unprivileged account. It provides read-only inputs in the data directory and a writable output directory. Write `predictions.tsv` there, with header `idvalue` and exactly one finite value for every input identifier. Row order is free. Predictions are unrestricted finite real numbers. The grader rejects missing, extra, duplicate, malformed, or non-finite predictions. Each output must be a regular text file of at most 64 MB. If you supply `/app/methods/main/build.sh`, the grader runs it once before inference, offline, within 900 seconds. A failed build fails the entire submission. Keep every dependency needed by that build in your submission or use the installed runtime. ## Budget The grading service gives each method call 60 seconds, 4 CPUs, and 8 GB of memory, with no network access. `TASK_BUDGET_SEC` reports the time budget. Set worker and thread counts to fit those resources. The grader kills a method at its deadline and kills any process it leaves running after `run.sh` returns; either case fails that instance. The development session has 12 hours, 4 CPUs, and 16 GB of memory, with no network access. The session and grading each have 10 GB of storage. ## How It Is Judged The laboratory evaluator scores 9 sealed instances. Their inputs and answers are available only in the grading container, not during development. For predictions `p` and measured responses `y` within an instance, the evaluator computes the centered linear correlation: `sum((p_i-mean(p))*(y_i-mean(y))) / sqrt(sum((p_i-mean(p))^2)*sum((y_i-mean(y))^2))` Higher is better. The evaluator uses stable floating-point scaling; a constant vector scores 0. Positive affine changes to predictions leave correlation unchanged. The score is at most 1. The evaluator's failure score is -2 for rejected predictions, method failure, timeout, or a process left running. The final score is the arithmetic mean of the sealed instance scores, including failures. It is not a single correlation computed after concatenating every instance. ## Self-check Run the laboratory's local check: ```sh python3 /app/selfcheck.py rehearse ``` The rehearsal runs your submitted method on every practice instance under grading conditions: the same sandbox, unprivileged account, time limit, and metric. Its last line is a JSON object with a `score` field giving the arithmetic mean of the practice instance scores. This is a local smoke test and practice evaluation; the graded score is computed separately. The starter predicts the number of non-hydrogen ligand-protein atom pairs within a distance of 4.5 and has no learned parameters. You may fit models using the practice responses and save their parameters inside your submission directory. Hold out complete practice cohorts when comparing methods to avoid validating on closely related complexes used for fitting.