Skip to main content

sopa_logo

Spatial omics pipeline and analysis

PyPI Downloads Docs Build License uv Ruff

Built on top of SpatialData, Sopa enables processing and analyses of spatial omics data with single-cell resolution (spatial transcriptomics or multiplex imaging data) using a standard data structure and output. We currently support the following technologies: Xenium, Visium HD, MERSCOPE, CosMx, PhenoCycler, MACSima, Molecular Cartography, and others. Sopa was designed for generability and low memory consumption on large images (scales to 1TB+ images).

Documentation

Check Sopa's documentation to get started. It contains installation explanations, CLI/API details, and tutorials.

Overview

The following illustration describes the main steps of sopa:

sopa_overview

Installation

Sopa can be installed from PyPI on all OS, for any Python version >=3.11. On a new environment, run the following command:

pip install sopa

Features

Sopa comes in four different flavours, each corresponding to a different use case:

  • API: use directly sopa as a Python package for complete flexibility and customization.
  • Snakemake pipeline: choose a config, and run our pipeline on your spatial data in a couple of minutes.
  • nf-core/sopa: run Sopa with Nextflow (see this repo and the corresponding usage guide). Great for Docker users.
  • CLI: use our command-line-interface for prototyping quickly your own pipeline (advanced users).

API

Below is a minimal example of API usage. For a complete API description, please refer to the documentation.

import sopa

sdata = sopa.io.xenium("path/to/data") # reading Xenium data

sopa.make_image_patches(sdata) # creating overlapping patches
sopa.segmentation.cellpose(sdata, "DAPI", diameter=30) # running cellpose segmentation
sopa.aggregate(sdata) # counting the transcripts inside the cells

Snakemake pipeline

Clone our repository, choose a config here (or create your own), and execute our pipeline locally or on a high-performance cluster:

git clone https://github.com/prism-oncology/sopa.git
cd sopa/workflow
snakemake --configfile=/path/to/yaml_config --config data_path=/path/to/data_directory --cores 1 --use-conda

For more details on snakemake configuration and how to properly setup your environments, please refer to the documentation.

CLI

Below are examples of commands that can be run with the sopa CLI. For a complete description of the CLI, please refer to the documentation.

> sopa --help # show command names and arguments
> sopa convert merscope_directory --technology merscope # read some data
> sopa patchify image merscope_directory.zarr # make patches for low-memory segmentation
> sopa segmentation cellpose merscope_directory.zarr --diameter 60 --channels DAPI # segmentation
> sopa resolve cellpose merscope_directory.zarr # resolve segmentation conflicts at boundaries
> sopa aggregate merscope_directory.zarr --average-intensities # transcripts/channels aggregation
> sopa explorer write merscope_directory.zarr # convert for interactive vizualisation

Cite us

Our article is published in Nature Communications. You can cite Sopa as below:

Blampey, Q., Mulder, K., Gardet, M. et al. Sopa: a technology-invariant pipeline for analyses of image-based spatial omics.
Nat Commun 15, 4981 (2024). https://doi.org/10.1038/s41467-024-48981-z

Metadata

Release files for sopa 2.2.12

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

Source distribution (sdist)

Source distribution for sopa 2.2.12
File Size Uploaded Provenance Actions
sopa-2.2.12.tar.gz 143.4 kB Without provenance Details for sopa-2.2.12.tar.gz

Built distribution (wheel)

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

Total release size: 332.6 kB

Release files / sopa-2.2.12.tar.gz

Download URL sopa-2.2.12.tar.gz
Size 143.4 kB
Tags Source
SHA-256 checksum
How to use checksums
03ced26be460fda03db69c4d4d5f6350040826b7a333f6e265ab91f628e8b4c1
BLAKE2b-256 checksum
How to use checksums
ddfa34b5832ab572cd03f1400e59989d8818c75a90c311a3755d5d5cd9d6fe6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.20

Release files / sopa-2.2.12-py3-none-any.whl

Download URL sopa-2.2.12-py3-none-any.whl
Size 189.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3eb3a03fd5ca56f4b1d9d33708476acbc41f28509aa07148d369d1ef14c52b5
BLAKE2b-256 checksum
How to use checksums
53af8e651c88cd77158bf3b57d748ef8db7b1ec06b3b15db8385d8ad055f9a1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.20

Security for sopa 2.2.12

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

2.2.12 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