Skip to main content

Temporally unified RNA velocity inference

Project description

UniTVelo for RNA Velocity Analysis

Temporally unified RNA velocity for single cell trajectory inference (UniTVelo) is implementated on Python 3 and TensorFlow 2. The model estimates velocity of each gene and updates cell time based on phase portraits concurrently. human bone marrow velocity stream

The major features of UniTVelo are,

  • Using spliced RNA oriented design to model RNA velocity and transcription rates
  • Introducing a unified latent time (Unified-time mode) across whole transcriptome to incorporate stably and monotonically changed genes
  • Retaining gene-spcific time matrics (Independent mode) for complex datasets

UniTVelo has proved its robustness in 10 different datasets. Details can be found via our manuscript in bioRxiv which is currently under review (UniTVelo).

Installation

GPU Acceleration

UniTVelo is designed based on TensorFlow's automatic differentiation architecture. Please make sure TensorFlow 2 and relative CUDA dependencies are correctly installed.

Use the following scripts to confirm TensorFlow is using the GPU.

import tensorflow as tf
print ("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))

If GPU is not available, UniTVelo will automatically switch to CPU for model fitting or it can be spcified in config.py (see Getting Started below).

Main Module

(Optional) Create a separate conda environment for version control and to avoid potential conflicts.

conda create -n unitvelo python=3.7
conda activate unitvelo

UniTVelo package can be conveniently installed via PyPI or directly from GitHub repository.

pip install unitvelo

or

pip install git+https://github.com/StatBiomed/UniTVelo

Getting Started

Public Datasets

Examples of UniTVelo and steps for reproducible results are provided in Jupyter Notebook under notebooks folder. Specifically, please refer to records analyzing Mouse Erythroid and Human Bone Marrow datasets.

UniTVelo has proved its performance through 10 different datasets and 4 of them have been incorporated within scVelo package, see datasets. Others can be obtained via link.

RNA Velocity on New Dataset

UniTVelo provides an integrated function for velocity analysis by default whilst specific configurations might need to be adjusted accordingly.

  1. Import package
import unitvelo as utv
  1. Sub-class and override base configuration file (here lists a few frequently used), please refer config.py for detailed arguments.
velo = utv.config.Configuration()
velo.R2_ADJUST = True 
velo.IROOT = None
velo.FIT_OPTION = '1'
velo.GPU = 0
  • Arguments:
    • -- velo.R2_ADJUST (bool), linear regression R-squared on extreme quantile (default) or full data (adjusted)
    • -- velo.IROOT (str), specify root cell cluster would enable diffusion map based time initialization, default None
    • -- velo.FIT_OPTION (str), '1' Unified-time mode (default), '2' Independent mode
    • -- velo.GPU (int), specify the GPU card used for fitting, -1 will switch to CPU mode, default 0.
  1. Run model (label refers to column name in adata.obs specifying celltypes)
adata = utv.run_model(path_to_adata, label, config_file=velo)
scv.pl.velocity_embedding_stream(adata, color=label, dpi=100, title='')
  1. Evaluation metrics (Optional)
# Cross Boundary Direction Correctness
# Ground truth should be given via `cluster_edges`
metrics = {}
metrics = utv.evaluate(adata, cluster_edges, label, 'velocity')

# Latent time estimation
scv.pl.scatter(adata, color='latent_time', color_map='gnuplot', size=20)

# Phase portraits for individual genes (experimental)
utv.pl.plot_range(gene_name, adata, velo, show_ax=True, time_metric='latent_time')

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

unitvelo-0.2.5.2.tar.gz (35.5 kB view details)

Uploaded Source

Built Distribution

unitvelo-0.2.5.2-py3-none-any.whl (38.7 kB view details)

Uploaded Python 3

File details

Details for the file unitvelo-0.2.5.2.tar.gz.

File metadata

  • Download URL: unitvelo-0.2.5.2.tar.gz
  • Upload date:
  • Size: 35.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for unitvelo-0.2.5.2.tar.gz
Algorithm Hash digest
SHA256 30e09218c5de9452e5f0c74287fe3a3775b2739c1a162f25be6e4a1c36770ddb
MD5 119aa8286d5651ff43769662733d1d4a
BLAKE2b-256 05c373151ce261fd8a41c8fe7b51f41181c01c6af3e40f8068c04148f1aa6a4e

See more details on using hashes here.

File details

Details for the file unitvelo-0.2.5.2-py3-none-any.whl.

File metadata

  • Download URL: unitvelo-0.2.5.2-py3-none-any.whl
  • Upload date:
  • Size: 38.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for unitvelo-0.2.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 44e74ee6501eaca98f8236d05e8ab6cfa6718d3e9d82d0f0598c22e5b48101f8
MD5 1dd4188641fa60e1dd822bb1627aebd8
BLAKE2b-256 5e5d0a9cdd47e480c9311fa1bb3c670a43762fd367f23d9bd45f6f0eab8311c7

See more details on using hashes here.

Supported by

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