scMPRAforge_models / README.md
saarantras1's picture
Signal-first training-data schemas
2bef6c4 verified
|
Raw History Blame Contribute Delete
5.81 kB
---
license: other
license_name: cc-by-4.0-and-cc-by-nc-4.0
license_link: LICENSE.md
tags:
- biology
- genomics
- regulatory-genomics
- mpra
- single-cell
language:
- en
pretty_name: scMPRA stratified negative binomial fits
---
# scMPRA stratified negative binomial fits
Fitted parameters for every stratified negative binomial (NB) and
zero-inflated negative binomial (ZINB) model reported in *Modeling,
calibration, and power analysis of single-cell massively parallel reporter
assays*. There are fifteen fits over three published scMPRA datasets: three canonical
(one per dataset, the model the paper's analyses use) and twelve
counterfactuals kept so the model-selection comparisons can be reproduced.
The parameter tables are plain parquet and need nothing but
pandas. The orthos are the complete fitted objects, loadable with
`scMPRAforge`. Bounds objects derived from these fits are included with `scMPRAforge`.
## Files
| file | rows | description |
|---|---|---|
| `fitted_means.parquet` | 45,296 | fitted mean and dispersion, one row per level |
| `zero_inflation.parquet` | 6,016 | fitted zero inflation, ZINB fits only |
| `fits.csv` | 15 | one row per fit: dataset, model family, zero handling, canonical flag |
| `export_fits.py` | | the script that produced all three |
| `orthos/<fit>.tar.gz` | 15 | the complete fitted objects, one archive per fit |
### Schema
`fitted_means.parquet`
- `fit` — fit name, joins to `fits.csv`
- `stratified_by` — `cell_type` or `cre`
- `stratum` — the level of the stratifying axis this model was fit on
- `level_axis` / `level` — what the mean is indexed by, and which one
- `mu` — fitted mean
- `theta` — NB dispersion for this stratum
`zero_inflation.parquet` is the same minus `theta`, with `zi` in place of `mu`,
and `level_axis` always `rep_id`.
## Datasets
| `dataset` | study | assay |
|---|---|---|
| `shendure` | Lalanne et al. 2024, *Nat Methods* 21:983, [10.1038/s41592-024-02260-3](https://doi.org/10.1038/s41592-024-02260-3) | scQers, developmental CREs in mouse embryoid bodies |
| `cohen` | Zhao et al. 2023, *Nat Genet* 55:346, [10.1038/s41588-022-01278-7](https://doi.org/10.1038/s41588-022-01278-7) | scMPRA, promoter variants in live mouse retinas |
| `seelig` | Yin et al. 2025, *Cell Systems* 16:101302, [10.1016/j.cels.2025.101302](https://doi.org/10.1016/j.cels.2025.101302) | scMPRA of designed enhancers in HepG2/K562 |
The lab names are kept as identifiers so these join to the analysis code. Make sure you cite the papers above in downstream analysis.
## Loading
```python
import pandas as pd
fits = pd.read_csv("fits.csv")
means = pd.read_parquet("fitted_means.parquet")
canonical = set(fits.loc[fits.canonical, "fit"])
mu = means[means.fit.isin(canonical) & (means.stratified_by == "cell_type")]
```
### Orthos
Each ortho holds its training data in `training_data.scmpra/`: the count table
post filtering and negative-control pooling.
`ortho.load` reads it from there, so an ortho loads and computes from any
working directory.
The embedded UMI-wise tables use schema version 2, recorded in `members.json`,
with signal-first count names: `mpra_umis`, `mpra_reads`, `transfection_umis`,
`transfection_reads`, and `dna_reads` where available. Counts are non-negative
integers; null optional counts mean unknown. `cre_id_original` retains the
original identity of pooled negative controls. The paper's supplementary note
defines the complete read-wise, UMI-wise, and coarse-reporter schemas.
Coarse transfection-reporter detections, when present, are stored separately
as `_coarse_reporter` in `members.pkl`, with one presence-only row per
`(rep_id, cell_bc, cre_id)`. They are loaded with the training data and are not
paired with individual MPRA UMIs. Zero-handling settings determine how these
detections contribute to a fit; the main count table alone does not encode them.
Each fit is one archive, so download only the ones you need:
```python
import tarfile
from huggingface_hub import hf_hub_download
from distributed import Client, LocalCluster
from scMPRAforge.core import ortho
name = "seelig_cm_moib_nb_phantom"
archive = hf_hub_download("saarantras1/scMPRAforge_models", f"orthos/{name}.tar.gz",
repo_type="dataset")
tarfile.open(archive).extractall("orthos", filter="data")
client = Client(LocalCluster())
o = ortho.load(client, "orthos", name)
```
These archives require the schema-version-2 reader. A compatible package
revision is [6e67ed8](https://github.com/Reilly-Lab-Yale/scMPRAforge/commit/6e67ed8c49609de57b64bd0b2b556f17b4b12467):
```bash
pip install "scMPRAforge @ git+https://github.com/Reilly-Lab-Yale/scMPRAforge.git@6e67ed8c49609de57b64bd0b2b556f17b4b12467"
```
## Licence and source data
| files | licence | reason |
|---|---|---|
| `orthos/seelig_*.tar.gz` | [CC-BY-NC-4.0](https://creativecommons.org/licenses/by-nc/4.0/) | contains Yin et al.'s count table, published under CC-BY-NC-4.0 |
| everything else | [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) | our fits, and the `shendure` and `cohen` count tables, whose sources are CC-BY-4.0 |
The count tables are processed from the depositing studies' public data:
| dataset | deposit | source terms |
|---|---|---|
| `shendure` | GEO [GSE217686](https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE217686) | paper is CC-BY-4.0 |
| `cohen` | GEO [GSE188639](https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE188639), Zenodo [14907846](https://doi.org/10.5281/zenodo.14907846) | Zenodo deposit is CC-BY-4.0 |
| `seelig` | GEO [GSE269037](https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE269037) (scMPRA), [GSE269036](https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE269036) (bulk) | paper is CC-BY-NC-4.0 |
## Citation
TODO on acceptance.