From fc62270a1ed99d6378ddd8f99f2cb80b366585be Mon Sep 17 00:00:00 2001 From: Matthieu Muffato Date: Thu, 28 May 2026 08:24:42 +0100 Subject: [PATCH 1/4] Added an option to select the window size --- CHANGELOG.md | 15 +++++++++++++++ conf/modules.config | 10 ++++++++++ nextflow.config | 5 +++-- nextflow_schema.json | 14 +++++++------- subworkflows/local/fasta_windows.nf | 5 ++--- workflows/sequencecomposition.nf | 1 - 6 files changed, 37 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac0e0d4..5b5cfc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [[1.3.0](https://github.com/sanger-tol/sequencecomposition/releases/tag/1.3.0)] – – +### Enhancements & fixes + +- New `--window_size` parameter to select the size of the windows to compute statistics on. + It replaces `--window_size_info` parameter which was only affecting the naming of the + outputs. + +### Parameters + +| Old parameter | New parameter | +| -------------------- | --------------- | +| `--window_size_info` | | +| | `--window_size` | + +> **NB:** Parameter has been **updated** if both old and new parameter information is present.
**NB:** Parameter has been **added** if just the new parameter information is present.
**NB:** Parameter has been **removed** if new parameter information isn't present. + ## [[1.2.1](https://github.com/sanger-tol/sequencecomposition/releases/tag/1.2.1)] – Easter Bells (patch 1) – [2026-05-15] ### Enhancements & fixes diff --git a/conf/modules.config b/conf/modules.config index 41910ce..4a0e5cb 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -12,7 +12,17 @@ process { + withName: "FASTAWINDOWS" { + ext.args = { "-w ${ params.window_size }" } + } + withName: BGZIPTABIX { + ext.prefix = { + def ws = params.window_size as int + def ws_label = (ws % 1000 == 0) ? "${ws.intdiv(1000)}k" : "${ws}bp" + return "${meta.id}.${ws_label}" + } + ext.args2 = { "--preset bed" + (column_numbers ? "" : " --skip-lines 1") } publishDir = [ path: { "${meta.outdir}/${meta.analysis_subdir}" }, diff --git a/nextflow.config b/nextflow.config index 342d0e7..66149d7 100644 --- a/nextflow.config +++ b/nextflow.config @@ -12,9 +12,10 @@ params { // Input options input = null fasta = null - window_size_info = ".1k" - // keep in sync with the `--window_size` parameter of fasta_windows + + // Output options selected_fw_output = "${projectDir}/assets/fasta_windows.csv" + window_size = 1000 // Boilerplate options outdir = 'results' diff --git a/nextflow_schema.json b/nextflow_schema.json index 3e8a47e..84d88f9 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -10,7 +10,7 @@ "type": "object", "fa_icon": "fas fa-terminal", "description": "Define where the pipeline should find input data and save output data.", - "required": ["outdir", "window_size_info", "selected_fw_output"], + "required": ["outdir", "window_size", "selected_fw_output"], "properties": { "fasta": { "type": "string", @@ -45,12 +45,12 @@ "hidden": true, "fa_icon": "fas fa-barcode" }, - "window_size_info": { - "type": "string", - "default": ".1k", - "hidden": true, - "description": "String to add to all file names generated by the pipeline. This is meant to reflect the size of the windows fasta_windows is computing statistics on.", - "fa_icon": "fas fa-arrows-alt-h" + "window_size": { + "type": "integer", + "default": 1000, + "description": "Window size (in base pairs) used to partition sequences for calculating per-window statistics", + "fa_icon": "fas fa-chart-bar", + "minimum": 1 }, "email": { "type": "string", diff --git a/subworkflows/local/fasta_windows.nf b/subworkflows/local/fasta_windows.nf index 117a142..c67793c 100644 --- a/subworkflows/local/fasta_windows.nf +++ b/subworkflows/local/fasta_windows.nf @@ -10,7 +10,6 @@ workflow FASTA_WINDOWS { take: fasta_fai // [file: /path/to/genome.fa, file: /path/to/genome.fai] output_selection // file: /path/to/fasta_windows.csv - window_size_info // value, used to build meta.id and name files main: @@ -40,7 +39,7 @@ workflow FASTA_WINDOWS { ch_freq_bed_input = FASTAWINDOWS.out.freq .combine(ch_config.freq) .multiMap { meta, freq_file_tsv, column_number, outdir, filename -> - path: [meta + [id: meta.id + "." + filename + window_size_info, analysis_subdir: outdir], freq_file_tsv, meta.max_length] + path: [meta + [id: meta.id + "." + filename, analysis_subdir: outdir], freq_file_tsv, meta.max_length] column_number: ["1-3,${column_number}", 1, "bedGraph"] } @@ -58,7 +57,7 @@ workflow FASTA_WINDOWS { .mix(FASTAWINDOWS.out.dinuc.combine(ch_config.dinuc)) .mix(FASTAWINDOWS.out.trinuc.combine(ch_config.trinuc)) .mix(FASTAWINDOWS.out.tetranuc.combine(ch_config.tetranuc)) - .map { meta, path, outdir, filename -> [meta + [id: meta.id + "." + filename + window_size_info, analysis_subdir: outdir], path] } + .map { meta, path, outdir, filename -> [meta + [id: meta.id + "." + filename, analysis_subdir: outdir], path] } // Compress the BED file ch_tsv_with_seq_length = ch_tsv.map { meta, tsv -> [meta, tsv, meta.max_length] } diff --git a/workflows/sequencecomposition.nf b/workflows/sequencecomposition.nf index 3e658e0..7b08217 100644 --- a/workflows/sequencecomposition.nf +++ b/workflows/sequencecomposition.nf @@ -48,7 +48,6 @@ workflow SEQUENCECOMPOSITION { FASTA_WINDOWS( PARAMS_CHECK.out.fasta_fai, file(params.selected_fw_output, checkExists: true), - params.window_size_info, ) // From f8f0887ec2a817c0dea7502c943f67f95c912a0f Mon Sep 17 00:00:00 2001 From: Matthieu Muffato Date: Thu, 28 May 2026 08:25:38 +0100 Subject: [PATCH 2/4] This file must exist --- CHANGELOG.md | 1 + nextflow_schema.json | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b5cfc5..4b97fd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - New `--window_size` parameter to select the size of the windows to compute statistics on. It replaces `--window_size_info` parameter which was only affecting the naming of the outputs. +- Better validation of the `--selected_fw_output` parameter. ### Parameters diff --git a/nextflow_schema.json b/nextflow_schema.json index 84d88f9..78a9f76 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -41,6 +41,8 @@ "selected_fw_output": { "type": "string", "default": "${projectDir}/assets/fasta_windows.csv", + "format": "file-path", + "exists": true, "description": "Path to comma-separated file containing information about the statistics to select from fasta_windows' output.", "hidden": true, "fa_icon": "fas fa-barcode" From 24006aa097879220a537e747cf82026929965b67 Mon Sep 17 00:00:00 2001 From: Matthieu Muffato Date: Thu, 28 May 2026 09:52:44 +0100 Subject: [PATCH 3/4] We stay the parameter has been renamed, so we can list them on the same line Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b97fd5..4a94f01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,8 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | Old parameter | New parameter | | -------------------- | --------------- | -| `--window_size_info` | | -| | `--window_size` | +| `--window_size_info` | `--window_size` | > **NB:** Parameter has been **updated** if both old and new parameter information is present.
**NB:** Parameter has been **added** if just the new parameter information is present.
**NB:** Parameter has been **removed** if new parameter information isn't present. From 7515d04d0fb68a0a80198c8a6d51de3d13a62b2b Mon Sep 17 00:00:00 2001 From: Matthieu Muffato Date: Thu, 28 May 2026 09:52:58 +0100 Subject: [PATCH 4/4] Grammar Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a94f01..6482311 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Enhancements & fixes - New `--window_size` parameter to select the size of the windows to compute statistics on. - It replaces `--window_size_info` parameter which was only affecting the naming of the - outputs. + It replaces the `--window_size_info` parameter, which only affected output naming. - Better validation of the `--selected_fw_output` parameter. ### Parameters