Skip to content

Integration of RGI-toolkit - #858

Merged
YoshitakaMo merged 39 commits into
sokrypton:mainfrom
cddlab:rgi-integration
Oct 13, 2026
Merged

YoshitakaMo merged 39 commits into
sokrypton:mainfrom
cddlab:rgi-integration

Conversation

@YoshitakaMo

Copy link
Copy Markdown
Collaborator

Current AF3-based structure prediction methods suffer from a critical limitation: the predicted stereochemistry of ligand molecules does not always match the enantiomers or diastereomers specified by the user. To address this issue, we developed the RGI-toolkit and implemented an interface that makes it accessible through ColabFold. The method and its benchmark results are currently available as a preprint on bioRxiv: https://www.biorxiv.org/content/10.64898/2026.10.05.756905v1 .

In addition to correcting ligand stereochemistry, this method allows users to apply flexible and extensible physical restraints to molecules. This enables users to specify and enforce desired distances between arbitrary atoms, including those belonging to different molecules, in AF3-predicted structures.

sokrypton and others added 30 commits September 16, 2026 18:15
Two changes, both already on sokrypton/alphafold3@main.

The model table says DeepMind's parameters are granted on request, for
non-commercial research, at Google's discretion -- and the install cell
was wgetting them from a public bucket and printing "public, no login
required". The URL does serve 1,020 MB, but reachable is not the same as
ours to hand out. The `alphafold3` entry now looks for a .bin.zst you
placed in af3_native_weights/ yourself and, if there is none, says where
to request them. Every other model still fetches its own weights.

And most of the comments in the three code cells were a log of last
night's debugging -- why %%time was removed, what a HuggingFace 429
looked like, which wheel used to be installed. That belongs in the
history, not in front of someone trying to fold a protein. No behaviour
change; what is left explains a decision a reader cannot infer.

Verified on a cold Colab T4 before pushing: setup 34 s, fold 68 s, ATP
ligand present (31 HETATM), zero rasa warnings. Also green on A100
(Triton path) and L4 (XLA fallback).
Still too much explaining of history rather than of code: what %%time
did, what a 429 looked like, what `Done ->` used to print, the exact
RMSDs a language model is worth. What is left says what a line does or
why it could not be simpler.

No behaviour change; the AlphaFold 3 message still names the request
page and the directory to put the file in.
The table row said they are granted on request and the install cell had
been changed to match; the bucket is DeepMind's intended public release,
so the row is what needed fixing. A copy already in af3_native_weights/
is now used as-is rather than deleted before downloading.

Verified on a cold Colab T4: 1 GB in 15 s, fold in 62 s.
The int8 weights were republished with per-block scales (and with the parameters
several blobs were missing -- boltz2 and opendde would not load at all). 3.1.10's
loader raises on the new scale records, so the pin has to move with them.
Add beginner distance and ligand forms, custom configurations, and per-seed geometry reports while preserving vanilla execution. Reuse the shared AF3 adapter in the pinned ColabFold JAX runtime and the native Boltz-1 fork.

Validate all supported models on Slurm GPUs, complete guided and vanilla Colab notebook runs, and add reproducible sampler and batch-isolation checks.
Replace preset-specific controls with the shared RGI-toolkit editor for
distance, conformer, angle, custom and RMSD. Read the current form when
prediction starts and preserve the existing optional vanilla path.
Pin the toolkit revision, update E2E fixtures to native configuration,
and keep detailed form documentation with the toolkit.
Number the setup and prediction cells, link directly to Configure RGI,
and show a complete distance example before execution. Explain that the
editable form appears below its cell after pressing play. Replace outdated
Run all and preset instructions and report skipped configuration steps
before starting prediction. Pin the toolkit's guided editor and exercise
these notebook cells in regression tests.
Keep the original headings and Run all workflow. Put the RGI switch and editable fields in one native Colab form, with toolkit parsing for repeated and mixed restraints. Remove widget-only interaction and its dependency.
Route SM 12 devices away from Triton in notebook commands and the installed
Tokamax and predictor capability gates. Share the compatibility patch with the
E2E runner and cover fresh installs, previously patched installs, and reruns.

Enable verbose restraint inventory output in the native Boltz E2E fixture.
Track RGI-generated features so enabling RGI, editing restraints, and returning to vanilla cannot reuse incompatible preprocessing. Preserve vanilla-only cache reuse and add regression coverage.
Copilot AI balanced review requested due to automatic review settings October 9, 2026 15:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The download cell breaks configured output paths, and citation deduplication does not handle alternate BibTeX entry types.

3 open findings
What changed in this PR

Integrates optional RGI-guided restraints into ColabFold’s AF3-family and Boltz workflows while preserving vanilla prediction paths.

Changes:

  • Adds RGI sampler/runtime adapters, reporting, and citations.
  • Adds notebook forms and guided/vanilla execution paths.
  • Adds unit, notebook, citation, and end-to-end coverage.
File Description
colabfold/​rgi/​__init__.py Defines supported models and version pin.
colabfold/​rgi/​__main__.py Wraps the upstream prediction CLI.
colabfold/​rgi/​sampler.py Instruments diffusion sampling with restraint hooks.
colabfold/​rgi/​runtime.py Integrates RGI into parsing, inference, and reporting.
colabfold/​rgi/​notebook.py Prepares notebook inputs and job names.
colabfold/​rgi/​boltz.py Builds RGI-capable Boltz YAML inputs.
colabfold/​citations.py Adds RGI bibliography generation.
ColabFold2_preview.ipynb Adds RGI controls and guided execution.
AlphaFold3_of3.ipynb Adds model selection and RGI workflow.
Boltz1.ipynb Adds isolated vanilla/RGI Boltz environments.
docs/​rgi.md Documents notebook usage.
scripts/​rgi_e2e.py Validates paired real predictions.
scripts/​rgi_boltz1_e2e.py Validates native Boltz-1 integration.
scripts/​rgi_batch_e2e.py Validates multi-job state isolation.
tests/​test_rgi_sampler.py Tests sampler instrumentation.
tests/​test_rgi_notebook.py Tests notebook input behavior.
tests/​test_notebook_vanilla.py Tests vanilla-path isolation.
tests/​test_citations.py Tests citation and archive handling.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread ColabFold2_preview.ipynb Outdated
Comment thread colabfold/citations.py Outdated
Comment thread ColabFold2_preview.ipynb Outdated
@YoshitakaMo
YoshitakaMo force-pushed the rgi-integration branch 2 times, most recently from 84177be to 233d6ac Compare October 9, 2026 16:02
@YoshitakaMo
YoshitakaMo merged commit 90ebb22 into sokrypton:main Oct 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants