DownloadDatasets package
Submodules
LOGS_solutions.DownloadDatasets.DatasetDownloader module
- class LOGS_solutions.DownloadDatasets.DatasetDownloader.DatasetDownloader(logs, args)[source]
Bases:
objectDownloads all datasets, organized as follows: 1) Claimed/Unclaimed 2) Projects 3) Samples 4) Datasets
- can_create_symlink()[source]
Check if the system supports creating symbolic links.
- Return type:
bool- Returns:
True if the system supports creating symbolic links, False otherwise.
- download_dataset(project_path, sample_path, project, dataset, sample)[source]
Parse and download dataset. Create symlinks if symlink_path is not None. Create metadata files if include_metadata is True.
- Parameters:
project_path (
str) – Path where the project should be saved.sample_path (
str) – Path where the sample should be saved.project (
ProjectMinimal) – Project objectdataset (
Dataset) – Dataset objectsample (
Sample) – Sample object
- download_datasets_structured_helper(dataset, status, sample=None, count=0)[source]
Helper function to call download_datasets_structured with exception handling. :type dataset:
Dataset:param dataset: Dataset object :type status:str:param status: “Claimed” or “Unclaimed” :type sample:Optional[str] :param sample: The sample name of the dataset as a string. If None, it will be set to “Not_mentioned_sample”. :type count:int:param count: The number of samples that have been processed for the current dataset. Used to determine the sample name if the sample parameter is None.
LOGS_solutions.DownloadDatasets.DatasetHandler module
- class LOGS_solutions.DownloadDatasets.DatasetHandler.DatasetHandler(dataset_target_path, dataset, include_metadata=False, duplicate_handling=1, symlink_path=None, original_target_path=None)[source]
Bases:
objectThe class handles the parsing and downloading of unpacked data records in separate folders.
LOGS_solutions.DownloadDatasets.main module
- LOGS_solutions.DownloadDatasets.main.main(args)[source]
Main function to download datasets from a LOGS instance.
Important: This classes uses absolute paths. To obtain the correct absolute path, you must ensure that the relative path is correct in relation to the directory in which the script is executed. If you are not sure, use the absolute path for target_path
- LOGS_solutions.DownloadDatasets.main.parse_args()[source]
Parses the command line arguments.
- Returns:
The parsed arguments.
- LOGS_solutions.DownloadDatasets.main.valid_bool(bool_string)[source]
Validates the given boolean string. The string can be ‘true’, ‘yes’, ‘1’, ‘false’, ‘no’, or ‘0’.
- Parameters:
bool_string (
str) – The boolean string to validate.- Return type:
bool- Returns:
The boolean value of the string.
- LOGS_solutions.DownloadDatasets.main.valid_duplicate_handling(dataset_handling)[source]
Validates how datasets with the same name should be handled. Options: 1: rename, 2: overwrite, 3: take first.
- Parameters:
duplicate_handling – The duplicate handling to validate.
- Return type:
int- Returns:
The duplicate handling as an integer.
- LOGS_solutions.DownloadDatasets.main.valid_ids(project_ids)[source]
Validates the project ids.
- Parameters:
id – ids
- Return type:
List[int]- Returns:
[] if project_ids is None or an empty list, otherwise a list of integers