Load Data

recon.data.load_data.download_tutorial(filename: str | None = None, data_dir: str = './data', force: bool = False) str | dict

Download one tutorial file, or all tutorial files.

This is a user-facing alias around fetch_tutorial_data() and fetch_all_tutorial_data().

Parameters:
  • filename (str, optional) – Tutorial file to download. If omitted, all registered tutorial files are downloaded.

  • data_dir (str, default="./data") – Base directory for downloaded files.

  • force (bool, default=False) – If True, re-download existing files.

Returns:

Local path for a single file, or a mapping from filenames to local paths when downloading all files.

Return type:

str or dict

recon.data.load_data.fetch_all_tutorial_data(data_dir: str = './data/perturbation_tuto', force: bool = False) dict

Download all tutorial data files.

Parameters:
  • data_dir (str, default="./data/perturbation_tuto") – Directory to save the downloaded files.

  • force (bool, default=False) – If True, re-download even if files exist.

Returns:

Dictionary mapping filenames to their local paths.

Return type:

dict

recon.data.load_data.fetch_tutorial_data(filename: str, data_dir: str = './data', force: bool = False) str

Download tutorial data files from Zenodo.

Parameters:
  • filename (str) –

    Name of the file to download. Available files:

    Perturbation tutorial (tutorials 1-3): - “perturbation_tuto/rna.h5ad”: scRNA-seq data (24 MB) - “perturbation_tuto/rna_treated.h5ad”: treated scRNA-seq data (1.7 GB) - “perturbation_tuto/grn.csv”: pre-computed GRN (168 MB)

    GRN inference tutorial (tutorial 4): - “build_grn_tuto/pbmc10x.h5mu”: multimodal PBMC data (748 MB)

  • data_dir (str, default="./data") – Base directory to save the downloaded file.

  • force (bool, default=False) – If True, re-download even if file exists.

Returns:

Path to the downloaded file.

Return type:

str

Examples

>>> from recon.data import fetch_tutorial_data
>>> # Perturbation tutorial
>>> rna_path = fetch_tutorial_data("perturbation_tuto/rna.h5ad")
>>> import scanpy as sc
>>> rna = sc.read_h5ad(rna_path)
>>>
>>> # GRN inference tutorial
>>> mdata_path = fetch_tutorial_data("build_grn_tuto/pbmc10x.h5mu")
>>> import muon as mu
>>> mdata = mu.read(mdata_path)
recon.data.load_data.load_receptor_genes(receptor_gene_list) DataFrame

Load a packaged receptor-to-gene prior.

Parameters:

receptor_gene_list (str) – Name of the packaged prior to load. Available values are listed in receptor_gene_resources.

Returns:

Receptor-to-gene edge table.

Return type:

pandas.DataFrame