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:
alexmandClaude committed 2026-10-18 15:38:31 -04:00
1 parent 7890fa1ad7
commit 3ab96d653f
36 files changed
+1488 -44

No files matched your search

+6 -1
View File
@@ -378,8 +378,13 @@ Model-written text is always a `generated` annotation, never source, and a model
Whether a generic Web Annotation client displays an `AnchorSelector` has not been tested; the fallback exists so that it can still use the quote.
A `trace` annotation follows a citation to the passage it rests on: it targets the citing sentence and its body names the reference, the cited paper and the passage in it.
Whether a trace still leads there is computed from both papers rather than stored: `current`, `changed`, `stale`, `unlinked` or `misresolved`.
A `structure` annotation ties a chemical structure to the words that name it, and a `sequence` annotation does the same for a protein, DNA or RNA sequence.
Nothing finds a molecule in free text, so a person ties each one by hand and the words stay the paper's.
A structure is a SMILES for a molecule or a SMARTS for a group, a fragment with open positions (`R-OH`) or a pattern of atom types, and it may carry the bonds, angles and torsions the paper gives force-field constants for, citing atoms by their numbers in the text.
A sequence has an alphabet, an optional numbering that starts where the fragment does, regions and variants checked against the residues.
Both carry an `identity` that finds the same structure or sequence however it was written.
Layers are `candidate`.
Pinned by the layer records in `fixtures/records/layer/` and `fixtures/records/traces/`, and by [vectors/traces.jsonl](../vectors/traces.jsonl).
Pinned by the layer records in `fixtures/records/layer/`, `traces/`, `chemistry/` and `biology/`, and by [vectors/traces.jsonl](../vectors/traces.jsonl), [vectors/structures.jsonl](../vectors/structures.jsonl) and [vectors/sequences.jsonl](../vectors/sequences.jsonl).
See [chapter 18](../spec/18-layers.md).
## Exercises