Skip to main content

Quality Control for image-based spatial transcriptomics data — Python port of SpaceTrooper

Project description

py-spacetrooper

PyPI version Python versions License: MIT PyPI downloads

Python port of SpaceTrooper — Quality Control for image-based spatial transcriptomics data.

Parity: Pearson r = 0.989 vs R | Speed: 102× faster

Install

pip install py-spacetrooper

Quickstart

import anndata as ad
from spacetrooper import SpaceTrooper

# Load your spatial data
adata = ad.read_h5ad("your_data.h5ad")

# Run QC pipeline
st = SpaceTrooper(adata)
st.spatial_per_cell_qc()
st.compute_qc_score()

# Access results
print(st.adata.obs["QC_score"])  # QC scores (0-1)

Functional API

from spacetrooper import (
    spatial_per_cell_qc,
    compute_outliers_qc_score,
    check_outliers,
    compute_qc_score,
)

spatial_per_cell_qc(adata)
compute_outliers_qc_score(adata)
check_outliers(adata)
compute_qc_score(adata)

Supported platforms

Platform Function Description
Nanostring CosMx read_cosmx_spe Transcriptomics + Proteomics
Vizgen MERFISH read_merfish_spe MERFISH / Merscope
10x Xenium read_xenium_spe Xenium output bundle

What's included

Python function R equivalent Description
spatial_per_cell_qc spatialPerCellQC Per-cell QC metrics
compute_spatial_outlier computeSpatialOutlier Outlier detection (medcouple/MAD)
compute_outliers_qc_score computeOutliersQCScore Outlier labels for QC formula
check_outliers checkOutliers Validate outlier counts
compute_qc_score computeQCScore Ridge logistic regression QC score
compute_threshold_flags computeThresholdFlags Fixed threshold flags
read_cosmx_spe readCosmxSPE Read CosMx data
read_merfish_spe readMerfishSPE Read MERFISH data
read_xenium_spe readXeniumSPE Read Xenium data
read_polygons readPolygons Read polygon boundaries
plot_metric_hist plotMetricHist Metric histogram
plot_centroids plotCentroids Spatial scatter plot

Parity with R

Metric Value Threshold
QC_score Pearson r 0.989 ≥ 0.90
Intermediate metrics < 1e-13 < 1e-8
Wall-clock speed 102× faster

Citation

@article{righelli2024spacetrooper,
  title={SpaceTrooper: Quality Control for image-based spatial transcriptomics},
  author={Righelli, Dario and Banzi, Benedetta and Marchionni, Matteo and others},
  year={2024},
  journal={Bioinformatics}
}

License

MIT (matches upstream SpaceTrooper)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_spacetrooper-0.1.1.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_spacetrooper-0.1.1-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file py_spacetrooper-0.1.1.tar.gz.

File metadata

  • Download URL: py_spacetrooper-0.1.1.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for py_spacetrooper-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7491593a7cca6cf7399bd9d6ed0512944fc95cddbf73b642091de94369726c58
MD5 46fd84a7877c5d0520f2d8f57cd6ee3e
BLAKE2b-256 9c401e35eb1a96b606deabd1b827a98575c95d012400a98ba2e7a3f3c685853b

See more details on using hashes here.

File details

Details for the file py_spacetrooper-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for py_spacetrooper-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 57b41df059b1801ececcb8199cc97108fa2187fae98c7f0662fd2d530c7d500b
MD5 afa9adcc85247f38311c25bb007f45a0
BLAKE2b-256 88915e54548dfe9e33e5265f2acc8d657bf8c1da2a611b1a2876e24a20522396

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page