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
+9
-3
@@ -52,7 +52,7 @@ The procedure is the same for every file:
|
||||
3.
|
||||
Find the inputs and the expected outputs of the case.
|
||||
The table below says which fields are which, and the chapter it links defines the rule.
|
||||
Only seven files, `alignment`, `corrections`, `grading`, `resolve`, `rights`, `targets` and `traces`, put the expected outputs under `expect`.
|
||||
Only nine files, `alignment`, `corrections`, `grading`, `resolve`, `rights`, `sequences`, `structures`, `targets` and `traces`, put the expected outputs under `expect`.
|
||||
In the other nineteen the expected outputs are fields beside the inputs, such as `output`, `sha256`, `canonical` or `parsed`.
|
||||
4.
|
||||
Compute each output from the inputs with your implementation.
|
||||
@@ -77,11 +77,15 @@ Some files change the procedure:
|
||||
- `traces.jsonl` names two packages, `citing` (the draft) and `cited` (the main example), and for a `resolve` case lists the corrections to apply to each, in order, before judging the trace, and the `same_as` identifiers of the cited work.
|
||||
Apply them with the gate ([11.4](../spec/11-corrections.md#114-the-gate)) to the package's state at its own revision.
|
||||
A `problems` case gives the packages' states as they are, and `cited` is null when the trace names no passage in the main example.
|
||||
- `structures.jsonl` and `sequences.jsonl` need no package.
|
||||
A `scan` case (structures) gives a SMILES or SMARTS in `text` and its `format`, and expects the number of `atoms` and the `bonds` between them as pairs of atom numbers in order, or null when the text is refused.
|
||||
An `identity` case expects the identity the body carries, from `text` and `inchikey` (structures) or from `text` and `alphabet` (sequences).
|
||||
A `problems` case gives a whole annotation and expects the list of rules it breaks, in the order checked; `schema` says whether `schemas/annotation.schema.json` accepts it, because some cases are refused by the schema as well as by a rule.
|
||||
|
||||
Several files also mix more than one kind of case, told apart by their fields.
|
||||
`ids.jsonl` has minting cases and letter-first cases, `keyed.jsonl` and `signatures.jsonl` have a case for each derivation or record, `spotcheck.jsonl` has sample-size cases and one full sample, and `rights.jsonl` has stage checks (a `stage` field), backend checks (a `backend` field) and one combining case (neither).
|
||||
|
||||
The reference checker, `paperspec check` ([tools/](../tools/README.md)), runs all twenty-six files, together with the rest of the repository's checks:
|
||||
The reference checker, `paperspec check` ([tools/](../tools/README.md)), runs all twenty-eight files, together with the rest of the repository's checks:
|
||||
|
||||
```sh
|
||||
paperspec check --quick
|
||||
@@ -124,6 +128,8 @@ The table below uses a few terms that the chapters define:
|
||||
| `corrections.jsonl` | Each operation and refusal on a small document: the state before, the correction, and the record and state after, or the rule broken; with the reference records for a `resolve`, and the leaf as printed for an `emend`. | [11](../spec/11-corrections.md) |
|
||||
| `resolve.jsonl` | Anchors made on the example paper's first reading, and how each resolves after its corrections. | [6.5](../spec/06-anchors.md#65-resolution) |
|
||||
| `traces.jsonl` | Traced citations: a trace on the draft's sentence that cites the main example, with the corrections that make it current, changed, stale, unlinked or misresolved, the passage's current address and the citations inside it (`op` `resolve`); and traces that break `layer.trace.source` or `layer.trace.target` (`op` `problems`). | [18.5](../spec/18-layers.md#185-traced-citations) |
|
||||
| `structures.jsonl` | Chemical structures: the atoms and bonds that SMILES and SMARTS texts write, and the texts that are refused (`op` `scan`); the identity of a structure with and without an InChIKey (`op` `identity`); and annotations that are valid or break `layer.structure.value`, `layer.structure.identity` or `layer.structure.term` (`op` `problems`). | [18.6](../spec/18-layers.md#186-chemical-structures) |
|
||||
| `sequences.jsonl` | Sequences: the identity of a sequence with and without gaps and in each alphabet (`op` `identity`); and annotations that are valid or break `layer.sequence.value`, `layer.sequence.identity`, `layer.sequence.region` or `layer.sequence.variant` (`op` `problems`). | [18.7](../spec/18-layers.md#187-sequences) |
|
||||
| `rights.jsonl` | Stage checks with policies and expiry, the combining rule, and backend conditions. | [14](../spec/14-rights.md) |
|
||||
| `grading.jsonl` | Exercises, submissions and the grades they earn. | [19.4](../spec/19-exercises.md#194-grading) |
|
||||
| `targets.jsonl` | The target set of targeted F3 for the example paper under each digit rule, given the anchored nodes. | [8.10](../spec/08-fidelity.md#810-targeted-f3) |
|
||||
@@ -142,7 +148,7 @@ A candidate format changes only with a recorded reason and a new or changed vect
|
||||
|
||||
A passing run shows one thing: for these inputs, your implementation computes the same values as the reference implementation in `src/paperspec/`.
|
||||
That code computed the expected outputs, and `pixi run build` regenerates them ([tools/](../tools/README.md)).
|
||||
The vectors hold 359 cases in all, some of them small: `hashes.jsonl` has two documents, `alignment.jsonl` two pairs of readings, `offsets.jsonl` two cases.
|
||||
The vectors hold 454 cases in all, some of them small: `hashes.jsonl` has two documents, `alignment.jsonl` two pairs of readings, `offsets.jsonl` two cases.
|
||||
|
||||
The vectors do not show the following.
|
||||
|
||||
|
||||
Reference in new issue
Block a user