Skip to main content

torch-adata: bridging AnnData-based data models to torch.

Project description

torch-adata-logo

PyPI pyversions PyPI version Documentation Status Code style: black

Create PyTorch Datasets from AnnData

Installation

Install from PYPI (current version: 0.0.24):

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.

torch-adata-concept-overview

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


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.1.1.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

torch_adata-0.1.1-py3-none-any.whl (43.0 kB view details)

Uploaded Python 3

File details

Details for the file torch_adata-0.1.1.tar.gz.

File metadata

  • Download URL: torch_adata-0.1.1.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for torch_adata-0.1.1.tar.gz
Algorithm Hash digest
SHA256 901cd5512b1004ef5a9e53ecd0f4564985b833812bc3b63da0140a651984e723
MD5 a7753a27b81ed485b17d9d84b2f573c4
BLAKE2b-256 4f80b6ef092f0468c75b61eb4d6e5b5ea52491fdb47564ef13851dbeb0998acb

See more details on using hashes here.

File details

Details for the file torch_adata-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: torch_adata-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 43.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for torch_adata-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c3a28e26852feda5c39b5cdaa03e307c990928d8b72a83f605c9ae160e13f350
MD5 50f09e95eabae158694433c8169f502a
BLAKE2b-256 d381ee95863cf294bfe57f226e77e53d0d46c5353532415e6c29cc41ce78489e

See more details on using hashes here.

Supported by

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