Skip to content

Commit 974f25c

Browse files
committed
update docs
1 parent 52ab428 commit 974f25c

22 files changed

Lines changed: 194 additions & 77 deletions

batter/orchestrate/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def _require_rbfe_network_has_pairs(config_dir: Path) -> None:
265265
if not payload.get("pairs"):
266266
raise RuntimeError(
267267
"Prepared RBFE network contains no ligand pairs after removing identical "
268-
"ligands and full-atom-map edges."
268+
"duplicate ligands."
269269
)
270270

271271

@@ -530,8 +530,8 @@ def _build_rbfe_network_plan(
530530
Resolve and persist the RBFE ligand network before equilibration.
531531
532532
This phase deduplicates identical ligands, resolves explicit or generated
533-
transformation pairs, prepares per-edge atom-mapping artifacts, filters
534-
full-coverage mappings, and writes ``rbfe_network.json`` plus the
533+
transformation pairs, prepares per-edge atom-mapping artifacts, records
534+
mapping coverage metadata, and writes ``rbfe_network.json`` plus the
535535
interactive ``rbfe_network.html`` review page under ``config_dir``.
536536
"""
537537
from batter.rbfe import (

docs/cli.rst

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ Key options:
8888
Maximum total submissions for the script (including the first run; default: 4).
8989
``--current-submission-time``
9090
Internal counter for auto-resubmit; increments on each resubmission (default: 0).
91+
``--force-job-attempt N``
92+
Use ``N`` as the job-attempt value for every queued component instead of
93+
reading each component's ``job_attempt.txt``. This is useful when rerunning a
94+
batch with the reduced-timestep retry settings.
9195

9296
Inspect Free-Energy Results
9397
===========================
@@ -130,13 +134,18 @@ way as ``batter run --slurm-submit``. Use ``--partition`` or
130134
To generate a per-ligand (or per-RBFE-pair) SLURM array script without submitting
131135
it immediately, use ``--job-array``::
132136

133-
batter fe analyze work/adrb2 run-20240101 --job-array --workers 2
137+
batter fe analyze work/adrb2 run-20240101 --job-array --array-limit 128 --workers 2
134138

135139
This writes ``*_array.sbatch`` and a matching ``*.tasks.tsv`` task file in the
136140
current directory. Submit the generated script with ``sbatch`` after inspection.
137141
Use ``--array-limit`` to control concurrent array tasks, ``--array-output`` to
138142
choose the script path, and ``--partition`` to set the generated script's
139-
partition.
143+
partition. For RBFE and ``rbfe_septop`` runs, each array task analyzes one
144+
transformation pair; ``--ligand`` may be a pair id such as ``LIG1~LIG2`` or an
145+
endpoint ligand name to include all pairs touching that ligand. If you omit
146+
``run_id``, BATTER writes array tasks for every execution under
147+
``work/adrb2/executions``. ``--job-array`` cannot be combined with
148+
``--slurm-submit`` because it generates the array script for separate submission.
140149

141150
For RBFE runs, ``batter fe analyze`` also writes a per-run Cinnabar bundle under
142151
``work/adrb2/results/cinnabar/<run_id>/`` by default. When the work directory
@@ -180,6 +189,7 @@ is omitted, BATTER writes to ``./cinnabar``. Common files include:
180189

181190
* ``edge_summary.csv`` – combined edge-level DDG estimates and uncertainties
182191
* ``raw_signed.csv`` – signed per-measurement table after BATTER canonicalizes edge direction
192+
* ``x_convergence_filter.csv`` – edge filter decisions when x-component convergence filtering is enabled
183193
* ``cinnabar_relative.csv`` – relative measurements exported from the FEMap
184194
* ``cinnabar_absolute.csv`` – MLE-derived absolute values when the network is connected
185195
* ``cinnabar_absolute_sorted.png`` – BATTER-rendered absolute ΔG ranking plot, sorted by energy
@@ -208,6 +218,15 @@ each run before combining runs. Switch to ``--pool-all-measurements`` if you wan
208218
weight every stored edge measurement directly. ``--uncertainty-mode`` controls the
209219
repeat-combination rule (``ivw``, ``sample``, or ``max``).
210220

221+
By default, RBFE Cinnabar export skips edge measurements whose x-component
222+
forward/backward convergence has not reached 1 kcal/mol by 80% of the production
223+
data. It can restore edges needed for network connectivity with the fallback
224+
0.5/2 kcal/mol threshold. Tune these with ``--x-convergence-filter`` and
225+
``--x-convergence-fallback-filter``, or disable them with
226+
``--no-x-convergence-filter`` / ``--no-x-convergence-fallback-filter``. When the
227+
main filter is active, BATTER also writes an ``unskipped/`` bundle beside the
228+
filtered output.
229+
211230
By default BATTER also merges opposite-direction rows such as ``LIGA~LIGB`` and
212231
``LIGB~LIGA`` into one canonical edge before constructing the FEMap. Use
213232
``--split-directions`` if you want those two stored transformations to remain

docs/cookbook/configuration.rst

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,23 @@ The run YAML file is divided into three sections grouped inside
1919
notification preferences, and artifact destination. ``run.output_folder`` is
2020
required and becomes the base path for ``<run.output_folder>/executions/<run_id>/``.
2121
``run.system_type`` optionally overrides the builder selection inferred from the
22-
protocol (``MABFE`` for ABFE/MD, ``MASFE`` for ASFE). This section is validated
23-
by :class:`batter.config.run.RunSection`. Set ``run.clean_failures: true`` to
24-
remove ``FAILED`` sentinels, ``job_attempt.txt`` retry counters, and progress
25-
caches before rerunning an existing execution.
22+
protocol (``MABFE`` for ABFE/RBFE/MD-family runs, ``MASFE`` for ASFE). This
23+
section is validated by :class:`batter.config.run.RunSection`. Set
24+
``run.clean_failures: true`` to remove ``FAILED`` sentinels,
25+
``job_attempt.txt`` retry counters, and progress caches before rerunning an
26+
existing execution. Set ``run.store_debug_files: true`` to preserve
27+
intermediate scratch files that are otherwise pruned after successful stages.
2628
``create``
2729
Inputs required for system staging (protein/topology paths, ligands, force fields,
2830
optional anchors/restraints). The structure maps directly to
2931
:class:`batter.config.run.CreateArgs`.
3032
``fe_sim``
31-
Overrides and controls for free-energy simulation stages. For ABFE/ASFE runs
32-
these map to :class:`batter.config.run.FESimArgs`. MD-only runs automatically
33-
coerce this section into :class:`batter.config.run.MDSimArgs`, so fields like
34-
``lambdas`` or SDR restraints are no longer required. Equilibration controls
35-
are expressed via ``eq_steps`` which now represents the **total** equilibration
36-
steps. The value is written into ``mdin-template`` as ``! total_steps=<total>``,
33+
Overrides and controls for simulation stages. FE protocols map this section to
34+
:class:`batter.config.run.FESimArgs`. MD-only runs automatically coerce it into
35+
:class:`batter.config.run.MDSimArgs`, so fields like ``lambdas`` or SDR
36+
restraints are no longer required. Equilibration controls are expressed via
37+
``eq_steps`` which now represents the **total** equilibration steps. The value
38+
is written into ``mdin-template`` as ``! total_steps=<total>``,
3739
letting runtime scripts determine the target length without regenerating inputs.
3840
Legacy production extend knobs (``num_fe_extends``) are rejected; set
3941
``n_steps`` to total steps instead. ``analysis_range`` is likewise
@@ -52,9 +54,10 @@ Per-component steps and lambdas
5254

5355
Component steps are supplied via ``fe_sim.n_steps`` as dicts keyed by the
5456
single-letter component (e.g. ``z: 100000``). Keys like ``y_n_steps`` are also
55-
accepted and folded into this map automatically. Each protocol enforces the
56-
required components: ABFE fills ``z`` defaults if omitted, and ASFE fills
57-
``y``/``m`` defaults.
57+
accepted and folded into this map automatically. Each FE protocol enforces the
58+
components it needs: ABFE requires ``z``, standard and SEPTOP RBFE require ``x``,
59+
and ASFE requires ``y``/``m``. Set the corresponding ``<comp>_n_steps`` or
60+
``fe_sim.n_steps`` entry explicitly in production YAMLs.
5861

5962
Lambda schedules can be customized per component using ``fe_sim.component_lambdas``
6063
(or ``<comp>_lambdas`` keys). When a component is missing from that map, it
@@ -64,12 +67,23 @@ or comma/space separated strings; validation ensures ascending order.
6467
RBFE mapping options
6568
--------------------
6669

67-
For ``protocol: rbfe``, the ``rbfe`` block controls network planning and atom mapping.
70+
For ``protocol: rbfe`` or ``protocol: rbfe_septop``, the ``rbfe`` block controls
71+
network planning and atom mapping/scoring.
6872

6973
* ``rbfe.mapping`` – mapping strategy (for example ``default`` or ``konnektor``).
7074
* ``rbfe.mapping_file`` – explicit pair list file; takes precedence over ``mapping``.
7175
* ``rbfe.atom_mapping_file`` – optional JSON/YAML atom mapping overrides for
7276
selected pairs; uncovered pairs use ``rbfe.atom_mapper``.
77+
* ``rbfe.network_scorer`` – edge scorer for Konnektor planning. ``auto`` uses the
78+
LoMap scorer for standard RBFE and pocket-shape scoring for ``rbfe_septop``.
79+
Other accepted values include ``lomap``, ``shape_difference`` and
80+
``pocket_shape``.
81+
* ``rbfe.direction_policy`` – ``larger_volume`` (default) or ``preserve``. Generated
82+
networks are oriented with the larger grid-volume ligand as reference unless a
83+
mapping file explicitly fixes the direction.
84+
* ``rbfe.minimal_mapping_atom`` – minimum mapped-atom count required for standard
85+
RBFE edges. This check is not used to reject ``rbfe_septop`` edges because SEPTOP
86+
uses full-ligand softcore setup.
7387
* ``rbfe.add_atom_mapping_edges`` – default ``false``; append valid
7488
atom-mapping override pairs when neither direction was selected by network
7589
planning.
@@ -101,18 +115,22 @@ See :doc:`rbfe` for RBFE-specific examples.
101115
Anchor selection
102116
----------------
103117

104-
``create.anchor_atoms`` is optional. If it is omitted, BATTER resolves the
105-
anchor triplet during ``system_prep`` and records the selections in
106-
``executions/<run_id>/all-ligands/manifest.json``:
118+
``create.anchor_atoms`` is optional. If it is omitted, BATTER resolves the anchor
119+
triplet during ``system_prep`` and stores the resolved global selections in
120+
``executions/<run_id>/all-ligands/manifest.json``. Prepared-system anchor masks
121+
used by later equilibration/FE setup are also written per ligand to
122+
``equil/anchors.json``.
107123

108124
* For runs with real ligands, the first available real ligand pose drives a
109125
ligand-guided receptor-anchor heuristic.
110126
* For apo-only MD, BATTER switches to a protein-only heuristic so dummy ligand
111127
coordinates do not determine the anchor geometry.
112128

113-
Use explicit ``create.anchor_atoms`` only when you need to pin a known
114-
binding-site geometry or override the heuristic. The value must contain exactly
115-
three MDAnalysis selection strings, ordered as P1, P2, and P3.
129+
If you know the receptor interaction that should define the Boresch reference,
130+
provide one selection. BATTER treats that atom as P1 and chooses P2/P3
131+
automatically. Prefer the binding-site Cα of a residue associated with a
132+
conserved ligand interaction, such as the residue forming a salt bridge. Provide
133+
three selections only when you need fully manual P1/P2/P3 geometry.
116134

117135
Component-Specific Inputs
118136
-------------------------
@@ -153,8 +171,9 @@ feed into the low-level ops documented in :doc:`../developer_guide/internal_buil
153171
- JSON specification for conformational restraints.
154172
* - ``anchor_atoms``
155173
- ``system_prep`` / restraint ops
156-
- Optional P1/P2/P3 receptor-anchor override. Empty means BATTER selects
157-
anchors heuristically and stores the resolved selections in the manifest.
174+
- Optional receptor-anchor override. Empty means BATTER selects anchors
175+
heuristically; one selection pins P1 and auto-selects P2/P3; three
176+
selections provide explicit P1/P2/P3 geometry.
158177
* - ``lipid_mol``
159178
- Build/ops helpers
160179
- Identifies membrane residues when trimming waters.

docs/cookbook/rbfe.rst

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Minimal RBFE configuration
2222
LIG1: /path/to/lig1.sdf
2323
LIG2: /path/to/lig2.sdf
2424
LIG3: /path/to/lig3.sdf
25-
# Optional: provide explicit receptor anchors to override auto-selection.
25+
# Optional: omit anchors, provide one P1 anchor, or provide explicit P1/P2/P3.
2626
# anchor_atoms:
2727
# - "name CA and resid 113"
2828
# - "name CA and resid 82"
@@ -42,8 +42,8 @@ If you omit ``rbfe.mapping`` (and do not provide files), BATTER uses
4242
Anchor selection
4343
----------------
4444

45-
``create.anchor_atoms`` is optional. When it is omitted, BATTER chooses the
46-
three receptor anchors heuristically during system preparation:
45+
``create.anchor_atoms`` is optional. When it is omitted, BATTER chooses the three
46+
receptor anchors heuristically during system preparation:
4747

4848
* For ABFE/RBFE and MD runs with at least one real ligand, BATTER uses the first
4949
real ligand pose as the binding-site reference. It prefers stable receptor
@@ -54,22 +54,44 @@ three receptor anchors heuristically during system preparation:
5454
stable, non-degenerate receptor-anchor triplet without relying on dummy
5555
ligand coordinates.
5656

57-
Provide ``create.anchor_atoms`` manually when you want fixed anchors for a
58-
known binding site, when the first ligand pose is not representative, or when
59-
the heuristic reports that no suitable triplet was found. Resolved anchors are
60-
stored in ``executions/<run_id>/all-ligands/manifest.json`` under
61-
``anchors`` and ``anchor_atom_selections``.
57+
If you know the receptor interaction that should define the Boresch reference,
58+
provide one selection. BATTER treats that atom as P1 and chooses P2/P3
59+
automatically; prefer the binding-site Cα of a residue associated with a
60+
conserved ligand interaction, such as the residue forming a salt bridge. Provide
61+
three selections only when you need fully manual P1/P2/P3 geometry. Resolved
62+
global anchors are stored in ``executions/<run_id>/all-ligands/manifest.json``
63+
under ``anchors`` and ``anchor_atom_selections``. Prepared-system anchor masks
64+
used later by equilibration and FE setup are written to each ligand's
65+
``equil/anchors.json``.
66+
67+
Standard RBFE and rbfe_septop
68+
-----------------------------
69+
70+
Use ``protocol: rbfe`` when ligand pairs have a chemically meaningful common
71+
core. BATTER prepares reusable atom-mapping artifacts and the transformation
72+
setup uses those mappings for the standard RBFE softcore construction.
73+
74+
Use ``protocol: rbfe_septop`` for scaffold hops, protonation-state comparisons,
75+
or pairs where a common-core mapping would be misleading. The same RBFE network
76+
planner is used, but SEPTOP FE setup treats each full ligand as softcore and
77+
uses opposite lambda-dependent Boresch restraints for the two bound ligands.
78+
Mapping artifacts are still generated for network scoring and review, and
79+
``rbfe.network_scorer: auto`` switches to receptor-frame pocket-shape scoring by
80+
default.
6281

6382
Default mapping algorithm
6483
-------------------------
6584

66-
The default mapping is a star network:
85+
The default mapping starts as a star network:
6786

6887
* Ligands are taken in input order.
69-
* The first ligand is used as reference.
88+
* The first ligand is used as the initial reference.
7089
* Pairs are built as ``(lig1, lig2)``, ``(lig1, lig3)``, ...
7190

72-
This corresponds to ``RBFENetwork.default_mapping``.
91+
This corresponds to ``RBFENetwork.default_mapping``. Unless you set
92+
``rbfe.direction_policy: preserve`` or provide ``rbfe.mapping_file``, BATTER then
93+
orients generated edges with ``rbfe.direction_policy``; the default
94+
``larger_volume`` policy uses the larger grid-volume ligand as the reference.
7395

7496
Mapping options and precedence
7597
------------------------------
@@ -79,6 +101,9 @@ RBFE mapping is controlled by ``rbfe`` in ``run.yaml``:
79101
* ``rbfe.mapping_file``
80102
* ``rbfe.mapping`` (default ``default``)
81103
* ``rbfe.atom_mapping_file`` for optional per-pair atom mapping overrides
104+
* ``rbfe.network_scorer`` (default ``auto``)
105+
* ``rbfe.direction_policy`` (default ``larger_volume``)
106+
* ``rbfe.minimal_mapping_atom`` (default ``3``)
82107
* ``rbfe.add_atom_mapping_edges`` (default ``false``)
83108

84109
If both are provided, BATTER uses ``mapping_file``.
@@ -90,13 +115,19 @@ Supported ``rbfe.mapping`` values
90115
* ``konnektor``
91116

92117
When using ``konnektor``, you can optionally set ``rbfe.konnektor_layout``.
118+
``rbfe.network_scorer`` controls how Konnektor scores candidate edges:
119+
``auto`` resolves to LoMap scoring for standard RBFE and pocket-shape scoring
120+
for ``rbfe_septop``; explicit values include ``lomap``, ``shape_difference`` and
121+
``pocket_shape``.
93122

94123
.. code-block:: yaml
95124
96125
rbfe:
97126
mapping: konnektor
98127
atom_mapper: kartograf
99128
konnektor_layout: star
129+
network_scorer: auto
130+
direction_policy: larger_volume
100131
both_directions: false
101132
102133
.. _rbfe_atom_mapper_options:
@@ -290,10 +321,10 @@ The HTML view is the primary network-review artifact:
290321
score, mapped-atom ratio, volume ratio, shape mismatch, and shape overlap.
291322
Missing optional metrics are simply absent from the selector.
292323
293-
During planning, BATTER omits duplicate ligands with identical molecular identity
294-
and removes edges whose prepared atom mapping has full atom or heavy-atom
295-
coverage. The skipped
296-
ligands and edges are recorded in ``rbfe_network.json`` as skip metadata.
324+
During planning, BATTER omits duplicate ligands with identical molecular
325+
identity. Full atom or full heavy-atom mappings are retained as normal edges and
326+
recorded as coverage metadata in the per-edge mapping status and network JSON.
327+
Skipped identical ligands are recorded in ``rbfe_network.json`` as skip metadata.
297328
298329
Transformation systems are created under:
299330

docs/cookbook/results_folder.rst

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -151,30 +151,40 @@ RBFE-Specific Additions
151151

152152
RBFE records use the same top-level pattern, but the payload is slightly different::
153153

154+
results/<run_id>/
155+
├── rbfe_network.json
156+
├── rbfe_network.png
157+
├── rbfe_network.html
158+
└── <ligand_ref~ligand_alt>/
159+
├── record.json
160+
├── Results/
161+
│ ├── Results.dat
162+
│ ├── mapping.json
163+
│ ├── mapping.pkl
164+
│ └── mapping.png
165+
├── Equil_ref/
166+
└── Equil_alt/
167+
168+
``results/<run_id>/rbfe_network.*``
169+
Run-level copies of the resolved RBFE network artifacts from
170+
``executions/<run_id>/artifacts/config/``. The HTML dashboard is generated
171+
during ``prepare_rbfe`` and includes pan/zoom controls, clickable ligand and
172+
edge notes, collapsed reverse-direction edges, prepared atom-mapping or
173+
pocket-shape images when drawing succeeds, and selectable edge coloring by
174+
graph redundancy or available mapping metrics.
175+
176+
Per-pair RBFE result records live under::
177+
154178
results/<run_id>/<ligand_ref~ligand_alt>/
155179
├── record.json
156180
├── Results/
157181
│ ├── Results.dat
158-
│ ├── rbfe_network.png
159-
│ ├── rbfe_network.html
160182
│ ├── mapping.json
161183
│ ├── mapping.pkl
162184
│ └── mapping.png
163185
├── Equil_ref/
164186
└── Equil_alt/
165187

166-
``Results/rbfe_network.png``
167-
Copy of the resolved RBFE network plot from
168-
``executions/<run_id>/artifacts/config/rbfe_network.png``.
169-
170-
``Results/rbfe_network.html``
171-
Copy of the planned RBFE network dashboard from
172-
``executions/<run_id>/artifacts/config/rbfe_network.html``. The dashboard is
173-
generated during ``prepare_rbfe`` and includes pan/zoom controls, clickable
174-
ligand and edge notes, collapsed reverse-direction edges, prepared
175-
atom-mapping images when drawing succeeds, and selectable edge coloring by
176-
graph redundancy or available mapping metrics.
177-
178188
``Results/mapping.*``
179189
Atom-mapping artifacts copied into the transformation setup directory from
180190
``executions/<run_id>/artifacts/config/rbfe_mappings/<ligand_ref~ligand_alt>/``.

docs/developer_guide.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ Orchestration
211211
:func:`~batter.orchestrate.run.run_from_yaml` wires every layer together:
212212

213213
1. Load the run YAML and apply optional overrides.
214-
2. Instantiate a system builder inferred from the selected protocol (``abfe``/``rbfe``/``md`` → ``MABFE``, ``asfe`` → ``MASFE``; overrides via ``run.system_type`` remain for backward compatibility).
214+
2. Instantiate a system builder inferred from the selected protocol
215+
(MABFE-family protocols use ``MABFE``; ``asfe`` uses ``MASFE``; overrides via
216+
``run.system_type`` remain for backward compatibility).
215217
3. Resolve staged ligands (supporting resume) and regenerate the system if required.
216218
4. Construct the ABFE/ASFE pipeline using :func:`select_pipeline
217219
<batter.orchestrate.pipeline_utils.select_pipeline>`.

0 commit comments

Comments
 (0)