Repository navigation
Turn on autotoppar by default and handle unknown residues safely - issue #1743 - #1745
Conversation
…1743 - PRODRG failures name the residue and give PRODRG's own reason; for ion-like residues, the supported residue/atom names are suggested (absolute charge in the residue name, exact charge in the atom name). - Remove the neutral single-atom ion residues from ion.top (except AR, AS, KR, XE), so that e.g. a PDB-style ZN is no longer silently treated as a neutral atom. - Rename PDB residue names on input to their HADDOCK3 names (TPO->TOP, HEM->HEB, SLB->SIB, CMO->COM, ARS->AS), before the unknown residue check. - Stop with an error for unknown residues inside a polymer chain and for unknown sugars linked by a glycosidic bond, which PRODRG would parameterise without their bonds; residues of less than three atoms are not passed to PRODRG. - Warn when unknown residues are removed from the models (autotoppar = false), including broken chains or glycosidic bonds. - Update the topoaa docstring for the new default and fix the CHANGELOG date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A PDB selenocysteine (SEC with an SE atom) was silently built as the HADDOCK3 SEC residue, a serine variant for covalent docking (SE dropped, OG built). rename_residues now converts it to cysteine (SE renamed to SG, coordinates kept) and topoaa logs a warning. The HADDOCK3 SEC residue is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Related to haddocking/haddock3#1745. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge the two prodrg failure tests into one parametrized test, keep only the fallback case of the prodrg message test (the error lines are already checked by the failure test), and drop redundant asserts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comp-era
left a comment
There was a problem hiding this comment.
Tests ran fine, including additional protein–RNA testing. Custom topology handling and the remaining residue-processing checks also passed.
However, I noticed that haddock3-analyse reports a 'dict' object has no attribute 'rel_path' warning when analysing topoaa output. The same warning was also reproduced on main, so it does not appear to be related to this PR.
I'm unsure whether this warning is safe to ignore or if it could affect downstream analysis.
Opened an issue about it #1758 |
Conflicts with #1745 (autotoppar), resolved by keeping both sides: - CHANGELOG.md: both 2026-10-28 entries. - libpdb.py: find_insertion_codes next to _rename_line and rename_residues. - topoaa: the insertion-code check runs before the residue renaming and the unknown-residue checks. - test_libpdb.py: both imports and all tests.
What does this PR do and why?
This PR sets
autotoppar = trueby default in[topoaa], so that PRODRG generates the topology and parameters of unknown residues automatically. Every unknown residue then goes through PRODRG. The PR therefore also makes sure that residues PRODRG cannot handle correctly lead to a clear error instead of a silently wrong system.Default:
autotoppar = true. The topoaa docstring is updated accordingly.Clearer PRODRG errors: the error names the failing residue and gives PRODRG's own reason. PRODRG exits with 0 on failure and prints its errors on stdout, so they were never shown before. For ion-like residues, it lists the supported residue and atom names (e.g.
ZN: if this is an ion, use residue ZN2 with atom ZN+2), with a link to the manual.Ions: the neutral single-atom ion residues are removed from
ion.top, exceptAR,AS,KRandXE, which have no charged species. A PDB-styleZNwas silently treated as a neutral zinc atom; it is now reported as unknown, with the hint above.PDB name aliases:
TPO→TOP,HEM→HEB,SLB→SIB,CMO→COMandARS→ASare renamed on input (libpdb.rename_residues), before the check for unknown residues. Their heavy-atom names match the HADDOCK3 definitions.Selenocysteine: a PDB selenocysteine (
SECwith anSEatom) was silently built as the HADDOCK3SECresidue, a serine variant for covalent docking, withSEdropped andOGbuilt. It is now converted on input to cysteine (SErenamed toSG, coordinates kept), with a warning. The HADDOCK3SECresidue itself is unchanged.Residues PRODRG would parameterise without their bonds: topoaa now stops with an error for
Residues of fewer than three atoms (e.g. ions) are not passed to PRODRG.
autotoppar = false: unknown residues are still removed, but a warning now lists them and says when their removal breaks a chain or a glycosidic bond.How was this tested?
tests/test_libligand.py,tests/test_libpdb.py) cover:ZN,NIandFto stay unrecognised.tests/test_gear_preprocessing.pyis also ruff-formatted.pytest tests/(2371 passed),integration_tests/(129 passed) andend-to-end_tests/test_protein_ligand.pyall pass.ZN, withautotoppartrue and false;TPOin a protein, which is built asTOPwith its phosphate;AI assistance
Claude Code wrote the code, tests and docstrings based on my specifications and checked them as described above.
The force-field change (removal of the neutral ions from
ion.top) and the residue aliases were decided by me after reviewing the analysis(affected files, atom-name comparison against the PDB Chemical Component Dictionary).
Checklist
CHANGELOG.mdupdated for user-facing changesRelated issues
Closes #1743
Notes for reviewers
autotoppar = falserestores the old behaviour, now with a warning.🤖 Generated with Claude Code