From add125261c6fa0ed7c9906fc85e7368d2072c4a3 Mon Sep 17 00:00:00 2001 From: Dries Schaumont <5946712+DriesSchaumont@users.noreply.github.com> Date: Mon, 7 Oct 2024 11:06:04 +0200 Subject: [PATCH] FEAT: avoid using boolean_false (#160) --- CHANGELOG.md | 4 ++++ CONTRIBUTING.md | 6 ++++++ src/agat/agat_convert_bed2gff/config.vsh.yaml | 2 +- src/agat/agat_convert_bed2gff/script.sh | 2 +- src/cutadapt/config.vsh.yaml | 4 ++-- src/cutadapt/script.sh | 4 ++-- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1654375..47c786c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,10 @@ ## MINOR CHANGES +* `agat_convert_bed2gff`: change type of argument `inflate_off` from `boolean_false` to `boolean_true` (PR #160). + +* `cutadapt`: change type of argument `no_indels` and `no_match_adapter_wildcards` from `boolean_false` to `boolean_true` (PR #160). + * Upgrade to Viash 0.9.0. # biobox 0.2.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a32b680c..1e4ef18c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -231,6 +231,12 @@ Finally, add all other arguments to the config file. There are a few exceptions: * If the help lists defaults, do not add them as defaults but to the description. Example: `description: . Default: 10.` +Note: + +* Prefer using `boolean_true` over `boolean_false`. This avoids confusion when specifying values for this argument in a Nextflow workflow. + For example, consider the CLI option `--no-indels` for `cutadapt`. If the config for `cutadapt` would specify an argument `no_indels` of type `boolean_false`, + the script of the component must pass a `--no-indels` argument to `cutadapt` when `par_no_indels` is set to `false`. This becomes problematic setting a value for this argument using `fromState` in a nextflow workflow: with `fromState: ["no_indels": true]`, the value that gets passed to the script is `true` and the `--no-indels` flag would *not* be added to the options for `cutadapt`. This is inconsitent to what one might expect when interpreting `["no_indels": true]`. + When using `boolean_true`, the reasoning becomes simpler because its value no longer represents the effect of the argument, but wether or not the flag is set. ### Step 10: Add a Docker engine diff --git a/src/agat/agat_convert_bed2gff/config.vsh.yaml b/src/agat/agat_convert_bed2gff/config.vsh.yaml index a0fafc44..4466b5f1 100644 --- a/src/agat/agat_convert_bed2gff/config.vsh.yaml +++ b/src/agat/agat_convert_bed2gff/config.vsh.yaml @@ -49,7 +49,7 @@ argument_groups: - name: --inflate_off description: | By default we inflate the block fields (blockCount, blockSizes, blockStarts) to create subfeatures of the main feature (primary_tag). The type of subfeature created is based on the inflate_type parameter. If you do not want this inflating behaviour you can deactivate it by using the --inflate_off option. - type: boolean_false + type: boolean_true - name: --inflate_type description: | Feature type (3rd column in gff) created when inflate parameter activated [default: exon]. diff --git a/src/agat/agat_convert_bed2gff/script.sh b/src/agat/agat_convert_bed2gff/script.sh index fbeb9206..4d4b8209 100644 --- a/src/agat/agat_convert_bed2gff/script.sh +++ b/src/agat/agat_convert_bed2gff/script.sh @@ -4,7 +4,7 @@ ## VIASH END # unset flags -[[ "$par_inflate_off" == "true" ]] && unset par_inflate_off +[[ "$par_inflate_off" == "false" ]] && unset par_inflate_off [[ "$par_verbose" == "false" ]] && unset par_verbose # run agat_convert_sp_bed2gff.pl diff --git a/src/cutadapt/config.vsh.yaml b/src/cutadapt/config.vsh.yaml index 7e36a8e0..e20fb7fb 100644 --- a/src/cutadapt/config.vsh.yaml +++ b/src/cutadapt/config.vsh.yaml @@ -196,7 +196,7 @@ argument_groups: length of matching region. Default: 0.1 (10%). example: 0.1 - name: --no_indels - type: boolean_false + type: boolean_true description: | Allow only mismatches in alignments. @@ -218,7 +218,7 @@ argument_groups: description: | Interpret IUPAC wildcards in reads. - name: --no_match_adapter_wildcards - type: boolean_false + type: boolean_true description: | Do not interpret IUPAC wildcards in adapters. - name: --action diff --git a/src/cutadapt/script.sh b/src/cutadapt/script.sh index d181e2b0..1986e162 100644 --- a/src/cutadapt/script.sh +++ b/src/cutadapt/script.sh @@ -96,9 +96,9 @@ debug # Input arguments ########################################################### echo ">> Parsing input arguments" -[[ "$par_no_indels" == "true" ]] && unset par_no_indels +[[ "$par_no_indels" == "false" ]] && unset par_no_indels [[ "$par_match_read_wildcards" == "false" ]] && unset par_match_read_wildcards -[[ "$par_no_match_adapter_wildcards" == "true" ]] && unset par_no_match_adapter_wildcards +[[ "$par_no_match_adapter_wildcards" == "false" ]] && unset par_no_match_adapter_wildcards [[ "$par_revcomp" == "false" ]] && unset par_revcomp input_args=$(echo \