Quality Control for image-based spatial transcriptomics data — Python port of SpaceTrooper
Project description
py-spacetrooper
Python port of SpaceTrooper — Quality Control for image-based spatial transcriptomics data.
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)
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
- Pearson r = 0.989 against R
computeQCScoreoutput - Intermediate metrics match to machine precision (< 1e-13)
- 102× faster than R (0.068s vs 6.956s on 905-cell CosMx data)
Citation
@article{righelli2024spacetrooper,
title={SpaceTrooper: Quality Control for image-based spatial transcriptomics},
author={Righelli, Dario and others},
year={2024}
}
License
MIT (matches upstream SpaceTrooper)
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
py_spacetrooper-0.1.0.tar.gz
(24.0 kB
view details)
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 py_spacetrooper-0.1.0.tar.gz.
File metadata
- Download URL: py_spacetrooper-0.1.0.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bf6c078776fe9d6ee2a13137bfd985c41ca60016ff335b476f88bed5a30d91a
|
|
| MD5 |
c134064f78eaad0e1fc69520e44fce40
|
|
| BLAKE2b-256 |
0fe372f6438f4db29d22263b7d03ee10553aae18df2aea058eed55c6f1cf9124
|
File details
Details for the file py_spacetrooper-0.1.0-py3-none-any.whl.
File metadata
- Download URL: py_spacetrooper-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba4c053cdfc2594504b4134a882ce8df780d34e8c11818bf1ed6fee30ca3a345
|
|
| MD5 |
e7c97be31861d1f63162501243f7f78b
|
|
| BLAKE2b-256 |
8d41dcb065afdfb726f232e24336d202eb44a29fa9c37c21b0fae0cabf56aa43
|