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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file topovelo-0.0.1a1.tar.gz
.
File metadata
- Download URL: topovelo-0.0.1a1.tar.gz
- Upload date:
- Size: 171.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea46362f3ac47ab60c58d33ce6f3f180eb8abecd0e4460ef57e9885e4dc1266d |
|
MD5 | b1d38381dd66d15149e5d2a9232f9f5b |
|
BLAKE2b-256 | 082f4b7e935b57c6e8ab9ee7f720f1422362a1765cc7da443dc6b199e9435895 |
File details
Details for the file topovelo-0.0.1a1-py3-none-any.whl
.
File metadata
- Download URL: topovelo-0.0.1a1-py3-none-any.whl
- Upload date:
- Size: 178.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8bac901b48402cdab5195077afb28e4751ef6fd93f653427b61f13a4103266c |
|
MD5 | f506c99024fdc1856d62d3f26a21a202 |
|
BLAKE2b-256 | 84fb3d0f7a141feb15feb8f552bb61340d79b14a02dc4689015f8dac2c7a7c93 |