TissueSheaf

Detecting tissue-scale coordination breakdown with cellular sheaves through synthetic falsification and a first specificity-only real-tissue silence test.

The Idea
Healthy tissue is not just a collection of individually normal cells. It is a coordinated spatial system: neighboring cells maintain compatible states across tissue architecture. A useful early signal of transformation may therefore be a breakdown in coordination between cells, before any single-cell marker is obviously abnormal.
TissueSheaf models a synthetic tissue as a cellular sheaf over a spatial cell graph. The harness tracks loss of global consistency through a sheaf Laplacian, then requires that the coupling-change signal also localize to the future lesion region before calling a transition.
The distinguishing feature of this repository is not a claimed biological result. It is the falsification architecture: negative controls, null batteries, mismatch stress tests, train-on-health leakage checks, and metadata-blindness gates designed to make failures visible.
What This Is, And Is Not
This is:
- a reproducible synthetic validation harness for TissueSheaf method development;
- an auditable scalar coupling estimator fit on pre-onset synthetic health windows and frozen before test;
- a Phase 0 / Phase 1A falsification suite with negative controls, null batteries, model-mismatch stress tests, and metadata-blindness checks;
- a reusable Visium adapter and Phase 1B specificity-only silence test on annotated healthy tissue;
- an honest research prototype whose failures are part of the output.
This is not:
- a method validated on real spatial-transcriptomics or histology data;
- a diagnostic, prognostic, or clinical system;
- evidence for a biological or clinical claim;
- a benchmark against existing clinical tools or real tissue cohorts.
Quickstart
The commands below were tested on the repository as released. They run a reduced synthetic suite that exercises the positive scenario, negative controls, estimated coupling maps, and metadata-blindness checks. On a typical laptop it should finish in tens of seconds.
Bash
python -m pip install -e ".[dev]"
python -m pytest -q
python -m tissuesheaf.phase0 run \
--out reports/quickstart \
--seed 13 \
--grid 20 \
--T 45 \
--precursor-onset 15 \
--visible-switch 32 \
--n-nulls 1 \
--negative-control-replicates 1 \
--skip-mismatch
python -m tissuesheaf.phase0 validate --out reports/quickstart
Windows PowerShell
py -m pip install -e ".[dev]"
py -m pytest -q
py -m tissuesheaf.phase0 run `
--out reports/quickstart `
--seed 13 `
--grid 20 `
--T 45 `
--precursor-onset 15 `
--visible-switch 32 `
--n-nulls 1 `
--negative-control-replicates 1 `
--skip-mismatch
py -m tissuesheaf.phase0 validate --out reports/quickstart
The run writes:
reports/quickstart/
config.json
metrics.json
summary.md
null_summary.csv
metrics_timeseries*.csv
coupling_field__estimated.csv
figures/
The same command is also available after installation as:
tissuesheaf-phase0 run --out reports/quickstart --seed 13 --grid 20 --T 45 --precursor-onset 15 --visible-switch 32 --n-nulls 1 --negative-control-replicates 1 --skip-mismatch
Current Reproducible Results
Schema 6.1 is the current synthetic validation schema. The reduced quickstart suite above is expected to pass:
| Verdict |
Expected result |
phase0_suite_pass |
PASS |
phase1a_suite_pass |
PASS |
phase1a_metadata_blind_gauntlet_pass |
PASS |
The heavier mismatch gauntlet is intentionally harsher and currently exposes unresolved method limits. A representative schema 6.1 run with mismatch and Stage C1 enabled produced:
| Verdict |
Result |
phase0_suite_pass |
PASS |
phase1a_suite_pass |
PASS |
phase1a_metadata_blind_gauntlet_pass |
PASS |
stage_a_pass |
PASS |
stage_b_pass |
FAIL |
stage_c1_pass |
PASS |
phase1a_mismatch_suite_pass |
FAIL |
phase1a_upgraded_suite_pass |
FAIL |
That failure is deliberate reporting, not a packaging bug. Schema 6.0 fixes the type-standardized recovery metric, keeps the estimator metadata-blind, and adds a gauge-quotient localization attempt plus an intermediate confound frontier. Schema 6.1 adds a diagnostic blind-discriminant battery and finds no held-out mask-free readout that separates M4 positive from M4 no-lesion. The current conclusion is that M2/M4 require a better invariant, not a tuned readout. See docs/VALIDATION.md, docs/STAGE_A_B_RESULTS.md, and docs/STAGE_C1_RESULTS.md.
Phase 1B Real-Tissue Silence Test
Phase 1B schema 7.0 adds the first real-data adapter and a specificity-only experiment on Wu atlas sample 1160920F. It fits HVG/PCA, transcriptional niches, and coupling only on spatially blocked health spots; removes fit/test boundary edges; and asks whether held-out health matches the fit-health obstruction baseline. Lesion spots are excluded from obstruction computation.
The pre-registered schema 7.0 run failed two-sided distributional silence in both health tiers: held-out obstruction collapsed to zero while the fit baseline retained a sparse positive tail. Schema 7.1 diagnoses the mechanism as positivity clipping, not edge starvation or a fit/test path difference. The corrected one-sided gate is INDETERMINATE because an identically zero readout carries no specificity information. No lesion analysis was run. See docs/PHASE1B_SILENCE_RESULTS.md and docs/PHASE1B_ZERO_SIGNAL_DIAGNOSTIC.md.
python -m tissuesheaf.phase1b `
--base C:\Users\Sharb\data\wu `
--sample 1160920F `
--out reports\phase1b_silence_1160920F
Run the health-only zero-signal diagnostic with:
python -m tissuesheaf.phase1b_diagnostic `
--base C:\Users\Sharb\data\wu `
--sample 1160920F `
--out reports\phase1b_diagnostic_1160920F
Schema 8.0 replaces the min-over-varieties readout with the assigned-type-pair residual and adds block-level cross-conformal calibration:
python -m tissuesheaf.phase1b_conformal `
--base C:\Users\Sharb\data\wu `
--sample 1160920F `
--out reports\phase1b_conformal_1160920F
The calibrated verdict is INDETERMINATE: held-out variance is restored but 94.8-97.4% of held-out edges remain clipped, Tier 1 has only two calibration blocks, and Tier 2 is directionally over-conservative. The field-effect experiment remains prohibited. See docs/PHASE1B_CONFORMAL_RESULTS.md.
What The Validation Suite Checks
The suite tries to break the method before it asks anyone to trust it:
- Conjunctive transition rule: a spectral-gap drop is only a coupling-change flag; a transition requires sustained localization as well.
- Negative controls: quiet tissue, innocuous global drift, and a stable non-lesion boundary should remain silent.
- Null battery: spatial permutation, stalk permutation, rewired graph, and constant-sheaf controls test whether localization is specific.
- Train-on-health protocol: the estimator fits only pre-onset health windows, freezes the baseline, and includes an intentional all-timepoint leakage fit that should explain away disease.
- Mismatch gauntlet: M1 nonlinear coupling, M2 cell-type heterogeneity, M3 heavy-tailed/dropout observation noise, and M4 combined mismatch are stress tests, not guaranteed passes.
- Honest metric audit: under type-standardized transfer, localization AUC is the recovery gate and scalar
w_e recovery is retained as a diagnostic.
- Gauge-quotient localization attempt: schema 6.0 compares current edge disagreement to all health-fit type-pair varieties without synthetic scenario branches, then reports whether residual coupling loss survives.
- Blind specificity battery: schema 6.1 computes six lesion-mask-free readouts, validates the best-looking candidates on held-out seeds, and stops before adoption when none survives.
- Metadata-blindness verification: estimator config hashes, codepath traces, label-poisoned outputs, and health-only adaptive statistics are checked so synthetic scenario labels cannot choose estimator behavior.
How It Works
At a high level:
- Generate synthetic tissue trajectories with known future lesion geometry.
- Build a spatial cell graph and a weighted identity sheaf over graph edges.
- Fit scalar coupling weights on the health window only.
- Track sheaf-Laplacian spectral behavior and localization heatmaps through time.
- Evaluate gates, negative controls, nulls, leakage controls, and metadata-blindness checks.
For the math and implementation details:
- docs/METHODOLOGY.md explains the sheaf, coboundary, Laplacian, observables, estimator, and nulls.
- docs/VALIDATION.md explains the falsification architecture and current gates.
- docs/ROADMAP.md explains the Phase 1B real-data plan and known identifiability limit.
A small curated example run is included under examples/sample_report/.
Reproducibility Notes
- Default seeds are explicit. The quickstart uses
--seed 13.
- Python
3.10+ is supported by package metadata and CI configuration.
reports/, work/, generated zips, caches, and full run bundles are git-ignored.
- The committed example contains only
summary.md and two small figures.
- The full mismatch suite can take several minutes and may exit as a validation failure because unresolved research gates fail honestly.
To reproduce the representative metadata-blind mismatch audit used for the release notes:
python -m tissuesheaf.phase0 run --out reports/stage_c1_blind_battery --seed 13 --grid 35 --T 80 --run-stage-c1
Review reports/stage_c1_blind_battery/summary.md and metrics.json; do not expect the mismatch, upgraded, or Stage B verdicts to be green in schema 6.1. Stage C1 can pass as a completed diagnostic even when blind_discriminant_found is false.
Roadmap And Limitations
Phase 1B first contact remains scientifically indeterminate. Schema 8.0 restores nonzero variance and replaces synthetic score thresholds with block-conformal p-values, but the assigned-pair residual remains sparse and over-conservative. The next milestone is a pre-registered correction of out-of-sample miscentering or a replacement residual on the frozen health benchmark, not lesion analysis.
The largest known identifiability limit is cell-type composition change correlated with transformation. State-only inference can flag this as confounded, but it cannot fully separate a true coupling change from a shifting type mixture when both co-occur. Schema 6.1 confirms that the tested blind readouts do not rescue M4 specificity; the next direction is constrained-gauge / cycle-holonomy structure, not readout tuning.
See docs/ROADMAP.md.
Citation
If you use or discuss this research prototype, please cite the repository metadata in CITATION.cff. A formal paper citation does not yet exist.
License
Apache License 2.0. See LICENSE.
Contributing
See CONTRIBUTING.md. The governing rule is scope honesty: do not loosen gates to make failures disappear, and do not present synthetic-only behavior as real-data evidence.
Acknowledgements
AI coding agents were used during implementation and documentation under the author’s direction. The scientific scope, audits, and release decisions are intentionally documented so that readers can inspect both the method and its limits.
评论