Skip to content

Commit

Permalink
Add case-sensitive validation for config change through command line
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasEskildsen committed Jul 5, 2024
1 parent 4f3eaac commit 4e025ab
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from snakemake.utils import min_version
min_version("7.18.2")

configfile: "config/config.yaml"

# Rules
include: "rules/common.smk"
include: "rules/01-concatenate_fastq.smk"
include: "rules/02-filtering.smk"
Expand All @@ -19,11 +19,22 @@ include: "rules/06-relabel.smk"
include: "rules/07-clustering_identity.smk"
include: "rules/08-taxonomy.smk"
include: "rules/09-fix_otu_table.smk"
include: "rules/10-prep_for_ampvis2.smk" # <- shouldn't be necessary, amp_load() reads sintax files directly, see "taxonomy" here https://kasperskytte.github.io/ampvis2/reference/amp_load.html#arguments-1
include: "rules/10-prep_for_ampvis2.smk"
include: "rules/11-prep_for_phyloseq.smk"
include: "rules/12-phyloseq_abund_blast.smk"
include: "rules/13-ampvis2_std_plots.smk"
include: "rules/capture_config.smk" # <- this is a custom rule to capture the config file and changes to config file
### Validate configuration options for "include_sintax_output" and "include_blast_output"
def validate_boolean_config(config_value, config_name):
if not isinstance(config_value, bool):
raise ValueError(f"Invalid value for {config_name}: '{config_value}'. It must be True or False (case-sensitive).")
# Validate the configuration values
validate_boolean_config(config["include_blast_output"], "include_blast_output")
validate_boolean_config(config["include_sintax_output"], "include_sintax_output")

# Assign the configuration values to variables
include_blast_output = config["include_blast_output"]
include_sintax_output = config["include_sintax_output"]
## Function to generate output files for "rule all" are defined in the common.smk file
rule all:
input:
Expand Down

0 comments on commit 4e025ab

Please sign in to comment.