Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

DonorData


Build License Read the Docs Test PyPI pre-commit

DonorData: single-cell data across donors, samples and cells

Installation | API | Specification | Design | Changelog

DonorData overview

Data structure

DonorData represents single-cell data together with data on the donors the cells come from, and optionally on the samples in between.

DonorData
  .D             donors, one row per donor (a DataFrame of donor labels, or AnnData, MuData, EHRData)
  .S             samples, one row per sample, optional (DataFrame, AnnData or EHRData)
  .C             cells (AnnData or MuData)
  .obsm          matrices aligned to the donors, such as embeddings or pseudobulk profiles
  .obsp          donor by donor matrices, such as distances
  .uns           unstructured annotations

C.obs[donor_id] names the donor of every cell. With a sample level, C.obs[sample_id] names the sample of every cell and S[donor_id] the donor of every sample. Selecting units at one level selects the matching units at the other levels, and matrices in obsm and obsp are subset with them. A donor can be any unit that groups cells, for example a patient, a target gene in a CRISPR screen or a compound in a drug screen.

Overview

Input

The most common input is an AnnData of cells whose obs repeats donor labels, such as disease or age, on every cell. from_anndata moves the columns that are constant within donors into a donor table, so D is a DataFrame with one row per donor and C.obs keeps the cell-level columns:

from donordata import DonorData

dd = DonorData.from_anndata(adata, donor_id="patient")
dd.D

A donor table can also be passed directly. D is an AnnData only when donors have measurements of their own, such as the genotypes that cellink analyses:

dd = DonorData(D=patients, C=adata, donor_id="patient")

With several samples per donor, sample_id adds the sample table S:

dd = DonorData.from_anndata(adata, donor_id="patient", sample_id="sample")

Selection and aggregation

dd = dd.filter_donors("age > 60")
dd = dd.filter_donors_by_cells(20, groupby="cell_type", level="sample")
dd.get_df(["age", "timepoint", "CD14"], level="cell")
dd.composition("cell_type", level="sample")
profiles = dd.pseudobulk(groupby="cell_type", layer="counts", level="sample")
train, test = dd.train_test_split(0.2, stratify="disease")

I/O with .dd.h5 and .dd.zarr files

DonorData objects are written to an HDF5 file or a Zarr store with one AnnData or MuData group per level, which can also be read with anndata alone.

import donordata

dd.write_dd("cohort.dd.zarr")
dd = donordata.io.read_dd("cohort.dd.zarr")

Installation

pip install donordata

See the installation guide for optional dependencies.

Tutorials

The tutorials cover a first object, a patient cohort, a CRISPR screen and electronic health records.

Packages using DonorData

cellink holds the genotypes of donors in D and runs single-cell genetics on them, from eQTL mapping and rare variant tests to colocalization and LD score regression. patpy computes representations of donors or samples from their cells and compares them across a cohort.

Citation

If you use DonorData, please cite it as described in CITATION.cff.

Metadata

Release files for donordata 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for donordata 0.1.0
File Size Uploaded Provenance Actions
donordata-0.1.0.tar.gz 1.1 MB With provenance Details for donordata-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for donordata 0.1.0
File Interpreter ABI Platform Actions
donordata-0.1.0-py3-none-any.whl Python 3 none any Details for donordata-0.1.0-py3-none-any.whl

Total release size: 1.2 MB

Release files / donordata-0.1.0.tar.gz

Download URL donordata-0.1.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
d656e9d71c4129b9dcd6c80822331c1799c4c0c72d7d41d272588a967892418b
BLAKE2b-256 checksum
How to use checksums
91f42ce4e04fecb0ab9aec5871e2f4c0aa8db63dd1395702b0ab5f68a84607fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / donordata-0.1.0-py3-none-any.whl

Download URL donordata-0.1.0-py3-none-any.whl
Size 61.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
256160ad72b298b83fc0affb80a8e8654fdf5ccd87ea1a86a5e9d9a3a018b628
BLAKE2b-256 checksum
How to use checksums
bb396d4573df68e171becf8f24035c158a99b394e834257de7f2b29b6de8c05a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for donordata 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for donordata-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page