Community画像github.com

pathway-figure-ledger

Draw a biological mechanism or signalling pathway from a paper PDF or text (genes, proteins, complexes, ligands, compartments, activation / inhibition / binding / phosphorylation / translocation / feedback) as a layered editable SVG plus PNG and PDF. Gene and protein names, every arrow and its type and direction must be found in the cited source sentence - an inhibition drawn as activation, a reversed upstream/downstream, a gene name or number that is not in the source is refused and left out of the figure. Compartment bands (extracellular, membrane, cytoplasm, nucleus ...), gene-vs-protein typography, location cues, step order, legend, text fit and export checks, element-level edit record. Use for pathway / mechanism / cascade / regulatory-network figure tasks. English and Chinese.

pathway-figure-ledger とは?

pathway-figure-ledger is a Claude Code agent skill that draw a biological mechanism or signalling pathway from a paper PDF or text (genes, proteins, complexes, ligands, compartments, activation / inhibition / binding / phosphorylation / translocation / feedback) as a layered editable SVG plus PNG and PDF. Gene and protein names, every arrow and its type and direction must be found in the cited source sentence - an inhibition drawn as activation, a reversed upstream/downstream, a gene name or number that is not in the source is refused and left out of the figure. Compartment bands (extracellular, membrane, cytoplasm, nucleus ...), gene-vs-protein typography, location cues, step order, legend, text fit and export checks, element-level edit record. Use for pathway / mechanism / cascade / regulatory-network figure tasks. English and Chinese.

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/EXIST-D/SH-pathway-figure-ledger/tree/HEAD

Installed? Explore more 画像 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

pathway-figure-ledger は何をしますか?

Biological mechanism / signalling pathway figure with a source ledger. Input: the case's source material (paper PDF, text, data tables, an SVG to edit) and artifacts/figure-workorder.json. Output (/app/output): figure.svg (layered, editable text), figure.png, figure.pdf, figure.source.json (the spec that rebuilds it), source_map.md|json (every element -> the source text it came from), edit_record.md|json (versions + element diff), issues.json, result.json (all output_contract fields + case_id). Arrow semantics decide whether the figure is right: activation ->, inhibition -|, binding o-o, phosphorylation ->(P), translocation dashed, feedback dashed; type and direction come from the source sentence. Nothing here calls a model or the network; every element is checked against the sources by rules, and an element that fails is left out of the figure and listed.

Budget: 64 model requests, 900 seconds - plan for about 8-12 requests

steprequestswhat
11prepare: prints the work order, finds and indexes the sources, lists candidate relations / tables, and delivers a first figure at once (flagged DRAFT until you replace it)
21-3read the sentences / cells that matter (read E012 fig:2 D:table)
31-3spec blocks (the whole figure in one or two calls); read the verification printout and fix errors
41make (final build, records, result.json)
After ~600 s run make and stop. status shows the time used.

Quick start (SK = directory of this file)

SK=/skills/weekly-skill
python3 $SK/scripts/figctl.py prepare            # work order, sources (sections / figures / tables / data tables), relation candidates, KIND, export constraints
python3 $SK/scripts/figctl.py read E012 fig:2    # exact source text, by anchor (D:table#r3cValue for data cells)
python3 $SK/scripts/figctl.py spec <<'EOF'       # the figure as blocks; verified and rebuilt at once (see "Spec blocks")
=== node a
label: Name as in the source
kind: protein
source: @E012.1
=== edge e1
from: a
to: b
type: activates
source: @E012.1
EOF
python3 $SK/scripts/figctl.py make               # final: exports + source map + edit record + result.json

A complete worked spec (with its invented source in examples/input/) is examples/spec.txt: read it before writing yours; examples/output/ shows the records it produced. Other commands: cites 3 / cites Wnx7 (every sentence that mentions Figure 3 / a name: start here when the work order names a figure), format (all block fields), rels (relation candidate sentences), check, status, versions, diff, rollback --to v002, inventory + edit (SVG that came with the task), probe, mode kind=<kind>; python3 $SK/scripts/selftest.py (about 20 s). prepare prints the raw work order and case.json: they fix the kind of figure, formats, size and any constraints. The work order wins. Paths: FIGCTL_INPUT /input, FIGCTL_WORK /app/work/figctl, FIGCTL_OUT /app/output.

Spec blocks (all fields: figctl.py format or references/spec-format.md)

=== figure (kind, title, width_mm, dpi) | === group <id> (label, kind compartment|container|lane, order, parent) | === node <id> (label, alias, kind, group, badge, source) | === edge <id> (from, to, type, label, source) | === chart <id> | === panel <id> | === drop <id>. A block with an existing id replaces it. source: @anchor is required on every node, edge and claim: the label must occur in the cited text, an edge needs both endpoints in the cited sentence with the stated relation word, numbers and units must be the source's. Your own wording: generic: yes (allowed, listed in exceptions). A deliberate choice that triggers a warning: ack: reason.

What is verified (full list: references/checks.md)

checkmeaning
source_groundingevery node / edge / group / card has an anchor that exists; label (or alias) occurs in the cited text; endpoints of an edge occur in the cited text; quotes are verbatim
relation_type_and_directionthe edge type matches the relation word of the sentence (activates / inhibits / binds / ...), direction vs active / passive voice, location cues, step order, flow start / end
numbers_units_provenancenumbers, units, error-bar kind in labels / callouts / charts are in the cited text or the table
data_mapping_readbackcharts: each mark read back through the axis equals its table cell; zero-based bars, clipped axes, duplicates, legend = series
layout_and_text_fitnothing overlaps, text fits its box and the canvas, containers do not interleave, edges avoid nodes
contrast_and_print_sizetext contrast >= 4.5:1, smallest text in pt at the print width
png / pdf / svg export, fontspixels not blank / clipped; PDF vector, text selectable, fonts embedded; SVG valid, layered, unique ids, text editable; CJK font present when needed
deterministic_rebuild, edit_recordthe saved spec rebuilds the identical SVG; every version has an element-level diff
An element with an error is NOT drawn (it stays in figure.source.json): fix it and resend the block. The figure never shows what the sources do not support.

Pathway: specifics

  • Compartments are group blocks with kind: compartment and an order: from outside to inside (1 extracellular, 2 membrane, 3 cytoplasm, 4 nucleus ...); the cascade is laid out along that order. An upstream node placed below its target gets UPSTREAM_BELOW.
  • Edge types. activates (promotes, induces, upregulates), inhibits (represses, blocks, antagonises), binds (interacts, recruits, dimerises), phosphorylates, transports (translocates, imports), produces, feedback. The source sentence must carry a cue word of that family; a sentence that says activates under an inhibits edge is RELATION_TYPE_MISMATCH.
  • Direction. Active voice: subject -> object. Passive (X is inhibited by Y): Y -> X. The checker looks at the nearest mention pair and warns (DIRECTION_CHECK); acknowledge a deliberate choice with ack: reason on the edge.
  • Genes vs proteins. kind: gene is italic; human symbols are CAPITALS, mouse symbols capitalised (species: human|mouse in the figure block); protein names are not italic.
  • Feedback. Mark the closing edge of a loop with route: feedback (drawn dashed, kept out of the layering) so that the cascade still reads top to bottom.
  • Location. A receptor in the cytoplasm band, or a node placed where the cited clause says otherwise, gives LOCATION_CHECK.
  • Indirect / inferred relations: confidence: indirect draws the edge dashed; say so in the label or legend.

Editing

  • Own figure: resend the blocks that change (=== node a ... or === drop a); add reason: to the block. figctl.py diff shows the element ids added / removed / changed; unchanged elements keep geometry, text and source anchors.
  • An SVG that came with the task is the source: figctl.py inventory lists elements, figctl.py edit applies === edit blocks (set_text, set_attr, recolor, move, delete, add_text) in place, refuses an edit that invents a number, and make proves the rest is byte-identical (edit_record.md: leaf elements untouched).

Outputs

figure.svg figure.png figure.pdf (+ figure.tiff / .eps only when the work order asks) figure.source.json source_map.json|md datamap.csv|json (charts) edit_record.json|md issues.json change_log.md result.json. status: success only if nothing failed and the figure is not a draft; partial (reasons in exceptions); failed (no figure); cannot_determine (no readable source).

Exceptions to report, never hide

a draft not yet replaced - elements left out because verification failed - generic labels - warnings not acknowledged - values computed (mean of listed rows) - cells not drawn (empty / non-numeric) - fonts missing or substituted - EPS / CMYK limits - print size too small - parser warnings. All land in result.json -> exceptions.

Dependencies

Python 3.9+, pymupdf, Pillow, lxml, numpy (optional: openpyxl for XLSX, OCR for scanned PDFs, LibreOffice / rsvg-convert / inkscape only to export an SVG that came with the task). figctl.py probe reports what exists. A Latin font file (Arial, Liberation Sans or DejaVu) is needed; a CJK font for Chinese labels.

Examples and honesty notes

examples/ has an invented source, the spec, the failure-path spec, and the real outputs of that run (an example, not an organiser case, not a score). README.md lists what was tested and what was not.

関連スキル