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.
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
Metadata
Release files for torch-adata 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| torch_adata-0.1.1.tar.gz | 32.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| torch_adata-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 75.5 kB
Release files / torch_adata-0.1.1.tar.gz
| Download URL | torch_adata-0.1.1.tar.gz |
|---|---|
| Size | 32.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
901cd5512b1004ef5a9e53ecd0f4564985b833812bc3b63da0140a651984e723
|
|
BLAKE2b-256 checksum How to use checksums |
4f80b6ef092f0468c75b61eb4d6e5b5ea52491fdb47564ef13851dbeb0998acb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / torch_adata-0.1.1-py3-none-any.whl
| Download URL | torch_adata-0.1.1-py3-none-any.whl |
|---|---|
| Size | 43.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3a28e26852feda5c39b5cdaa03e307c990928d8b72a83f605c9ae160e13f350
|
|
BLAKE2b-256 checksum How to use checksums |
d381ee95863cf294bfe57f226e77e53d0d46c5353532415e6c29cc41ce78489e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for torch-adata 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.