Skip to main content

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

Metadata

Release files for troutpy 0.2.0

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

Source distribution (sdist)

Source distribution for troutpy 0.2.0
File Size Uploaded Provenance Actions
troutpy-0.2.0.tar.gz 16.2 MB With provenance Details for troutpy-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 16.3 MB

Release files / troutpy-0.2.0.tar.gz

Download URL troutpy-0.2.0.tar.gz
Size 16.2 MB
Tags Source
SHA-256 checksum
How to use checksums
d4724e8459d144f8d67318af4375083c22510840ca5aea8aa2e865cb09986b57
BLAKE2b-256 checksum
How to use checksums
16fa8a1feaa8f1421c18443325fd275b0e21e01b49e9e07fa3b6c7e73e9e74c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / troutpy-0.2.0-py3-none-any.whl

Download URL troutpy-0.2.0-py3-none-any.whl
Size 125.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5dbe5a79a67f8d3c7db043cecc18e4a54dacf2f5d75256ea32db945271f54b1d
BLAKE2b-256 checksum
How to use checksums
5e4d8103e6fbb54afca512ceb89936271351e5f311fc0bb3349d54b5ba37dc82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Security for troutpy 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for troutpy-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

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.

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