Metadata-Version: 2.1
Name: deepvelo
Version: 0.2.8
Summary: Deep Velocity
Home-page: https://github.com/bowang-lab/DeepVelo
License: MIT
Author: subercui
Author-email: subercui@gmail.com
Requires-Python: >=3.7.1,<3.10
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Provides-Extra: cellrank
Provides-Extra: gpu
Requires-Dist: adjustText (>=0.7.3,<0.8.0)
Requires-Dist: dgl (>=0.4,!=0.8.0.post1,<0.9); extra != "gpu"
Requires-Dist: dgl-cu102 (>=0.4,!=0.8.0.post1,<0.9); extra == "gpu"
Requires-Dist: hnswlib (>=0.6.2,<0.7.0)
Requires-Dist: igraph (>=0.9.10,<0.10.0)
Requires-Dist: matplotlib (>=3.3,<3.6)
Requires-Dist: numpy (>=1.21.1,<2.0.0)
Requires-Dist: scanpy (>=1.8.2,<2.0.0)
Requires-Dist: scvelo (>=0.2.4,<0.3.0)
Requires-Dist: seaborn (>=0.11.2,<0.12.0)
Requires-Dist: torch (>=1.2,<1.13)
Requires-Dist: tqdm (>=4.62.3,<5.0.0)
Requires-Dist: umap-learn (>=0.5.2,<=0.5.4)
Project-URL: Repository, https://github.com/bowang-lab/DeepVelo
Description-Content-Type: text/markdown

# DeepVelo - A Deep Learning-based velocity estimation tool with cell-specific kinetic rates

[![PyPI version](https://badge.fury.io/py/deepvelo.svg)](https://badge.fury.io/py/deepvelo)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

This is the official implementation of the [DeepVelo](https://www.biorxiv.org/content/10.1101/2022.04.03.486877) method.
DeepVelo employs cell-specific kinetic rates and provides more accurate RNA velocity estimates for complex differentiation and lineage decision events in heterogeneous scRNA-seq data. Please check out the paper for more details.

![alt text](https://user-images.githubusercontent.com/11674033/171066682-a899377f-fae1-452a-8b67-8bc8c244b641.png)

## Installation

```bash
pip install deepvelo
```

### Using GPU

The `dgl` cpu version is installed by default. For GPU acceleration, please install a proper [dgl gpu](https://www.dgl.ai/pages/start.html) version compatible with your CUDA environment.

```bash
pip uninstall dgl # remove the cpu version
# replace cu101 with your desired CUDA version and run the following
pip install "dgl-cu101>=0.4.3,<0.7"

```

### Install the development version

We use poetry to manage dependencies.

```bash
poetry install
```

This will install the exact versions in the provided [poetry.lock](poetry.lock) file. If you want to install the latest version for all dependencies, use the following command.

```bash
poetry update
```

## Usage

We provide a number of notebooks in the [exmaples](examples) folder to help you get started. DeepVelo fullly integrates with [scanpy](https://scanpy.readthedocs.io/en/latest/) and [scVelo](https://scvelo.readthedocs.io/). The basic usage is as follows:

```python
import deepvelo as dv
import scvelo as scv

adata = ... # load your data in AnnData format

# preprocess the data
scv.pp.filter_and_normalize(adata, min_shared_counts=20, n_top_genes=2000)
scv.pp.moments(adata, n_neighbors=30, n_pcs=30)

# run DeepVelo using the default configs
trainer = dv.train(adata, dv.Constants.default_configs)
# this will train the model and predict the velocity vectore. The result is stored in adata.layers['velocity']. You can use trainer.model to access the model.
```

### Fitting large number of cells

If you can not fit a large dataset into (GPU) memory using the default configs, please try setting a small `inner_batch_size` in the configs, which can reduce the memory usage and maintain the same performance.

Currently the training works on the whole graph of cells, we plan to release a flexible version using graph node sampling in the near future.

