Skip to main content

tysserand

Fast and accurate spatial networks reconstruction.

tysserand is a Python library to reconstruct spatial networks from spatially resolved omics experiments. It is intended as a common tool where the bioinformatics community can add new methods to reconstruct networks, choose appropriate parameters, clean resulting networks and pipe data to other libraries.
You can find the article and supplementary information on Bioinformatics, and the freely available preprint (same text!) is on BioRxiv.
A turorial is available here

tysserand is fast: it is 50 to more than 120 times faster than PySAL.
tysserand is accurate: it implements the best performing methods, tested on simulated and real bioimages. tysserand is user friendly and interactive: it integrates tools to choose appropriate parameters and facilitates the use of napari-based interactive image visualization and network annotation. tysserand is modular and opened to contributions: if you have an idea on how to improve reconstruction methods, create a particular one for a specific case, or make them even faster, join us!

Installation

Simply do

pip install tysserand

If you want the latest features not published on PyPI run

pip install git+https://github.com/VeraPancaldiLab/tysserand.git

It is best practice to create a dedicated environment for each project. To do it with pyenv:

# create environment
pyenv install 3.10.13
pyenv virtualenv 3.10.13 spatial-networks
# add environment to jupyterlab
pyenv activate spatial-networks
ipython kernel install --user --name=spatial-networks

or with Conda and Mamba:

# create environment
conda install mamba -n base -c conda-forge
mamba env create --file environment.yml
# add environment to jupyterlab
conda activate spatial-networks
ipython kernel install --user --name=spatial-networks

If you want to reproduce results in the publication, install also PySAL

pip install libpysal geopandas fiona shapely pyproj rtree

Implemented methods

Set of nodes

Delaunay triangulation

This method builds virtual cells centered arround each node and contacting each other to fully tile the space occupyied by the nodes. Edges are drawn between the nodes of contacting tiles. The node_adaptive_trimming option can infer a better distance threshold to discard edges for each individual node.

Edge lengths with Delaunay reconstruction
Trimmed network
Network overlay on original tissue image

k-nearest neighbors

Each node is linked with its k nearest neighbors. It is the most common method used in single cell publications, althought it produces artifacts well visible on simple 2D networks.

Edge lengths with k-nearest neighbors reconstruction

radial distance neighbors

Each node is linked to nodes closer than a threshold distance D, that is to say each node is linked to all nodes in a circle of radius D.

Edge lengths with radial distance neighbors reconstruction

Area contact

Nodes are the center of detected objects (like after cell segmentation) and they are linked if their respective areas are in contact or closer than a given distance threshold.
A parallelized version is implemented with the Dask library.

Contacting areas reconstruction

Area contact and k-nearest neighbors

Areas are linked if they are in contact or closer than a given distance. Then, the remaining non connected areas are connected with their nearest neighbors.

Release files for tysserand 0.6.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 tysserand 0.6.0
File Size Uploaded
tysserand-0.6.0.tar.gz 31.7 kB Details

Built distribution (wheel)

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

Total release size: 62.0 kB

Release files / tysserand-0.6.0.tar.gz

Download URL tysserand-0.6.0.tar.gz
Size 31.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a9008103fc16fd6bde98fde68eeffafa70c801e53971211c2bf033bb2740a5b2
BLAKE2b-256 checksum
How to use checksums
b017041d9fe702f50225d3c122cd3094ec5d60d8e2b2631a2d21f0ee63ea89e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.12 Linux/6.5.0-45-generic

Release files / tysserand-0.6.0-py3-none-any.whl

Download URL tysserand-0.6.0-py3-none-any.whl
Size 30.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a83f40cbb79fec60c4c7e0626010e2af7d290f6a5be117eba2d7ff83e565a911
BLAKE2b-256 checksum
How to use checksums
148195cb0c5e7353d735420785b438ce5a1950b96f786057dc9da0131ae69d28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.12 Linux/6.5.0-45-generic

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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