Estimate and correct row/column multiplicative stripe artifacts in high-resolution spatial transcriptomics count data.
Project description
estriper
Destriper corrects striping artefacts in high-resolution spatial transcriptomics count data (e.g. Visium HD 2 µm bins).
Under the hood, the method fits a negative binomial model to each nucleic bin $ij$ total counts $k_{ij}$: $k_{ij} \sim NB(\text{mean} = c_p h_i w_j, \text{dispersion} = \theta)$, where $h_i$, $w_j$ are row/column stripe factors, and $c_p$ a per-nucleus concentration [counts/bin]. The fitted stripe factors are then applied to all bins to produce destriped counts.
- The underlying mean-variance relationship reads $\text{var} = \mu + \theta\mu^2$.
- Fitted stripe factors $h_i$ and $w_j$ equal 1 on average.
Cite
To learn more about the method, or to cite, use:
Paola Malsot, Malte Londschien, Valentina Boeva, Gunnar Rätsch, Striping artifact removal in VisiumHD data through nuclear counts modeling, Bioinformatics, Volume 42, Issue Supplement_1, July 2026, btag306, https://doi.org/10.1093/bioinformatics/btag306
Install
pip install destriper # low-level interface
pip install "destriper[anndata]" # + AnnData interface
Tutorial
See the tutorial notebook for an example on Visium HD mouse brain data.
Usage
Low-level interface
import destriper as ds
# nucleus bins only; counts are per-bin TOTAL counts
result = ds.fit(
counts, # 1-D int array
row_indices, # 1-D int array (array-grid row)
column_indices, # 1-D int array (array-grid col)
nucl_labels, # 1-D array of nucleus ids (non-null)
cv="spatial", # "spatial" | "default" | int (KFold) | per-bin group array
max_iter_theta=5,
max_iter=100_000,
)
result.row_factors # pandas Series h_i
result.col_factors # pandas Series w_j
result.nucl_concentration # pandas Series c_p
result.dispersion # fitted NB theta
# apply to ALL bins (nucleus bins -> quantile matching, others -> division)
corrected_totals = ds.destripe_tot_counts(
tot_counts, row_indices, column_indices, nucl_labels, result
)
# rescale the sparse count matrix to the corrected totals
corrected_matrix, achieved_totals = ds.rescale(count_matrix, corrected_totals)
achieved_totals can differ from corrected_totals on originally-empty bins:
a zero row cannot be rescaled to a positive target, so it stays zero. Both are
returned so the discrepancy is explicit.
Anndata interface
import destriper as ds
result = ds.fit_adata(
adata,
nucl_key="nucleus_id",
count_key="total_counts", # None -> compute from adata.X
row_key="array_row",
col_key="array_col",
)
ds.destripe_adata(adata, result, source_layer=None, target_layer="destriped")
# writes adata.layers["destriped"], adata.obs["ds_destripe_factor"], adata.obs["ds_corrected_counts"]
# and adata.uns["destriper"]["result"]
Fitting uses only bins with a non-null nucl_key; unlabelled (cytoplasm) bins
are ignored during fitting and corrected by division at destriping time.
Notes
glum==3.1.2andtabmat==4.2.1are pinned exactly — the coordinate-descent solver relies on private internals of those versions.- This package is derived from the destriping-GLM repo.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file destriper-0.1.0.tar.gz.
File metadata
- Download URL: destriper-0.1.0.tar.gz
- Upload date:
- Size: 4.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43c14a9e74baf957455bf4559f10fd46904a2131941c0816a735359d9a4b5691
|
|
| MD5 |
033cdb85f0d95a7e3b6c242e8abdf5f5
|
|
| BLAKE2b-256 |
41df63b3e6d152ad79b53e5c3887d073a3bb4bed09a3ae79dcb2c6f8406c8b51
|
File details
Details for the file destriper-0.1.0-py3-none-any.whl.
File metadata
- Download URL: destriper-0.1.0-py3-none-any.whl
- Upload date:
- Size: 50.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3e95439645f4b918c7654730835f8ee1fe4a385eb62432dcae691dc7db8fa9f
|
|
| MD5 |
61aff19bf3f0274f1916491d2869705c
|
|
| BLAKE2b-256 |
8d649838f1b5ef80023e7a88d8fc5ce4def6df882d69bc84be4836a2c1a83e4c
|