From 1e5e058dc91f1d2dbe1da88e5f5f266fe3eec771 Mon Sep 17 00:00:00 2001 From: burri0000 <dominik.burri@unibas.ch> Date: Tue, 13 Jul 2021 14:31:43 +0200 Subject: [PATCH] adjust all config files and test cases to new optional field. --- scripts/prepare_inputs.py | 7 +++--- tests/input_files/config.mutliple_lanes.yml | 11 +++++----- tests/input_files/config.yaml | 2 +- tests/input_files/config_alfa.yaml | 22 +++++++++---------- .../expected_output.md5 | 2 +- workflow/Snakefile | 8 +++---- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/scripts/prepare_inputs.py b/scripts/prepare_inputs.py index 426902a..e47fa3d 100755 --- a/scripts/prepare_inputs.py +++ b/scripts/prepare_inputs.py @@ -678,9 +678,10 @@ def main(args): salmon_indexes: "{salmon_indexes}" star_indexes: "{star_indexes}" alfa_indexes: "{alfa_indexes}" - report_description: "{args.description}" - report_logo: "{args.logo}" - report_url: "{args.url}" + optional: + report_description: "{args.description}" + report_logo: "{args.logo}" + report_url: "{args.url}" ... ''' args.config_file.write(config_file_content) diff --git a/tests/input_files/config.mutliple_lanes.yml b/tests/input_files/config.mutliple_lanes.yml index ada2c6b..016692d 100644 --- a/tests/input_files/config.mutliple_lanes.yml +++ b/tests/input_files/config.mutliple_lanes.yml @@ -1,15 +1,14 @@ --- samples: "../input_files/samples.multiple_lanes.tsv" - rule_config: "../input_files/rule_config.yaml" output_dir: "results" log_dir: "logs" kallisto_indexes: "results/kallisto_indexes" salmon_indexes: "results/salmon_indexes" star_indexes: "results/star_indexes" alfa_indexes: "results/alfa_indexes" - report_description: "No description provided by user" - report_logo: "../../images/logo.128px.png" - report_url: "https://zavolan.biozentrum.unibas.ch/" - author_name: "NA" - author_email: "NA" + optional: + rule_config: "../input_files/rule_config.yaml" + report_description: "No description provided by user" + report_logo: "../../images/logo.128px.png" + report_url: "https://zavolan.biozentrum.unibas.ch/" ... diff --git a/tests/input_files/config.yaml b/tests/input_files/config.yaml index f3cb261..54edf9c 100644 --- a/tests/input_files/config.yaml +++ b/tests/input_files/config.yaml @@ -1,7 +1,6 @@ --- # Required fields samples: "../input_files/samples.tsv" - rule_config: "../input_files/rule_config.yaml" output_dir: "results" log_dir: "logs" kallisto_indexes: "results/kallisto_indexes" @@ -10,6 +9,7 @@ alfa_indexes: "results/alfa_indexes" # Optional fields optional: + rule_config: "../input_files/rule_config.yaml" report_description: "No description provided by user" report_logo: "../../images/logo.128px.png" report_url: "https://zavolan.biozentrum.unibas.ch/" diff --git a/tests/input_files/config_alfa.yaml b/tests/input_files/config_alfa.yaml index 60c1e0a..06decc6 100644 --- a/tests/input_files/config_alfa.yaml +++ b/tests/input_files/config_alfa.yaml @@ -1,14 +1,14 @@ --- samples: "../input_files/samples_alfa.tsv" - output_dir: "results/" - log_dir: "logs/" - kallisto_indexes: "results/kallisto_indexes/" - salmon_indexes: "results/salmon_indexes/" - star_indexes: "results/star_indexes/" - alfa_indexes: "results/alfa_indexes/" - report_description: "No description provided by user" - report_logo: "../../images/logo.128px.png" - report_url: "https://zavolan.biozentrum.unibas.ch/" - author_name: "NA" - author_email: "NA" + output_dir: "results" + log_dir: "logs" + kallisto_indexes: "results/kallisto_indexes" + salmon_indexes: "results/salmon_indexes" + star_indexes: "results/star_indexes" + alfa_indexes: "results/alfa_indexes" + optional: + rule_config: "../input_files/rule_config.yaml" + report_description: "No description provided by user" + report_logo: "../../images/logo.128px.png" + report_url: "https://zavolan.biozentrum.unibas.ch/" ... diff --git a/tests/test_scripts_prepare_inputs_table/expected_output.md5 b/tests/test_scripts_prepare_inputs_table/expected_output.md5 index 53afed5..dc555cc 100644 --- a/tests/test_scripts_prepare_inputs_table/expected_output.md5 +++ b/tests/test_scripts_prepare_inputs_table/expected_output.md5 @@ -1,2 +1,2 @@ -40bd0f0fcecdd0d9bc932f63c2811478 config.yaml +90e90bb60335a2e17cd40cbf058af7b7 config.yaml c8dcc5a203e9046806c4090525960151 samples.tsv diff --git a/workflow/Snakefile b/workflow/Snakefile index b5e295d..e5d270b 100644 --- a/workflow/Snakefile +++ b/workflow/Snakefile @@ -49,13 +49,13 @@ for optkey, value in template_config['optional'].items(): # Parse YAML rule config file -if 'rule_config' in config and config['rule_config']: +if 'rule_config' in config['optional'] and config['optional']['rule_config']: try: - with open(config['rule_config']) as _file: + with open(config['optional']['rule_config']) as _file: rule_config = yaml.safe_load(_file) - logger.info(f"Loaded rule_config from {config['rule_config']}.") + logger.info(f"Loaded rule_config from {config['optional']['rule_config']}.") except FileNotFoundError: - logger.error(f"No rule config file found at {config['rule_config']}. Either provide file or remove rule_config parameter from config.yaml! ") + logger.error(f"No rule config file found at {config['optional']['rule_config']}. Either provide file or remove rule_config parameter from config.yaml! ") raise else: rule_config = {} -- GitLab