Coder Social home page Coder Social logo

mr-milk / spatialtis Goto Github PK

View Code? Open in Web Editor NEW
29.0 3.0 1.0 161.22 MB

Spatial analysis toolkit for single cell multiplexed tissue data

Home Page: https://spatialtis.readthedocs.io/en/latest/

License: Apache License 2.0

Python 95.29% Shell 1.51% Dockerfile 0.67% R 2.54%
single-cell spaital-analysis tissue spatial-distribution heterogeneity network hotspot imaging-mass-cytometry multiplexed-ion-beam-imaging cell-cell-interaction

spatialtis's Introduction

SpatialTis

Documentation Status CI codecov pypi licence

SpatialTis is an ultra-fast spatial analysis toolkit for large-scale spatial single-cell data.

  • ✔️ Spatial Transcriptome (Non single-cell)
  • ✔️ Spatial Proteome (Single-cell)
  • 🦀 Core algorithms implements in Rust
  • 🚀 Parallel processing support

🔋 Highlighted spatial analysis

  • Cell neighbors search (KD-Tree/R-Tree/Delaunay)
  • Cell-Cell Interaction
  • Marker spatial co-expression
  • Spatial variable genes (current support: SOMDE)
  • GCNG: Inferring ligand-receptor using graph convolution network
  • Identify neighbor dependent markers

📦 Other analysis

  • Spatial distribution
  • Hotspot detection
  • Spatial auto-correlation
  • Spatial heterogeneity

Quick Start

Installation

pypi

SpatialTis requires Python >= 3.8.

Version Support

pip install spatialtis

# For full features
pip install 'spatialtis[all]'

Install the current development version

pip install git+https://github.com/Mr-Milk/SpatialTis.git

Docker

docker pull mrmilk/spatialtis

To start a docker container:

cd your/data/
docker run -it --rm -p 8888:8888 -v "${PWD}:/analysis" spatialtis
  • -it: Run the container in interactive mode
  • -rm: Clean file system in container after shutting down
  • If local port 8888 is taken, try -p 9999:8888 and change to 9999.
  • -v: Mount your data directory to the working directory /analysis in the container. ${PWD} is the directory where you run this command. All changes made in this directory will be saved.

Low level API

If you are interested in using low level algorithms yourself, Please refer to spatialtis_core It provides clear document for all exposed API.

spatialtis's People

Contributors

dependabot-preview[bot] avatar mr-milk avatar renovate-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  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

spatialtis's Issues

errors

Hi, this looks like a really useful package, I hope you are able to continue developing it!
I noted there were some bugs between the pip install spatialtis and pip install 'spatialtis[all]' with the capitilisation of Config/CONFIG between the two when calling this function throughout.
This issue is resolved in the latest github repository and I have been exploring the spatial .st.xxx function in the imc_data.h5ad dataset in your tutorial notebooks, however I see get some errors running the .sp.xxx code from your notebooks, which I have edited in line with the API readthedocs.
shown here for
sp.cell_components and sp.cell_co_occurrence.

these throw the same errors with my dataset - have there been changes to the sp. functions?

st.Config
image

image

sp.cell_components(data, groupby=['stage', 'part'], key='cell_components')

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[55], line 2
      1 islets_cells = ['gamma', 'delta', 'alpha', 'beta']
----> 2 sp.cell_components(data, groupby=['stage', 'part'])

File ~/miniconda3/envs/spatialtis/lib/python3.9/site-packages/spatialtis/plotting/basic.py:42, in cell_components(data, groupby, key, orient, type_order, **plot_options)
     39 data = data.groupby(groupby).sum().melt(
     40     ignore_index=False, value_name="Count").reset_index()
     41 data = data.rename(columns={'cell type': 'Cell Type'})
---> 42 return stacked_bar(data,
     43                    group=groupby,
     44                    value="Count",
     45                    stacked="Cell Type",
     46                    orient=orient,
     47                    **plot_options)

File ~/miniconda3/envs/spatialtis/lib/python3.9/site-packages/milkviz/_stacked_bar.py:88, in stacked_bar(data, group, value, stacked, orient, group_order, stacked_order, percentage, barwidth, cmap, colors, show_values, props, legend_kw, ax)
     86     stacked_order = natsorted(data[stacked].unique())
     87 if group_order is None:
---> 88     group_order = natsorted(data[group].unique())
     90 _, legend_labels, legend_colors = \
     91     cat_colors(stacked_order, stacked_order, cmap, colors)
     93 start_x = 1

File ~/miniconda3/envs/spatialtis/lib/python3.9/site-packages/pandas/core/generic.py:5902, in NDFrame.__getattr__(self, name)
   5895 if (
   5896     name not in self._internal_names_set
   5897     and name not in self._metadata
   5898     and name not in self._accessors
   5899     and self._info_axis._can_hold_identifiers_and_holds_name(name)
   5900 ):
   5901     return self[name]
-> 5902 return object.__getattribute__(self, name)

AttributeError: 'DataFrame' object has no attribute 'unique



sp.cell_co_occurrence(data, ['stage'], use="heatmap")
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[48], line 1
----> 1 sp.cell_co_occurrence(data, ['stage'], use="heatmap")

TypeError: cell_co_occurrence() got multiple values for argument 'use'```

IO for Spatial Coordination

Current we support reading from key in obs with wkt format.

Plan to support

  • Key or keys in .obs, if it's a key with 'centroid' or 'spatial', it will be automatically interpreting as spatial coordinations. Can be either python sequence or Wkt string that fit in GeoPandas. If keys, two or three columns must be specified.
  • Key in .obsm as 2D numpy array

Version 0.6.0

Hi,

Where is the v0.6.0 version of this software? Thank you!

Best,
Yang

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
Dockerfile
  • python 3.10
benchmark/time-giotto.Dockerfile
benchmark/time-spatialtis.Dockerfile
  • python 3
benchmark/time-squidpy.Dockerfile
  • python 3.9
github-actions
.github/workflows/build.yml
  • actions/checkout v3
  • actions/setup-python v4
  • docker/metadata-action v4
  • docker/login-action v2
  • docker/build-push-action v3
.github/workflows/docker-image.yaml
  • actions/checkout v3
  • docker/metadata-action v4
  • docker/login-action v2
  • docker/build-push-action v3
.github/workflows/test.yml
  • actions/checkout v3
  • actions/setup-python v4
  • codecov/codecov-action v3.0.0
  • actions/checkout v3
  • actions/setup-python v4
pep621
pyproject.toml
  • setuptools ~= 58.0
  • setuptools_scm >=6.2
pip_requirements
requirements.ci.txt
requirements.txt
setup-cfg
setup.cfg
  • spatialtis_core >= 0.2.3
  • milkviz >= 0.6.0
  • legendkit >= 0.2.5

  • Check this box to trigger a request for Renovate to run again on this repository

Better handle of centroid and neighbors information in AnnData

Currently, we store the centroid and neighbors in the obs field, which will be parsed as string when read from disk, we need to eval them every time.

Centroid can be possible to store inobsm, since I may have a plan to fully support 3D in the future.

Neighbors' data is might need to move to uns, but we need to give each cell a UUID to track the neighbors.

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.