Trouble configuring R-group substitution in REINVENT 4 (AstraZeneca) — validation errors for RLConfig and ScorerConfig #286
Unanswered
udohayavoyager-cpu
asked this question in
Q&A
Replies: 1 comment
-
|
Hi, we have various TOML examples in Many thanks, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I’m using AstraZeneca’s REINVENT 4 (v4.6.27) to generate SMILES from a scaffold via R-group substitution, optimizing for 5-HT2A / D2 / 5-HT1A (maximize) and minimizing H1 / M1 / α1A, with DockStream docking plus QED/logP/SA.
A small test run works, but my R-group config fails during scoring validation.
Environment
Ubuntu (GCP VM), CPU only
Python 3.10.18, PyTorch 2.1.1+cpu
RDKit 2025.03.6
REINVENT 4.6.27
DockStream installed; Vina set up
reinvent CLI runs other examples OK
Command + Error
reinvent -l logs/rgroup_gpcr/run.log config_rgroup_gpcr.toml
Traceback (most recent call last):
...
scoring_function = Scorer(stage.scoring)
...
pydantic.error_wrappers.ValidationError: 1 validation error for ScorerConfig
component
field required (type=value_error.missing)
(Earlier I also saw: component -> 0 -> component_type value is not a valid dict.)
Current (non-working) driver (trimmed)
config_rgroup_gpcr.toml
run_type = "staged_learning"
use_cuda = false
tb_logdir = "logs/rgroup_gpcr/tensorboard"
[learning_strategy]
type = "dap"
batch_size = 48
sigma = 128.0
rate = 0.0003
[[stage]]
min_steps = 1
max_steps = 150
max_score = 1.0
termination = "max_steps"
chkpt_file = "models/agent_rgroup_gpcr.prior"
[stage.model_config]
prior_file = "models/reinvent.prior"
agent_file = "models/reinvent.prior"
[stage.model_config.r_group_replacement]
scaffold_file = "data/scaffold.smi"
attachment_token = "[*]"
max_replacements = 5000
[stage.diversity_filter]
type = "scaffold_similarity"
min_similarity = 0.4
bucket_size = 25
penalty = 0.5
[stage.scoring]
type = "custom_sum"
Example component (pattern repeated)
[[stage.scoring.component]]
component_type = "DockStream" # <-- likely wrong shape?
name = "dock_5HT2A"
weight = 0.26
[stage.scoring.component.parameters]
config_path = "dockstream_gpcr.json"
endpoint = "HTR2A_vina"
What I’ve tried
Moving stage to top-level vs in [parameters]
Using [[stage]] array
Setting learning_strategy at top level (dap), which removed earlier errors
Switching components → component (singular)
Still get ScorerConfig complaining that component is missing or that component_type should be a dict
Question
What is the correct TOML schema for REINVENT 4 staged_learning scoring components?
Specifically, should each [[stage.scoring.component]] be a dict keyed by the component type (e.g., DockStream, qed) rather than a component_type="..." string?
If so, is this the right shape?
[stage.scoring] type = "custom_sum" parallel = 1
[[stage.scoring.component]]
[stage.scoring.component.DockStream]
name = "dock_5HT2A"
weight = 0.26
[stage.scoring.component.DockStream.parameters]
config_path = "dockstream_gpcr.json"
endpoint = "HTR2A_vina"
[stage.scoring.component.DockStream.transform]
type = "double_sigmoid"
low = -10.5
high = -7.5
[[stage.scoring.component]] [stage.scoring.component.qed] weight = 0.05
A minimal, working example for R-group replacement + DockStream in REINVENT 4 would be hugely appreciated — or a pointer to updated schema docs.
Thanks!
✅ What I tried
I successfully ran REINVENT 4 example configurations (standard reinforcement learning and DockStream integration).
I then created a new configuration (config_rgroup_gpcr.toml) for R-group replacement using r_group_replacement inside [stage.model_config].
I also created a corresponding stage_rgroup_gpcr.toml for reinforcement learning settings and scoring components.
I verified that the REINVENT environment, models, and DockStream setup were correct — e.g.:
reinvent -h works
simple runs (like logP optimization) complete successfully
dockstream_gpcr.json runs correctly when executed independently
I tried multiple formats for the scoring section:
Using [[stage.scoring.component]] blocks with component_type = "DockStream".
Using the dict-based form ([stage.scoring.component.DockStream]).
Moving stage to top-level, parameters, and array-style syntax.
Each variant removes some earlier validation errors, but I still get:
pydantic.error_wrappers.ValidationError: component -> 0 -> component_type value is not a valid dict
— meaning REINVENT’s internal ScorerConfig expects a different TOML structure for scoring components.
✅ What I expected
I expected REINVENT 4 to:
Load the staged learning configuration successfully.
Recognize my DockStream components and physchem scoring functions (qed, logp, sascore).
Begin generating R-group substituted molecules based on docking scores and physchem constraints.
Output generated SMILES to a .csv file (defined in [output]) and a trained agent model file.
Beta Was this translation helpful? Give feedback.
All reactions