torch-adata
Project description
Create PyTorch Datasets
from AnnData
Installation
Install from PYPI (current version: 0.0.23
):
pip install torch-adata
Install the developer version:
git clone https://github.com/mvinyard/torch-adata.git; cd torch-adata;
pip install -e .
The main API
The primary class is the AnnDataset
. This is a subclass of the widely-used torch.utils.data.Dataset
. The PyTorch Dataset
module enables us to take advantage of built-in multiprocessing and other organizational tricks that ultimately standardize workflows and enable reproducibility.
import anndata as a
import torch_adata
adata = a.read_h5ad("/path/to/data.h5ad")
dataset = torch_adata.AnnDataset(adata, use_key="X_pca", groupby="time", obs_keys=["affinity"])
[ torch-adata ]: AnnDataset object with 7131 samples
----------------------------------------------------
Grouped by: 'time' with attributes:
- X (use_key = 'X_pca') torch.Size([3, 7131, 50])
- obs: affinity: torch.Size([3, 7131, 1])
There is an additional approach to this dubbed AnnLoader
, highlighted by Sergei Rybakov in Interfacing pytorch models with anndata
For more information, please visit the documentation!
Problem? Open an issue
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
torch-adata-0.0.23rc0.tar.gz
(29.0 kB
view hashes)
Built Distribution
Close
Hashes for torch_adata-0.0.23rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bccb338f233d5b3161e567c76f862e47789b585e4dc25b172dc361e62720181a |
|
MD5 | 03fcccc48bee2cd6a33e4c9b80a884cf |
|
BLAKE2b-256 | a8568d9b3b9e0c3aaa1c0ab5f7139287e3d1e0f18ecacdbd2165af729a7e37f4 |