WitnessCell
WitnessCell is an evidence-gated predictor of condition means for unmeasured two-endpoint genetic combinations. Version 0.1.0 implements the frozen v14 research contract as a typed Python API and command-line application.
The package is intentionally narrow. It does not claim cell-level generative
simulation, calibrated universal uncertainty, causal identification, or
automatic routing to another model. Its selective policy has exactly two
actions: accept or abstain.
Installation
python -m pip install witnesscell==0.1.0
To use the optional AnnData adapter:
python -m pip install "witnesscell[anndata]==0.1.0"
Input contract
WitnessCell consumes per-condition expression means, population variances and
cell counts. Conditions are control, single endpoints such as A, or
two-endpoint combinations such as A+B. Training and validation roles are
explicit; final-target outcomes are never accepted by predict.
import numpy as np
from witnesscell import ConditionMoments, SplitSpec, WitnessCell
genes = ("A", "B", "C", "D")
means = {
"control": np.zeros(4),
"A": np.array([-1.0, 0.2, 0.0, 0.1]),
"B": np.array([0.1, -1.1, 0.2, 0.0]),
"C": np.array([0.0, 0.1, -0.8, 0.2]),
"D": np.array([0.2, 0.0, 0.1, -0.9]),
"A+B": np.array([-0.9, -0.8, 0.1, 0.1]),
}
variances = {condition: np.full(4, 0.2) for condition in means}
counts = {condition: 100 for condition in means}
moments = ConditionMoments.from_mappings(
genes=genes, means=means, variances=variances, counts=counts
)
split = SplitSpec.create(
train_conditions=("control", "A", "B", "C", "D", "A+B")
)
model = WitnessCell().fit(moments, split, gene2go={gene: [] for gene in genes})
prediction = model.predict(["A+C", "B+D"])
print(prediction.means.shape) # (2, 4)
model.save("model.wcell")
For a dataset with validation doubles, include those labels in
validation_conditions; they calibrate the saturation, interaction-kernel
noise, and residual amplitude. Do not place final evaluation targets there.
Command line
witnesscell validate --moments moments.npz
witnesscell fit --moments moments.npz --split split.json \
--gene2go gene2go.json --output model.wcell
witnesscell predict --model model.wcell --conditions A+C B+D \
--output predictions.npz
witnesscell inspect --model model.wcell
Both model and prediction files are pickle-free. A .wcell model is a
versioned ZIP with per-entry SHA-256 integrity checks; loading does not execute
serialized Python code.
Algorithm contract
The frozen path combines:
- an evidence-gated dense mean/GO endpoint head;
- an evidence-gated one-coordinate sparse self head;
- a response-fingerprint amplitude correction with two required lower-bound gates;
- a saturating factorized backbone; and
- an endpoint-incidence kernel over training-double residuals.
When a gate fails, WitnessCell uses the exact simpler fallback defined by the contract. See Algorithm contract, model card, and file formats.
Reproducibility and release safety
The source distribution includes tests, an independent reference-parity
runner, anonymous-release scanning, and CI/release workflows. Production
publication should use PyPI Trusted Publishing with a protected pypi
environment; no long-lived API token is required by the provided workflow.
License and attribution
Apache License 2.0. See LICENSE. This double-blind review artifact uses the neutral attribution WitnessCell Authors and contains no author, institution, repository-account, DOI, or contact identifiers.
Metadata
Release files for witnesscell 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| witnesscell-0.1.0.tar.gz | 55.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| witnesscell-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 94.1 kB
Release files / witnesscell-0.1.0.tar.gz
| Download URL | witnesscell-0.1.0.tar.gz |
|---|---|
| Size | 55.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a3a446ec83a497e69105a3e51f73f137bbc763cfed773582efcc5907f3986f5
|
|
BLAKE2b-256 checksum How to use checksums |
56722d66ca48a5db4e98e75c46cfa8d61f32580894ebf4564b4a52bc9a102332
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Release files / witnesscell-0.1.0-py3-none-any.whl
| Download URL | witnesscell-0.1.0-py3-none-any.whl |
|---|---|
| Size | 39.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1020df654bd0d5e0d2fc8a29afac60e058fcfda6cdba5b57c95d9c7eefa0f3e
|
|
BLAKE2b-256 checksum How to use checksums |
fca67db5c2a35f8a1063f3d25373e84924504166b7bfdfa6681e8b43faa101fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|