Skip to main content

PyPI-Server Unit tests

experimenthub

ExperimentHub provides an interface to access and manage data from the Bioconductor ExperimentHub service directly in Python.

It is designed to work within the BiocPy ecosystem, converting R data objects (like SingleCellExperiment or SummarizedExperiment) into their Python equivalents (e.g., SummarizedExperiment) using rds2py.

[!NOTE]

This is an experimental package. It may not work with all RDS files from ExperimentHub. Currently, this package filters ExperimentHub resources to provide access to:

  • File Formats: .rds
  • R Classes: SingleCellExperiment, SummarizedExperiment, RangedSummarizedExperiment, GRanges etc

Files are converted to their respective BiocPy representations or common Python formats.

Install

To get started, install the package from PyPI

pip install experimenthub

Usage

Initialize the Registry

The registry manages the local cache of ExperimentHub metadata and resources. On the first run, it downloads the metadata database.

from experimenthub import ExperimentHubRegistry

# Initialize the registry (downloads metadata if needed)
eh = ExperimentHubRegistry()

Searching for Resources

ExperimentHub contains thousands of datasets. Use the search() method to find resources by title, description, or species.

# Search for mouse-related datasets
results = eh.search("mus musculus")

# Print the first few matches
for record in results[:5]:
    print(f"{record.ehub_id}: {record.title}")
# Output:
# EH1041: Brain scRNA-seq data, sample ...,
# EH1042: Brain scRNA-seq data, gene ...,
# ...

Inspecting Metadata

You can retrieve detailed metadata for a specific ID.

record = eh.get_record("EH4663")

print(f"Title: {record.title}")
print(f"Species: {record.species}")
print(f"Genome: {record.genome}")
print(f"Description: {record.description}")
print(f"R Class: {record.preparer_dataclass}")

## Output:
# Title: Lohoff biorXiv spatial coordinates (sample 2)
# Species: Mus musculus
# Genome: mm10
# Description: Cell spatial coordinates for sample 2 for the E8.5 seqFISH dataset from biorXiv
# R Class: character

Loading Data

The load() method handles the download, caching, and loading of the dataset.

If the resource is an R data file (.rds) containing a supported Bioconductor object (e.g., SingleCellExperiment), it is automatically read and converted to an equivalent python object using rds2py.

# Load a data.frame as an BiocFrame object
data = eh.load("EH4663")

print(data)
# BiocFrame with 8425 rows and 3 columns
#                                           x                   y             z
#                                 <FloatList>         <FloatList> <IntegerList>
#  embryo1_Pos0_cell10_z5  0.7084368794499625 -2.7071263060540645             5
# embryo1_Pos0_cell100_z5  0.9763043488304248  -2.517971233335359             5
# embryo1_Pos0_cell101_z5  0.9749347757408557 -2.6739635081030855             5
#                                         ...                 ...           ...
# embryo1_Pos28_cell97_z5 -1.3992279805347039  3.1761928631722824             5
# embryo1_Pos28_cell98_z5  -1.389353519722718  3.1349508225406666             5
# embryo1_Pos28_cell99_z5  -1.394992277928857  2.5812717935734355             5

Supported File Formats

ExperimentHub supports downloading and parsing both .rds and .rda / .rdata files.

  • .rds files return the parsed Python equivalent object directly (e.g. SummarizedExperiment).
  • .rda or .rdata files return a Python dictionary mapping serialized variable names to their parsed Python object representations.

Note

This project has been set up using BiocSetup and PyScaffold.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

experimenthub-0.0.2.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

experimenthub-0.0.2-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file experimenthub-0.0.2.tar.gz.

File metadata

  • Download URL: experimenthub-0.0.2.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for experimenthub-0.0.2.tar.gz
Algorithm Hash digest
SHA256 9012bac6dbef1e1e5e088e70d3fb720a9ce0c0ea6aedfdcbc1826cb4af523607
MD5 c43d80e8b616d3f5446a576efaea7be7
BLAKE2b-256 1a9281ec9ebd24b6ed1a42c8bfbc19994e504da9cc04805f6900992826734e59

See more details on using hashes here.

Provenance

The following attestation bundles were made for experimenthub-0.0.2.tar.gz:

Publisher: publish-pypi.yml on BiocPy/experimenthub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file experimenthub-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: experimenthub-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for experimenthub-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 02c4ce06230c34446d58d7c07b5731879f0d8f12e410a8fbd87d67ae98b470f2
MD5 e4cab2949592613442db4f45529ca01e
BLAKE2b-256 40101af3ef9fc3a683bfb4b9ff374797464a1f8f6e2a81777742e044b1acde62

See more details on using hashes here.

Provenance

The following attestation bundles were made for experimenthub-0.0.2-py3-none-any.whl:

Publisher: publish-pypi.yml on BiocPy/experimenthub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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