Git Product home page Git Product logo

tysserand's Introduction

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.8.10
pyenv virtualenv 3.8.10 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.

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.

tysserand's People

Contributors

alexcoul avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tysserand's Issues

Add weights

Provide option to compute weights for edges, for instance:

  • decrease with edge length
  • increase with length of contact line between Voronoi cells

Add time series spatial reconstruction

Reconstruct spatial networks from data acquired at different time steps (TS).
How to link nodes across time steps is an open question and may vary between analyses:

  • link nodes by identity: if at different TS we can identify each node and they are the same across some time steps, we link them for these TS
  • allow link to future neighbors: we could project nodes positions in the next TS and link them to their future neighbors, by radial distance, knn or Delaunay triangulation methods
  • other ideas are welcome
    Then one important parameter is how to set the fake distance between TS compared to real spatial distances? We may consider the relationship between space and time given by the speed of cell migration or diffusion of chemicals. This is probably an important parameter for blind neighborhood discovery like in mosna.

Fail to install tysserand

Hello,
I am trying to use the installation instructions provided by you. I am using cmd on windows 10 to create a new environment for tysserand as you suggested (and since direct pip install tysserand also doesn't work). However, with mamba, I am getting this error:

C:\Users\akhan>mamba env create --file environment.yml
Traceback (most recent call last):
File "C:\Users\akhan\Miniconda3\Scripts\mamba-script.py", line 6, in
from mamba.mamba import main
File "C:\Users\akhan\Miniconda3\lib\site-packages\mamba\mamba.py", line 49, in
from mamba import repoquery as repoquery_api
File "C:\Users\akhan\Miniconda3\lib\site-packages\mamba\repoquery.py", line 12, in
def _repoquery(query_type, q, pool, fmt=api.QueryFormat.JSON):
AttributeError: module 'libmambapy' has no attribute 'QueryFormat'

And with pyenv, I am getting this:

C:\Users\akhan>pyenv virtualenv 3.8.10 spatial-networks
pyenv: no such command 'virtualenv'

Can you please guide me on how to install tysserand on windows 10?

Best,
Arif

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.