Metadata-Version: 2.4
Name: llm-pathway-curator
Version: 0.2.0
Summary: Source-linked enrichment reports and explicit checks of pathway draft wording.
Author: Ken Furudate
License-Expression: MIT
Project-URL: Documentation, https://llm-pathwaycurator.readthedocs.io/
Project-URL: Repository, https://github.com/kenflab/LLM-PathwayCurator
Project-URL: Issues, https://github.com/kenflab/LLM-PathwayCurator/issues
Project-URL: Preprint, https://doi.org/10.64898/2026.02.18.706381
Keywords: bioinformatics,computational-biology,enrichment-analysis,pathway-analysis,quality-assurance,selective-prediction,abstention,gsea,fgsea,reproducible-research,llm
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=2.0
Requires-Dist: numpy>=1.24
Requires-Dist: pydantic>=2.0
Requires-Dist: tabulate>=0.9
Requires-Dist: matplotlib>=3.8
Requires-Dist: circlify>=0.15.1
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: openpyxl>=3.1; extra == "dev"
Requires-Dist: scipy>=1.11; extra == "dev"
Provides-Extra: bench
Requires-Dist: pyyaml>=6.0; extra == "bench"
Requires-Dist: tqdm>=4.66; extra == "bench"
Requires-Dist: synapseclient>=2.0; extra == "bench"
Provides-Extra: llm
Requires-Dist: openai>=1.0; extra == "llm"
Requires-Dist: google-genai; extra == "llm"
Requires-Dist: google-generativeai; extra == "llm"
Provides-Extra: all
Requires-Dist: pytest>=8.0; extra == "all"
Requires-Dist: ruff>=0.4; extra == "all"
Requires-Dist: openpyxl>=3.1; extra == "all"
Requires-Dist: scipy>=1.11; extra == "all"
Requires-Dist: pyyaml>=6.0; extra == "all"
Requires-Dist: tqdm>=4.66; extra == "all"
Requires-Dist: synapseclient>=2.0; extra == "all"
Requires-Dist: openai>=1.0; extra == "all"
Requires-Dist: google-genai; extra == "all"
Requires-Dist: google-generativeai; extra == "all"
Dynamic: license-file

# LLM-PathwayCurator

<p align="left">
  <img src="https://raw.githubusercontent.com/kenflab/LLM-PathwayCurator/main/docs/assets/LLM-PathwayCurator_logo.png"
       width="90" alt="LLM-PathwayCurator logo">
</p>

**Source-linked enrichment reports and checks of pathway draft wording.**

[![Docs](https://img.shields.io/badge/docs-latest-blue?style=flat&logo=readthedocs&logoColor=white)](https://llm-pathwaycurator.readthedocs.io/)
[![Historical preprint](https://img.shields.io/badge/bioRxiv-historical_preprint-B31B1B?style=flat)](https://doi.org/10.64898/2026.02.18.706381)
[![License: MIT](https://img.shields.io/badge/License-MIT-f1c40f?style=flat)](LICENSE)
[![Python](https://img.shields.io/badge/python-3.11%2B-555555?style=flat&logo=python&logoColor=white)](https://www.python.org/downloads/)

---

Enrichment output and an interpretation are different records. LLM-PathwayCurator
keeps the complete enrichment table, writes statistical statements tied to that
table, and places supplied draft text beside checks of its numbers, signed
enrichment direction, declared study context, and inferential wording. The HTML
report lets a researcher inspect the original evidence and wording together.

The current default makes no model requests. It does not use hash-derived
context scores or simulated gene survival to select statements. You can inspect
drafts written by a person or any language model without calling that model again.
The historical LLM pipeline remains available through an explicit legacy mode.

The manuscript source tables contain the seven-cohort TCGA analysis using the
corrected gene identities and mutation-group policy. See the
[reproduction guide](paper/revision/CRM_R1/FIGURE_REPRODUCTION.md). Earlier TCGA
outputs are retained as historical records; they are not the manuscript inputs.

The optional [structured curation workflow](docs/structured-curation.md) adds
supporting-gene modules, typed source observations and a proposal packet. Import
saved model- or human-authored JSONL with `--proposals` to review proposed
interpretations beside their exact sources. This workflow makes no
model calls and never automatically approves free prose.

## 📦 Install the current source
[![PyPI version](https://img.shields.io/pypi/v/llm-pathway-curator.svg)](https://pypi.org/project/llm-pathway-curator/)

- #### Option A (recommended): Install from PyPI
  ```bash
  pip install llm-pathway-curator

  ```
  (See PyPI project page: [https://pypi.org/project/llm-sc-curator/](https://pypi.org/project/llm-pathway-curator/))

- #### Option B: Install from GitHub (development)
  ```bash
  git clone https://github.com/kenflab/LLM-PathwayCurator.git
  cd LLM-PathwayCurator
  python -m pip install -e .
  ```

Python 3.11 or later is required. Existing users can update their checkout and
reinstall it; a second checkout is unnecessary.

## ⚡ Try a source report

```bash
llm-pathway-curator run \
  --evidence-table examples/source_report/evidence_table.tsv \
  --sample-card examples/source_report/sample_card.json \
  --claims examples/source_report/drafts.tsv \
  --outdir out/source_report
```

Open `out/source_report/report.html`. The example is synthetic software test data,
including deliberately problematic wording; it is not a biological benchmark.
Omit `--claims` to create a report from the enrichment table alone.

Supply a new or empty output directory for each run. Previous reports and input
files are preserved.

## 📊 Visualize saved results

```bash
llm-pathway-curator plot-source --run-dir out/source_report --outdir out/source_plot
```

This writes PNG/PDF/SVG figures, the plotted table and an input-hash receipt.
Source statistics, statistical selection and draft-check counts remain distinct.
The [visualization guide](docs/visualization.md) explains the display and the
retained `plot-ranked` packed-circle and bar plots for historical ranked inputs.

See the [examples index](examples/README.md) for the source report, structured
curation and retained historical demo.

## 🧩 Inputs

The EvidenceTable TSV requires `term_id`, `term_name`, `source`, `stat`, `qval`,
`direction` (`up`, `down`, or `na`), and `evidence_genes` (semicolon-separated).
Use `stat_kind=NES` for a signed normalized enrichment score; `fgsea` sources
infer that label. Missing statistics remain missing. The tool checks unique
`source:term_id` identities and rejects ambiguous evidence links.

The Sample Card JSON must give a nonblank `comparison`, including the positive
group and reference group. Optional `condition`, `tissue`, `perturbation`, and
`study_design` describe your system. No cancer type or TP53 comparison is required.

Optional draft TSVs contain `text` and either `term_uid` (`source:term_id`) or an
unambiguous `term_id`. Optional `claim_id`, study context fields, and
`evidence_sha256` allow explicit identity checks. Submitted wording is preserved.
See the [input guide](docs/user-guide.md) and [adapters](src/llm_pathway_curator/adapters/README.md).

## 🛡️ Outputs and decisions

| Artifact | Purpose |
| --- | --- |
| `report.html` | Searchable source evidence, statistical statements, original drafts and quoted findings |
| `report.md`, `report.jsonl` | Readable and machine-readable records for every input pathway |
| `evidence.source.tsv` | Complete normalized census with source and evidence hashes |
| `audit_log.tsv` | Statistical statement eligibility and reasons |
| `claims.checked.tsv` | Original draft text, limited checks and human-review disposition |
| `run_meta.json` | Input/output hashes, settings, implementation hashes and run counts |

The default adjusted-value cutoff is 0.05; set `--q-threshold` explicitly to change
it. `--k-claims` optionally caps eligible source statements, ordered by adjusted
value and identifier. All other candidates stay in the report. This selection
rule does not claim an advantage over selection by the same adjusted values.

`PASS` applies to a **source statistical statement** under the declared cutoff.
An explicit contradiction in supplied prose gives `FAIL`; other prose remains
`ABSTAIN` for human review. Mechanistic or clinical wording is flagged for review.
Absence of a flag never establishes semantic or biological correctness.
The limited wording rules currently cover specified English expressions, not a
general language understanding system. See [scope and limitations](docs/concepts.md).

## 🐍 Python API

```python
from llm_pathway_curator import ReviewConfig, review_enrichment

result = review_enrichment(ReviewConfig(
    evidence_table="evidence.tsv",
    sample_card="sample_card.json",
    claims_file="drafts.tsv",  # optional
    outdir="out/my_source_report",
))
print(result.artifacts["report_html"])
```

`run_pipeline(RunConfig(...))` uses the same source workflow by default.

## 📄 Reproduce manuscript figures and summaries

After installing this checkout, run:

```bash
python paper/revision/CRM_R1/reproduce.py --outdir out/manuscript_reproduction
```

This verifies 64 supplied source files, repeats the 50 DEX text checks, recomputes
human-rating and split-replication summaries, creates seven TCGA source reports,
and renders Figures 2–3 and S1–S4 with numerical table exports and hash receipts.
Use a new output directory. The command starts from saved enrichment records,
texts, ratings and split results; expression-model fits are a separate step.
Figure 1 is author-supplied artwork. The
[guide](paper/revision/CRM_R1/FIGURE_REPRODUCTION.md) and
[figure map](paper/FIGURE_MAP.csv) list each input, script and output, including
upstream dependencies that are needed for a complete study rerun.

## Historical pipeline

Use `--workflow legacy`, or `RunConfig(workflow="legacy", ...)`, to request the
historical distill/module/proposal pipeline. Its proxy context scores and
synthetic gene perturbations are historical computational mechanisms, not
empirical stability or biological validation. Model-related environment settings
only affect that explicit workflow; legacy model settings can make API requests.

For an exact historical reproduction, pin commit
[`b069e8a`](https://github.com/kenflab/LLM-PathwayCurator/tree/b069e8ad3d916618adcf26af0202748790c3ca20).
Changing file paths changes frozen code hashes, so archived protocols should not
be silently relocked against the reorganized source tree.

The [paper workspace](paper/README.md) and
[revision README](paper/revision/CRM_R1/README.md) describe research-only
comparisons, saved-result reporting and the updated-tool reassessment.
Development prototypes, study-specific registries and revision tests live under
`paper/revision/CRM_R1/`; they are excluded from the installed package.
Earlier versioned notes are retained in its `archive/` for provenance.

## 🧾 Development and citation

```bash
python -m pip install -e ".[dev]"
python -m pytest
python -m build
```

Software tests establish implementation behavior. They do not estimate expert
agreement, interpretive utility, or biological accuracy. The revised implementation
requires a separately specified evaluation before those performance claims.

[CITATION.cff](CITATION.cff) describes the software. Cite the release-specific
DOI and commit used. Two separate records preserve v0.1.0:

- [GitHub release archive](https://doi.org/10.5281/zenodo.18675487).
- [Code, benchmarks and manuscript source-data archive](https://doi.org/10.5281/zenodo.18625777).

These identify the historical implementation. The original citation is preserved
in [the archive](paper/revision/CRM_R1/archive/CITATION_v0.1.0.cff).
The [release guide](docs/releases.md) explains versioned code and data archives.
