Skip to content
theislabPublic

About

Package for the analysis of Transcripts outside segmented cells in ST data

Resources

Contributing

Stars

32 stars

Watchers

0 watching

Forks

Repository files navigation

troutpy

Tests Documentation

Package for the analysis of unassigned RNA during segmentation in image-based spatial transcriptomics, in python.

alt text

Getting started

Please refer to the documentation, in particular, the API documentation.

Installation

You need to have Python 3.10 or newer installed on your system. If you don't have Python installed, we recommend installing Miniforge.

There are several alternative options to install troutpy:

  1. Install the latest release of troutpy from PyPI:
pip install troutpy
  1. Install the latest development version:
pip install git+https://github.com/theislab/troutpy.git@main

Some functionality (spatial statistics, segmentation-free clustering, chord-diagram plots, morphological metrics, factor analysis, vendor-format readers) requires optional extras. Install everything with pip install "troutpy[all]", or pick individual extras (spatial-stats, segmentation-free, chord, morphology, factor-analysis, io, viz) as needed.

Usage

troutpy follows the scverse API conventions: preprocessing in tp.pp, analysis tools in tp.tl and plotting in tp.pl, all operating on a SpatialData object.

import spatialdata as sd
import troutpy as tp

sdata = sd.read_zarr("data.zarr")

# classify unassigned transcripts into cell-like RNA and uRNA
tp.pp.segmentation_free_sainsc(sdata, binsize=5, celltype_key="leiden")
tp.pp.define_urna(sdata, method="sainsc")

# characterize uRNA per gene and infer its source cells
tp.tl.quantify_overexpression(sdata, codeword_key="control_probe")
tp.tl.extracellular_enrichment(sdata)
tp.tl.density_similarity(sdata)
tp.tl.urna_source_score(sdata, cell_type_col="leiden")

See the basic tutorial for a complete, step-by-step walkthrough on a public Xenium mouse brain dataset.

Reproducibility

Code, notebooks, and instructions to reproduce the results from the paper are available at the reproducibility repository. This repository also includes diverse tutorials and complementary functions that are not core to Troutpy, but are required to reproduce the figures from Marco Salas et al. 2025.

Release notes

See the changelog.

Contact

For questions and help requests, you can reach out in the scverse discourse. If you found a bug, please use the issue tracker.

Citation

t.b.a

About

Package for the analysis of Transcripts outside segmented cells in ST data

Resources

Contributing

Stars

32 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages