cdm_data_loaders.pipelines.all_the_bacteria ¶
All The Bacteria bulk data downloader.
Project documentation: https://allthebacteria.org/
Batch downloading from OSF: https://allthebacteria.org/docs/osf_downloads/
all_atb_files.tsv: https://osf.io/xv7q9/files/r6gcp (or Rg6cp, casing varies)
AtbSettings ¶
Bases: FileFormatIngestSettings
Configuration for running the AllTheBacteria import pipeline.
Source code in src/cdm_data_loaders/pipelines/all_the_bacteria.py
raw_data_dir
cached
property
¶
Directory to save downloaded raw data files to: <output_dir>/raw_data/<version>.
pattern_matches
cached
property
¶
The regular expression pattern to be used to select files for download.
If a pattern_file is supplied, it will read in the file at {input_dir}/{pattern_file} and convert the contents into a regular expression. If no file is supplied or the file is empty or does not contain any content, the default PROJECT_PART_REGEX will be used instead.
post_init_checks ¶
Ensure that the raw data dir can be created.
load_patterns ¶
Load the pattern file and convert it into a set of regexes.
Source code in src/cdm_data_loaders/pipelines/all_the_bacteria.py
download_atb_index_tsv ¶
Download the ATB file index TSV file from the OSF and save it to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
AtbSettings
|
pipeline config |
required |
Returns:
| Type | Description |
|---|---|
Path
|
path to the downloaded file |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
if the download URL cannot be found |
Source code in src/cdm_data_loaders/pipelines/all_the_bacteria.py
get_file_download_links ¶
get_file_download_links(
settings: AtbSettings, atb_files_tsv: Path
) -> Generator[list[dict[str, Any]], Any]
Parse the ATB file index TSV and to yield a list of files to download.
:yield: list of fields to download
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
AtbSettings
|
pipeline config |
required |
atb_files_tsv
|
Path
|
path to the ATB file index TSV file |
required |
Source code in src/cdm_data_loaders/pipelines/all_the_bacteria.py
osf_file_downloader ¶
osf_file_downloader(
settings: AtbSettings,
atb_file_list: list[dict[str, Any]],
) -> Generator[DataItemWithMeta, Any]
Download files from OSF to the local storage space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
AtbSettings
|
pipeline config |
required |
atb_file_list
|
list[dict[str, Any]]
|
info about files to transfer, as a list of dictionaries |
required |
Source code in src/cdm_data_loaders/pipelines/all_the_bacteria.py
atb_file_list ¶
Generate a list of files to download from the list of all ATB files.
Source code in src/cdm_data_loaders/pipelines/all_the_bacteria.py
file_downloader ¶
file_downloader(
atb_file_list: list[dict[str, Any]],
settings: AtbSettings,
) -> Generator[DataItemWithMeta, Any]
Download ATB files to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
AtbSettings
|
pipeline config |
required |
atb_file_list
|
list[dict[str, Any]]
|
list of files to download |
required |
Returns:
| Type | Description |
|---|---|
Generator[DataItemWithMeta]
|
output of the osf_file_downloader |
Source code in src/cdm_data_loaders/pipelines/all_the_bacteria.py
run_atb_pipeline ¶
Run the AllTheBacteria pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
AtbSettings
|
configuration for the pipeline |
required |