Skip to main content

torch-adata

Project description

torch-adata-logo

PyPI pyversions PyPI version Documentation Status Code style: black

Create PyTorch Datasets from AnnData

Installation

Install from PYPI:

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])

For more information, please visit the documentation!

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

torch-adata-0.0.16.tar.gz (22.5 kB view hashes)

Uploaded Source

Built Distribution

torch_adata-0.0.16-py3-none-any.whl (27.2 kB view hashes)

Uploaded Python 3

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