Skip to main content

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.

Metadata

Release files for topovelo 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for topovelo 0.0.2
File Size Uploaded
topovelo-0.0.2.tar.gz 185.1 kB Details

Built distribution (wheel)

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

Total release size: 379.5 kB

Release files / topovelo-0.0.2.tar.gz

Download URL topovelo-0.0.2.tar.gz
Size 185.1 kB
Tags Source
SHA-256 checksum
How to use checksums
59142b7bf2d079895f5fddd47cab208d3c6936f2e99c7429de5f7697669c3ee8
BLAKE2b-256 checksum
How to use checksums
8e8b3ccdedd2c60148c1d578281edb6f672adda484bf88e8e7c995d401d14a6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.0

Release files / topovelo-0.0.2-py3-none-any.whl

Download URL topovelo-0.0.2-py3-none-any.whl
Size 194.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c698f12d47dcc5eb8c14fea1e3417f5b1058d71d9cbe2d76f0bebd2b2c0b43ef
BLAKE2b-256 checksum
How to use checksums
43fc46feff5bee6eef5125f52da273fcafce709fce639cc07e0d89e87d07f84d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.0

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

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