Skip to main content

Destriper

Destriper corrects striping artefacts in VisiumHD spatial transcriptomics count data.

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.

Method overview

  • 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.2 and tabmat==4.2.1 are pinned exactly — the coordinate-descent solver relies on private internals of those versions.
  • This package is derived from the destriping-GLM repo.

Metadata

Release files for destriper 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for destriper 0.1.1
File Size Uploaded Provenance Actions
destriper-0.1.1.tar.gz 4.1 MB Without provenance Details for destriper-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for destriper 0.1.1
File Interpreter ABI Platform Actions
destriper-0.1.1-py3-none-any.whl Python 3 none any Details for destriper-0.1.1-py3-none-any.whl

Total release size: 4.2 MB

Release files / destriper-0.1.1.tar.gz

Download URL destriper-0.1.1.tar.gz
Size 4.1 MB
Tags Source
SHA-256 checksum
How to use checksums
dac54b38e93fcf9a80d90559f09a15a1003c53e84e7d0c28f87d1ddefbf2104d
BLAKE2b-256 checksum
How to use checksums
1c62109a3134b20f726a6c7552efa4e7da2754648c7b5cf8828a4790aeb17d2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release files / destriper-0.1.1-py3-none-any.whl

Download URL destriper-0.1.1-py3-none-any.whl
Size 50.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a3bf7ca669f3de6cb00820ccb4c32929455cf9376fbe23b4f781c3c6f81296c
BLAKE2b-256 checksum
How to use checksums
79eb61e07e7889d03ecf7d763ba39c698b4a5fcb4bc927d9e5e37242e93b8742
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Security for destriper 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page