- Bind the molecule to a local so the OBAtom* doesn't dangle
- Also fix a few null de-reference defensive tests in alias code
Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
Reject unsupported future KET major versions, preserve aromatic KET
bonds without forcing kekulization, and retain explicit
implicitHCount: 0 values across round-trips.
Expose KET atom aliases as Open Babel AliasData and add the -ia read
option to expand aliases where chemically meaningful. Update KET tests
to cover future-version rejection, explicit zero implicit H counts,
alias metadata, and structural ethanol reading.
KET is Ketcher's native serialization format, also produced and consumed
by Indigo. This adds a read/write plugin under src/formats/json/.
Supports:
- molecules (atoms, bonds, S-groups, R-group attachment sites,
fragment-level properties, highlights)
- reactions assembled from arrow + plus + molecule geometry via
OBReactionFacade
- verbatim preservation of unknown sections (monomers, monomer
templates, V2 rich text, images, simpleObjects, monomer shapes,
root.connections, root.annotation, ket_version)
The writer preserves the original \$ref names and root.nodes ordering
so a read/write round-trip on a Ketcher-produced file produces
near-identical output. S-group atom and bond indices are remapped
back to per-molecule-local KET indices.
Tested via 13 ctest cases (set(ketformat_parts 1..13)) and a pybind
test (test/testketformat.py) covering read, write, byte-stable double
round-trip, reaction assembly, per-component scoping of highlight and
properties, and passthrough preservation.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>