Skip to main content

Package introducing the InSituPy framework to analyze single-cell spatial transcriptomics data.

Project description

InSituPy: A framework for histology-guided, multi-sample analysis of single-cell spatial transcriptomics data

InSituPy is a Python package designed to facilitate the analysis of single-cell spatial transcriptomics data. With InSituPy, you can easily load, visualize, and analyze the data, enabling and simplifying the comprehensive exploration of spatial gene expression patterns within tissue sections and across multiple samples. Currently the analysis is focused on data from the Xenium In Situ methodology but a broader range of reading functions will be implemented in the future.

Latest changes

!!!Warning: This repository is under very active development and it cannot be guaranteed that releases contain changes that might impair backwards compatibility. If you observe any such thing, please feel free to contact us to solve the problem. Thanks!

Update to 0.6.3

  • fix bug in ShapesData.crop()
  • add plot_qc_metrices function and show how to determine the filtering threshold in analysis demo notebook

Update to 0.6.2

  • Transcripts are loaded now as dask dataframes instead of pandas dataframes. This makes loading of the transcript data much faster! In case this leads to bugs in other functionalities, please let me know!
  • fixing bugs in "build from scratch" demo
  • add saving possibility to plot_overview()

Update to 0.6.1

  • Changed reading logic of cell_names in BoundariesData: this might lead to issues with backward compatibility but generalizes the reading of boundaries data opening it for other technologies.
  • Adapt viewer for smaller screens
  • Revised automated registration pipeline:
    • Fixed issue with large multiplexed IF images.
    • Area dependent number of minimum matches to make registration pipeline also work on small images.
  • add registration demo notebook for pancreas data
  • by default remove history of variable data when calling .save()

Update to 0.5.0

Major changes in reading/loading logic!

This might conflict with the backwards compatibility of this version! If there are issues with loading reading InSituPy projects saved with older version, please let me know to find workarounds!

  • Reduced focus on Xenium method in data structure
  • InSituData.read() substitutes read_xenium for reading of InSituPy projects. read_xenium used now to read data from Xenium data folders

Installation

Prerequisites

Create and activate a conda environment:

conda create --name insitupy python=3.9
conda activate insitupy

Method 1: From PyPi

pip install insitupy-spatial

Method 2: Installation from Cloned Repository

  1. Clone the repository to your local machine:

    git clone https://github.com/jwrth/InSituPy.git
    
  2. Navigate to the cloned repository and select the right branch:

    cd InSituPy
    
    # Optionally: switch to dev branch
    git checkout dev
    
  3. Install the required packages using pip within the conda environment:

    # basic installation
    pip install .
    
    # for developmental purposes add the -e flag
    pip install -e .
    

Method 3: Direct Installation from GitHub

  1. Install directly from GitHub:

    # for installation without napari use
    pip install git+https://github.com/jwrth/InSituPy.git
    

Make sure you have Conda installed on your system before proceeding with these steps. If not, you can install Miniconda or Anaconda from https://docs.conda.io/en/latest/miniconda.html.

To ensure that the InSituPy package is available as a kernel in Jupyter notebooks within your conda environment, you can follow the instructions here.

Getting started

Documentation

The Documentation is not online yet and will be made public in the next weeks!

(For detailed instructions on using InSituPy, refer to the official documentation, which will be made public after publication. The documentation will provide comprehensive guides on installation, usage, and advanced features.)

Tutorials

Explore the tutorials in ./notebooks/ to learn how to use InSituPy:

Sample level analysis

These tutorials focus on the preprocessing, analysis and handling of individual samples.

  1. Registration of additional images - Learn how to register additional images to the spatial transcriptomics data.
    1. Alternatively this is also implemented for an example dataset from pancreatic cancer
  2. Basic analysis functionalities - Learn about the basic functionalities, such as loading of data, basic preprocessing and interactive visualization with napari.
  3. Add annotations - Learn how to add annotations from external software such as QuPath and do annotations in the napari viewer.
  4. Crop data - Learn how to crop your data to focus your analysis on specific areas in the tissue.
  5. Cell type annotation - Shows an example workflow to annotate the cell types.
  6. Explore gene expression along axis - Example cases showing how to correlate gene expression with e.g. the distance to histological annotations.
  7. Build an InSituData object from scratch - General introduction on how to build an InSituData object from scratch.

Experiment-level analysis

This set of tutorials focuses on

  1. Analyze multiple samples at once with InSituPy - Introduces the main concepts behind the InSituExperiment class and how to work with multiple samples at once.
  2. Differential gene expression analysis - Perform differential gene expression analysis within one sample and across multiple samples.

Example data

If you want to test the pipeline on different example datasets, this notebook provides an overview of functions to download Xenium In Situ data from official sources.

Features

  • Data Preprocessing: InSituPy provides functions for normalizing, filtering, and transforming raw in situ transcriptomics data.
  • Interactive Visualization: Create interactive plots using napari to easily explore spatial gene expression patterns.
  • Annotation: Annotate Xenium In Situ data in the napari viewer or import annotations from external tools like QuPath.
  • Multi-sample analysis: Perform analysis on an experiment-level, i.e. with multiple samples at once.

Contributing

Contributions are welcome! If you find any issues or have suggestions for new features, please open an issue or submit a pull request.

License

InSituPy is licensed under the BSD-3-Clause.


InSituPy is developed and maintained by Johannes Wirth and Anna Chernysheva. Feedback is highly appreciated and hopefully InSituPy helps you with your analysis of spatial transcriptomics data. The package is thought to be a starting point to simplify the analysis of in situ sequencing data in Python and it would be exciting to integrate functionalities for larger and more comprehensive data structures. Currently, the framework focuses on the analysis of Xenium In Situ data but it is planned to integrate more methodologies and any support on this is highly welcomed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

insitupy_spatial-0.6.4.tar.gz (127.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

insitupy_spatial-0.6.4-py3-none-any.whl (152.3 kB view details)

Uploaded Python 3

File details

Details for the file insitupy_spatial-0.6.4.tar.gz.

File metadata

  • Download URL: insitupy_spatial-0.6.4.tar.gz
  • Upload date:
  • Size: 127.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.10.12 Windows/10

File hashes

Hashes for insitupy_spatial-0.6.4.tar.gz
Algorithm Hash digest
SHA256 4662cee1b59caa379d41a37ac7b6c0b9d8648cab80fd3592596f6f30e09721a5
MD5 67b596182b66d1dd6d257b162a8efa05
BLAKE2b-256 ca946d4aabab384f16c2f6299cfc44130befec38c46ab103d14c709f69193434

See more details on using hashes here.

File details

Details for the file insitupy_spatial-0.6.4-py3-none-any.whl.

File metadata

  • Download URL: insitupy_spatial-0.6.4-py3-none-any.whl
  • Upload date:
  • Size: 152.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.10.12 Windows/10

File hashes

Hashes for insitupy_spatial-0.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 216452cd10708a955765a589a133ff8beb6769ade633463dbc737e6d2ed291ad
MD5 adc2be44fead28c7dd7e4c04f5619a03
BLAKE2b-256 115414bfe678838e997019207190683b98910c6bd7042362735e5c591e8c9069

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page