Skip to main content

topological velocity inference from single-cell spatial transcriptomic data

Project description

TopoVelo

TopoVelo stands for Topological velocity inference. It is a tool for jointly modeling temporal gene expression and spatial cellular dynamics from spatial transcriptomic data. The method applies a graph variational autoencoder to recover spatially-coupled RNA velocity and reveal the spatial migration of cells during tissue growth.

Table of Contents

Installation

To install the TopoVelo package, you can use pip: Locally:

git clone https://github.com/welch-lab/TopoVelo.git
cd TopoVelo
pip install .

From PyPI:

pip install topovelo

Usage

The package provides function modules for training and evaluating a TopoVelo model and plotting results. The default pipeline with minimal hyperparameter tuning is shown as follows:

import scanpy as sc
import scvelo as scv
import topovelo as tpv
import torch

# Load .h5ad to AnnData
adata = sc.read(< path to .h5ad >)

# Preprocessing
spatial_key = 'X_spatial'
tpv.preprocess(adata, n_gene=200, spatial_key=spatial_key)
tpv.build_spatial_graph(adata, spatial_key)

# Create a VAE object 
device = torch.device('cpu') if torch.cuda.is_available() else torch.device('cpu')
vae = tpv.VAE(adata, tmax=20, dim_z=5, device=device)

# Training
vae.train(adata, adata.obsp['spatial_graph'], spatial_key)

# Save results
vae.save_model(< path to model parameters >, 'encoder', 'decoder')
vae.save_anndata(adata, 'gat', < path to output >, file_name="adata_out.h5ad")

Examples of advanced usage, model evaluation and plotting can be found in the tutorial.

License

GNU General Public License v3.0

Contact

The package is currently maintained by Yichen Gu. Please contact the maintainer via gyichen@umich.edu.

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

topovelo-0.0.2.tar.gz (185.1 kB view details)

Uploaded Source

Built Distribution

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

topovelo-0.0.2-py3-none-any.whl (194.5 kB view details)

Uploaded Python 3

File details

Details for the file topovelo-0.0.2.tar.gz.

File metadata

  • Download URL: topovelo-0.0.2.tar.gz
  • Upload date:
  • Size: 185.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.0

File hashes

Hashes for topovelo-0.0.2.tar.gz
Algorithm Hash digest
SHA256 59142b7bf2d079895f5fddd47cab208d3c6936f2e99c7429de5f7697669c3ee8
MD5 a7ba9b6ba92ed57f5d732511a8619023
BLAKE2b-256 8e8b3ccdedd2c60148c1d578281edb6f672adda484bf88e8e7c995d401d14a6b

See more details on using hashes here.

File details

Details for the file topovelo-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: topovelo-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 194.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.0

File hashes

Hashes for topovelo-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c698f12d47dcc5eb8c14fea1e3417f5b1058d71d9cbe2d76f0bebd2b2c0b43ef
MD5 cf7fecc1734a346851dcfd74b174eac1
BLAKE2b-256 43fc46feff5bee6eef5125f52da273fcafce709fce639cc07e0d89e87d07f84d

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