Skip to main content

Investigation of pair-wise single cell interactions through statistically interpreting spatial cell state correlations learned by self-supervised graph inductive bias transformer

Description

GITIII is a python packaged used for analyzing cell-cell interaction (CCI) in imaging-based spatial transcriptomics with minium demand on the ligand-receptor database since many imaging-based ST datasets contain low or even no ligand-receptor pairs in the measured genes.

The main functionalities of GITIII includes:

  1. Estimating the influence tensor that describe how each cell is influenced by its top k (default 50) nearest neighbors
  2. Visualizing the relationship between the strength of interaction with the distance between two cells
  3. Visualizing the funcitons of CCI pairs using UMAP: the pair of one sender cell influencing one receiver cell is called a CCI pair, and the estimated influence from the sender cell to the receiver cell (how much the gene expression in the receiver cell would change because of the existing of the sender cell) are treated as the features of the CCI pair. This function aim to visualize how different CCI pairs belonging to different cell type combinations differ from each other in terms of their functions
  4. Prediction visualization: visualize the predicted cell expression v.s. predicted expression, can be state expression or raw expression
  5. Information flow: Where are the strongest CCI pairs in the slide (tissue section), with arrows in the plot indicating the interaction from one sender cell to one receiver cell
  6. Cell subtyping analysis: Construct interpretable CCI-informed features for each cell, (how each cell type influence each measured genes in this cell), use these features to do Leiden clustering and UMAP visualization. Then differential expressed gene (DEG) analysis can be performed on these subtypes (subgroups), and we can also visualize how this cell ('s one target gene) is influenced by other cell types via heatmap.
  7. Network analysis: Using partial linear regression to make statistical test of whether one cell type significantly influence one gene in the receiver cell type, forming a significant CCI network targeting each gene.

Installation

It is recommanded to install it in a environment with pytorch installed.

git clone https://github.com/lugia-xiao/GITIII.git
cd GITIII
pip install .

Or

pip install gitiii

Quick start

Data you need:

:param df_path: str, the path of your dataset, which should be a .csv file with columns of:

  • genes (more than one column), as described below, these columns form the (normalized) expression matrix. values in these columns must be int or float
  • "centerx": x coordinates of the cells. int or float
  • "centery": y coordinates of the cells. int or float
  • "section": which tissue slide this cell belongs to, since a dataset may contain more than one slide. string
  • "subclass": the cell type annotation for this cell. string

:param genes: list of str, a python list of measured gene names in the dataset

:param species: str, what is the species of your dataset, must be one of "human" or "mouse"

# Import necessary python packages
import gitiii

estimator=gitiii.estimator.GITIII_estimator(df_path=df_path,genes=genes,use_log_normalize=True,species="human",use_nichenetv2=True,visualize_when_preprocessing=False,distance_threshold=80,process_num_neighbors=50,num_neighbors=50,batch_size_train=256,lr=1e-4,epochs=50,node_dim=256,edge_dim=48,att_dim=8,batch_size_val=256)

Preprocess dataset

estimator.preprocess_dataset()

Train the deep learning model

estimator.train()

Calculate the influence tensor

estimator.calculate_influence_tensor()

Visualize the spatial patterns

sample='H20.33.001.CX28.MTG.02.007.1.02.03'

spatial_visualizer=gitiii.spatial_visualizer.Spatial_visualizer(sample=sample)

spatial_visualizer.plot_distance_scaler(rank_or_distance="distance",proportion_or_abs="abs",target_gene=None,bins=300, frac=0.003)

Cell subtyping analysis

subtyping_analyzer=gitiii.subtyping_analyzer.Subtyping_anlayzer(sample=sample,normalize_to_1=True,use_abs=True,noise_threshold=2e-2)
# Take L2/3 IT as an example for CCI informed subtyping analysis
COI="L2/3 IT" # Cell Of Interest
subtyping_analyzer.subtyping(COI=COI,resolution=0.1)

For more detailed tutorial, please refer to tutorial.nbconvert.ipynb

Metadata

Release files for gitiii 0.1.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 gitiii 0.1.0
File Size Uploaded Provenance Actions
gitiii-0.1.0.tar.gz 436.2 kB Without provenance Details for gitiii-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 875.4 kB

Release files / gitiii-0.1.0.tar.gz

Download URL gitiii-0.1.0.tar.gz
Size 436.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7d7253173685951e582b7d98a20c65a51465e5235403b859db40d51b5d37dc24
BLAKE2b-256 checksum
How to use checksums
79b8c796168e4942e171bd3cf31f79a0365a7408b95b79eafde8aa4a12c7543d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / gitiii-0.1.0-py3-none-any.whl

Download URL gitiii-0.1.0-py3-none-any.whl
Size 439.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ecb090397b13f7f4e52c2712ac9ce0ff404bdda400cf5966c28af830e4c448e
BLAKE2b-256 checksum
How to use checksums
346053952efcbad89a9b79810bef8c8e273fe682684e818f38182fcb18451844
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Security for gitiii 0.1.0

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

0.1.0 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