feat: structure and sequence annotation bodies; paperspec.structures and paperspec.sequences
Chemical structures (spec/18 section 18.6) and biological sequences (18.7) tied to
the words of a paper. Minor change: two new body kinds, optional properties and
seven rules, with no valid file made invalid.
- annotation schema: structure (SMILES or SMARTS, role, identity, written, label,
accessions, force-field terms) and sequence (alphabet, role, identity, start,
organism, regions, variants); body_kind in sql/store.sql; nine terms in the
JSON-LD context; rules layer.structure.{value,identity,term} and
layer.sequence.{value,identity,region,variant}.
- paperspec.structures reads the atoms and bonds of a SMILES or SMARTS with the
standard library, so a term's atoms are checked without a toolkit; checked against
RDKit on a corpus and random texts. paperspec.sequences checks alphabets,
identities, regions and variants.
- fixtures/records/chemistry (on the main example) and biology (on the draft, which
gains a last sentence), vectors/structures.jsonl and vectors/sequences.jsonl;
check.py runs both layers and the vectors; counts, guides and CHANGELOG updated.
- the prose check no longer takes organism for a UK spelling.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B8cL4zN4XpaQF5cBtASzfq
This commit is contained in:
36 files changed
+1488
-44
No files matched your search
@@ -102,3 +102,22 @@ It is a minor change in the sense of [spec/00](spec/00-introduction.md): a new b
|
||||
- `fixtures/records/traces/` is a second layer, on the Typst draft, with a model's confirmed trace to the main example's abstract and its receipt, a rejected candidate, a person's trace to Table 1 and a reply that disputes the first, and `vectors/traces.jsonl` has 29 cases that correct either paper and show every outcome and both rules.
|
||||
`paperspec check` runs both layers through the record checks and the store.
|
||||
The example project holds the new layer, which changes `project.json`; no other fixture changes.
|
||||
|
||||
One more, asked for by paperchem and a sequence tool to come, which tie molecules and sequences to the words of a paper.
|
||||
It is a minor change in the sense of [spec/00](spec/00-introduction.md): two new body kinds, optional properties and seven rules, with no valid file made invalid and no computed value changed; the example layers, the traces and every receipt are as they were.
|
||||
|
||||
- Chemical structures ([spec/18 §18.6](spec/18-layers.md#186-chemical-structures), `annotation.schema.json`): a `structure` body ties a SMILES or SMARTS to a span, with a `role` (`names`, `depicts`, `parametrizes` or `uses`), an `identity` that finds the same structure however it was written (the InChIKey of a SMILES, else `smiles:` or `smarts:` and twelve hex digits of the SHA-256 of the value), the paper's own `written` notation, a `label`, outside `accessions` and `terms`: the bonds, angles, torsions and impropers a paper gives constants for.
|
||||
A group, a fragment with open positions (`R-OH` is `[*:1]-[OX2H]`) and a pattern of atom types are SMARTS, and SMILES text a toolkit would refuse is kept as one rather than dropped.
|
||||
A term cites atoms by number, from 0 in the order the value writes them and with no number for a hydrogen that is not written, so the numbers are a rule of the text and a producer needs no toolkit to check them.
|
||||
- Sequences ([spec/18 §18.7](spec/18-layers.md#187-sequences), `annotation.schema.json`): a `sequence` body ties protein, DNA or RNA residues to a span, with an `alphabet`, a `role` (`names`, `depicts`, `uses` or `reports`), an `identity` (the alphabet and sixteen hex digits of the SHA-256 of the residues without gaps), a `start` so a fragment is numbered as the whole molecule is, a `label`, an `organism`, `accessions`, `regions` and `variants`.
|
||||
The schema holds each alphabet's letters; a stop (`*`) belongs to protein only.
|
||||
- `paperspec.structures` and `paperspec.sequences` and the rules `layer.structure.value`, `layer.structure.identity`, `layer.structure.term`, `layer.sequence.value`, `layer.sequence.identity`, `layer.sequence.region` and `layer.sequence.variant` ([spec/22 §22.4](spec/22-conformance.md#224-rules)).
|
||||
`structures.scan` reads the atoms and bonds of a SMILES or SMARTS with the standard library, so a term's atoms are checked to exist and to be joined as the kind needs (a chain for a bond, angle or torsion, a star for an improper); it gave RDKit's atom count and bonds for a corpus of fifty-five SMILES and SMARTS and for three thousand random SMILES, and refused the malformed texts RDKit refuses.
|
||||
Valence, aromaticity and the InChIKey need a toolkit, which a producer SHOULD use for them.
|
||||
- `body_kind` of the store's `annotations` table takes `structure` and `sequence` ([sql/store.sql](sql/store.sql)).
|
||||
A store made before this change has the old CHECK, so a consumer migrates it by rebuilding the table; the table's columns do not change.
|
||||
- The JSON-LD context gains nine terms: `identity`, `written`, `alphabet`, `organism`, `start`, and `accessions`, `terms` (as `sct:structureTerms`), `regions` and `variants` as JSON literals.
|
||||
- `fixtures/records/chemistry/`, on the main example, and `fixtures/records/biology/`, on the draft, with `vectors/structures.jsonl` (64 cases) and `vectors/sequences.jsonl` (31): scans, identities, annotations that break no rule and one that breaks each.
|
||||
The example project holds the two layers, which changes `project.json`.
|
||||
The draft gains a last sentence, which the biology layer is about, so the draft package, its draft IDs and the one traces vector that anchors its paragraph change; the traces layer's anchors, its receipt and every other vector are as they were.
|
||||
- The prose check's UK spelling pattern no longer takes `organism` for a form of `organise`.
|
||||
Reference in new issue
Block a user