Skip to content

M3: prepare receptors and search boxes for M4 (#14, part B) - #115

Open
Jiahuic wants to merge 1 commit into
mainfrom
feat/14-receptors
Open

Jiahuic wants to merge 1 commit into
mainfrom
feat/14-receptors

Conversation

@Jiahuic

@Jiahuic Jiahuic commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Completes #14. Part A (pockets) is #114, merged.

Two of the three things M4 needs can be produced exactly with nothing installed. The third cannot, and this PR's main decision is to say so rather than paper over it.

What is written

  • The receptor — our entity's polymer chains, first model, no waters, no ligands, no hydrogens, as PDB. The collected structure file is never modified, so the bound components are not lost. Docking into a site that still holds its ligand finds the ligand.
  • A search box per pocket, drawn round the site's own atoms (lining residues plus the bound component) with 4 Å padding and a 16 Å floor per axis, plus a Vina config. A fixed cube at the pocket centre is the usual shortcut and it either clips an elongated site or spends the search on empty volume. M3 runs no docking.

The PDBQT, and why there is a flag

Adding the polar hydrogens Vina needs and assigning atom types is what Meeko, OpenBabel and PDB2PQR exist for. A homemade substitute that merely parses is a receptor that docks and lies about it. So receptor.fidelity is the honesty flag M4 reads:

fidelity When What M4 should do
full a tool was on PATH (mk_prepare_receptor.py, then obabel) use it
pdb_only the default with no tool prepare it yourself — M3 wrote no PDBQT rather than approximating one
reduced --pdbqt-fallback was passed smoke test only, never a reported result
none no polymer atoms readable nothing to dock

The fallback converter is adapted from Ping Hu's bacteria_structure_docking.py (AutoDock atom types, no added hydrogens, zero charges) and is credited in the module. Every record it writes carries that caveat in its own reason.

Receptors are prepared only for structures that passed the quality gate — preparing one M3 has already called unusable would hand M4 something to dock that M3 said not to. --no-receptors skips the step.

A bug worth noting

Path.with_suffix(".pdb") on fig_243273.25.peg.463 eats the .463: it reads as an extension. Every receptor for every protein in a run would have collided on one filename. There is a test pinning it.

Verification

510 tests pass. tests/test_m3_receptor.py injects tool discovery, so the suite behaves identically on a node with OpenBabel and on CI without it — including the case where a tool runs but writes nothing, which must not be reported as success.

python -m s2f.m3_fold --run <dir> --dry-run writes receptors/fig_243273.25.peg.463.pdb and a box of 22.4 × 22.3 × 27.7 Å around the ribose-5-phosphate site. CI exercises the pdb_only path, since no preparation tool is installed there; I verified full locally against OpenBabel and reduced via the flag.

Still open, and deliberately not here

Protonation (PDB2PQR), pockets for apo structures (P2Rank) and prediction for proteins with no reusable structure (#54). Each is stated as a gap in the record rather than as an absence.

Worth a look from the author of the script the fallback is adapted from, and from M4's consumer — particularly whether pdb_only is the right default, or whether the fallback should be on by default for a node with no toolchain.

🤖 Generated with Claude Code

Completes #14. Two of the three things M4 needs can be produced exactly
with nothing installed, and the third cannot.

- The receptor: our entity's polymer chains, no waters, no ligands, no
  hydrogens. The collected structure file is never modified, so the
  bound components are not lost; docking into a site that still holds
  its ligand finds the ligand.
- The search box, per pocket, drawn round the site's own atoms rather
  than as a fixed cube at its centre, which either clips an elongated
  site or spends the search on empty volume. A Vina config beside it.
- The PDBQT is the part that cannot be faked. Adding polar hydrogens and
  assigning atom types is what Meeko, OpenBabel and PDB2PQR exist for,
  and a homemade substitute that merely parses is a receptor that docks
  and lies about it. A tool on PATH is used and recorded as fidelity
  'full'; with none, the default writes the receptor PDB and no PDBQT
  rather than approximating one. --pdbqt-fallback turns on the built-in
  converter adapted from Ping Hu's bacteria_structure_docking.py, which
  is recorded as 'reduced' with its own caveat in every record: it is a
  smoke test, not a reported result.

Receptors are prepared only for structures that passed the quality gate;
preparing one M3 already called unusable would hand M4 something to dock
that M3 said not to.

Path.with_suffix would have eaten the .463 of fig|243273.25.peg.463, so
the filename helper appends instead. A test pins it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant