Datasets (mtb.data)¶
Download the demo datasets the tutorials use into
mtb.config.data_path. mtb.catalog.datasets() lists them.
| Name | Summary |
|---|---|
mtb.data.fetch |
Download demo datasets into the data root, skipping those present. |
mtb.data.write_example |
Write the example files of a tutorial dataset as .h5ad files. |
mtb.data.fetch
¶
Download demo datasets into the data root, skipping those present.
| PARAMETERS | DESCRIPTION |
|---|---|
*datasets
|
Dataset ids;
type
|
verbose
|
Print one "downloading ..." line per dataset.
type
|
| RETURNS | DESCRIPTION |
|---|---|
pathlib.Path or list of pathlib.Path
|
The dataset folder, |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
A dataset id that cannot be downloaded (the message lists the ids). |
OSError
|
The download failed; the message names the URL. |
Examples
>>> import multibench as mtb
>>> folder = mtb.data.fetch("D11") # about 11 MB
>>> mtb.scan(folder, "vertical")
Notes
A non-empty <data root>/<dataset>/ counts as present and is left
alone. Each archive is unpacked into a temporary folder under the data
root and then moved into place.
mtb.data.write_example
¶
Write the example files of a tutorial dataset as .h5ad files.
The files hold a part of the dataset in the shape that your own data
usually has: one .h5ad file per object, with the cell types in
obs["celltype"]. The own-data section of each tutorial reads them
until you put your own files in their place. They are named
my_*.h5ad; the printed lines say what each holds. A file of your own
with such a name is kept.
| PARAMETERS | DESCRIPTION |
|---|---|
dataset
|
Id of a tutorial dataset, such as
type
|
folder
|
Folder the files are written to; it is created when it does not exist. The default is the current folder.
type
|
verbose
|
Print one line per file.
type
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
No example is defined for |
FileNotFoundError
|
The dataset is not in the data root; the message gives the |
Examples
>>> import multibench as mtb
>>> mtb.data.fetch("D11")
>>> mtb.data.write_example("D11") # my_file.h5ad: RNA in X, ADT in obsm
See Also
mtb.data.fetch : download the dataset that the example is made from. mtb.io.export_dataset : write the objects read from the files as a dataset folder.