diff --git a/README.md b/README.md index 3b8d84b..8214290 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ information from the loaded data to handle batch effects and confounding factors metadata, and labels. 🧬 **Integration with datasets library**: BioSets builds on the `datasets` library's -functionality. Note that if `path` is not a value found in `biosets.list_experiments()`, -it acts like Huggingface's `datasets` library. +functionality. Note that if `path` is not a value found in +`biosets.list_experiment_types()`, it acts like Huggingface's `datasets` library. ## Getting Started diff --git a/src/biosets/__init__.py b/src/biosets/__init__.py index 9609491..b96306e 100644 --- a/src/biosets/__init__.py +++ b/src/biosets/__init__.py @@ -25,3 +25,4 @@ decode, ) from .load import load_dataset, concatenate_datasets, load_from_disk +from .packaged_modules import list_experiment_types diff --git a/src/biosets/packaged_modules/__init__.py b/src/biosets/packaged_modules/__init__.py index 1381bdb..3816691 100644 --- a/src/biosets/packaged_modules/__init__.py +++ b/src/biosets/packaged_modules/__init__.py @@ -100,3 +100,15 @@ "rna": "rna-seq", "asv": "otu", # we are not treating ASV as a separate dataset type currently } + + +def list_experiment_types(experiment_type=None): + if experiment_type is not None: + if experiment_type in DATASET_NAME_TO_OMIC_TYPE: + return list(DATASET_NAME_TO_OMIC_TYPE[experiment_type]) + else: + raise ValueError( + f"Invalid experiment type: {experiment_type}. " + f"Valid experiment types are: {list(DATASET_NAME_TO_OMIC_TYPE.keys())}" + ) + return sorted(list(DATASET_NAME_TO_OMIC_TYPE.keys()))