Metadata-Version: 2.4
Name: compgate
Version: 0.3.5
Summary: RE-CAPT six-gate composition-aware interpretation framework (with gate_T) and the CAR (Composition-Adjusted Replication) statistic for sepsis whole-blood transcriptomics
Author: Huangwei Lin
License: MIT
Project-URL: Homepage, https://doi.org/10.5281/zenodo.22071053
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: scipy
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Dynamic: license-file

# compGate 0.3.5

Reference implementation of the **RE-CAPT** six-gate composition-aware
interpretation framework and the **CAR** (Composition-Adjusted Replication)
statistic, as introduced in the R10.4 manuscript and extended with the
temporal-kinetics gate (T) in R10.6 ("The composition wall of sepsis blood
transcriptomics: a six-gate audit").

- `recap_gate(matrix, meta, ...)` — per-gene d, marker-residual d, fraction-residual d, CAF.
- `gate_T(times, per_subject_values)` — temporal-kinetics characterization (rise-and-return versus sustained shift).
- `gate_report(per_gene)` — six-gate checklist summary.
- `CAR(replicating_genes, per_gene)` — proportion of replicating genes whose effect survives composition adjustment.
- `compgate.scoring.mean_z(X, genes, convention=...)` — dual-convention signature scoring (see below).

## Scoring conventions (`compgate.scoring.mean_z`)

The choice of scoring convention can flip composition-audit conclusions
(R12 finding, pre-registered under OSF 10.17605/OSF.IO/CQDP8), so the
convention is an explicit parameter and must be stated with every reported
CAF:

```python
from compgate.scoring import mean_z

score_frozen = mean_z(X, panel_genes, convention="frozen")
# within-sample-centered mean-Z: z-score each gene within a sample across
# the panel, then average. Removes per-sample panel level; suited to
# mechanism-of-contrast audits within a cohort.

score_level = mean_z(X, panel_genes, convention="level")
# level-preserving mean-Z: z-score each gene across samples, then average.
# Preserves absolute level; required for diagnostic-transportability audits
# across labs. Default convention of this function.
```

## Provenance

The template single-file variant is `05_Code/recap_gate_template.py`.
The package is frozen on Zenodo together with the manuscript deposit
(concept DOI: 10.5281/zenodo.22071053). Version 0.3.1 was published on PyPI on 2026-08-26; versions 0.3.2
and 0.3.3 corrected package metadata (author, license, classifiers, homepage DOI) without functional changes, 0.3.4
additionally aligns the in-package __version__ constant with the release version, and 0.3.5 adds the PEP 621
authors field so that the PyPI project page displays the author name.
