feat: assignment validation against nmrshiftdb2 quickcheck - #147
Merged
Merged
Conversation
Adds nmr-cli validate-assignments and POST /validate/assignments. The command checks 1H/13C assignments of a structure against nmrshiftdb2 quickcheck in one request and returns a quality report per nucleus (mark, per-atom deviation, HOSE spheres) plus an assignment check (per-row status, swap suggestions, equivalence, missing signals, referencing offset) and a combined verdict.
The quickcheck servlet only receives a shift list and matches it to atoms itself, so the quality report could pair a value with another atom than the author did (2,6-dimethylphenol: the OH shift landed on the aromatic CHs) and disagree with the assignment check. Observed values and statuses now come from the assignment check rows, and a nucleus with a red atom is at best 'revise'.
hamed-musallam
approved these changes
Oct 2, 2026
Collaborator
|
I’m generally fine with the structure, but I cannot fully follow the code or review it in detail. It’s quite large |
Keep validate-assignments on the ESM nmr-cli entrypoint, and give the validation modules .js import specifiers so the NodeNext build can load them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #15.
What
POST /latest/validate/assignmentschecks a structure's ¹H and ¹³C assignments against nmrshiftdb2 quickcheck predictions. It gives a quality mark per nucleus, laid out like the nmrshiftdb2 quality report, and an assignment check for each assigned signal. The work happens in a newnmr-cli validate-assignmentscommand (JSON on stdin). The router pipes the request to it withdocker exec -i.The response has two layers built from the same author assignments, so they always agree:
reports["13C"|"1H"]: how well the assigned shifts fit, atom by atom. Mark 1–10, accept/revise/reject, per-atom observed, predicted and deviation values, HOSE spheres and codes, and anin_database_likelyflag. Each atom carries the author's assigned shift and the status of itsassignment_checkrow. A nucleus with a red atom is at bestrevise, whatever its mark.assignment_check: the author's atom-to-shift mapping compared with the prediction. Each assignment gets ok/review/fail. It also includes swap suggestions, equivalence violations, missing signals, solvent peaks, proton counts and a referencing offset.verdict: combines both layers, with ¹³C first.How the servlet is used
Both nuclei go in one request. The servlet only accepts a
v1;v2;...shift list and does its own matching of values to atoms, which can differ from the author's. For 2,6-dimethylphenol it put the OH shift on the aromatic CHs. The command therefore uses the servlet for predictions per atom, and uses its status only where its matching agrees with the author's assignment. It:adjustments).Chemist-facing rules
review, never tofail.mark_is_approximate.Router
docs/src/modules/validation.md.Tests
app/scripts/nmr-cli:npm test, 12 tests using recorded servlet responses (test/fixtures/quickcheck-responses.json) for 3,4,5-trimethoxybenzaldehyde (Mnova export with an explicit H) and nicotine. They cover:accept;tests/test_validate.py: 7 router tests withsubprocess.runmocked. They cover stdin piping, the cache, 422/503/500 mapping and schema validation.Consumer
Used by NFDI4Chem/nmrxiv#1579 (submission-flow Quickcheck and the public
/quickcheckpage).