From b6ad970de11c8601176bb51c903fc5679d04238c Mon Sep 17 00:00:00 2001 From: Fernando Duarte <123090819+FernandoDuarteF@users.noreply.github.com> Date: Tue, 3 Feb 2026 15:55:46 +0000 Subject: [PATCH 1/2] Added subworkflow --- modules.json | 37 +++++++++--- subworkflows/local/preprocessing/main.nf | 58 +++++++++++++++++++ subworkflows/local/preprocessing/meta.yml | 51 ++++++++++++++++ .../local/preprocessing/tests/main.nf.test | 46 +++++++++++++++ workflows/fsb.nf | 15 ++--- 5 files changed, 192 insertions(+), 15 deletions(-) create mode 100644 subworkflows/local/preprocessing/main.nf create mode 100644 subworkflows/local/preprocessing/meta.yml create mode 100644 subworkflows/local/preprocessing/tests/main.nf.test diff --git a/modules.json b/modules.json index 0be94e8..2889c09 100644 --- a/modules.json +++ b/modules.json @@ -5,25 +5,40 @@ "https://github.com/nf-core/modules.git": { "modules": { "nf-core": { + "blast/blastp": { + "branch": "master", + "git_sha": "6330227ba2a71d39f35b0ef60e381f456489c6ee", + "installed_by": [ + "modules" + ] + }, "falco": { "branch": "master", "git_sha": "41dfa3f7c0ffabb96a6a813fe321c6d1cc5b6e46", - "installed_by": ["modules"] + "installed_by": [ + "modules" + ] }, "fastp": { "branch": "master", "git_sha": "d9ec4ef289ad39b8a662a7a12be50409b11df84b", - "installed_by": ["modules"] + "installed_by": [ + "modules" + ] }, "fastqc": { "branch": "master", "git_sha": "41dfa3f7c0ffabb96a6a813fe321c6d1cc5b6e46", - "installed_by": ["modules"] + "installed_by": [ + "modules" + ] }, "multiqc": { "branch": "master", "git_sha": "af27af1be706e6a2bb8fe454175b0cdf77f47b49", - "installed_by": ["modules"] + "installed_by": [ + "modules" + ] } } }, @@ -32,20 +47,26 @@ "utils_nextflow_pipeline": { "branch": "master", "git_sha": "05954dab2ff481bcb999f24455da29a5828af08d", - "installed_by": ["subworkflows"] + "installed_by": [ + "subworkflows" + ] }, "utils_nfcore_pipeline": { "branch": "master", "git_sha": "271e7fc14eb1320364416d996fb077421f3faed2", - "installed_by": ["subworkflows"] + "installed_by": [ + "subworkflows" + ] }, "utils_nfschema_plugin": { "branch": "master", "git_sha": "4b406a74dc0449c0401ed87d5bfff4252fd277fd", - "installed_by": ["subworkflows"] + "installed_by": [ + "subworkflows" + ] } } } } } -} +} \ No newline at end of file diff --git a/subworkflows/local/preprocessing/main.nf b/subworkflows/local/preprocessing/main.nf new file mode 100644 index 0000000..4b0a1ee --- /dev/null +++ b/subworkflows/local/preprocessing/main.nf @@ -0,0 +1,58 @@ +// TODO nf-core: If in doubt look at other nf-core/subworkflows to see how we are doing things! :) +// https://github.com/nf-core/modules/tree/master/subworkflows +// You can also ask for help via your pull request or on the #subworkflows channel on the nf-core Slack workspace: +// https://nf-co.re/join +// TODO nf-core: A subworkflow SHOULD import at least two modules + +include { FASTQC } from '../../../modules/nf-core/fastqc/main' +include { FALCO } from '../../../modules/nf-core/falco/main' +include { FASTP } from '../../../modules/nf-core/fastp/main' + +workflow PREPROCESSING { + + take: + // TODO nf-core: edit input (take) channels + ch_samplesheet // channel: [ val(meta), [ bam ] ] + + main: + // TODO nf-core: substitute modules here for the modules of your subworkflow + ch_versions = channel.empty() + + // + // MODULE: Run FASTP + // + ch_fastp = ch_samplesheet.map { meta, reads -> tuple(meta, reads, []) } + + FASTP ( + ch_fastp, + [], + [], + [] + ) + ch_versions = ch_versions.mix{ FASTP.out.verions } + + // + // MODULE: Run FALCO + // + FALCO ( + FASTP.out.reads + ) + ch_versions = ch_versions.mix{ FALCO.out.verions } + + // + // MODULE: Run FastQC + // + + FASTQC ( + ch_samplesheet + ) + ch_versions = ch_versions.mix{ FASTQC.out.verions } + + emit: + // TODO nf-core: edit emitted channels + fastqc = FASTQC.out.zip + versions = ch_versions + //bam = SAMTOOLS_SORT.out.bam // channel: [ val(meta), [ bam ] ] + //bai = SAMTOOLS_INDEX.out.bai // channel: [ val(meta), [ bai ] ] + //csi = SAMTOOLS_INDEX.out.csi // channel: [ val(meta), [ csi ] ] +} \ No newline at end of file diff --git a/subworkflows/local/preprocessing/meta.yml b/subworkflows/local/preprocessing/meta.yml new file mode 100644 index 0000000..6d1c412 --- /dev/null +++ b/subworkflows/local/preprocessing/meta.yml @@ -0,0 +1,51 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: "preprecessing" +## TODO nf-core: Add a description of the subworkflow and list keywords +description: Sort SAM/BAM/CRAM file +keywords: + - sort + - bam + - sam + - cram +## TODO nf-core: Add a list of the modules and/or subworkflows used in the subworkflow +components: + - samtools/sort + - samtools/index +## TODO nf-core: List all of the channels used as input with a description and their structure +input: + - ch_bam: + type: file + description: | + The input channel containing the BAM/CRAM/SAM files + Structure: [ val(meta), path(bam) ] + pattern: "*.{bam/cram/sam}" +## TODO nf-core: List all of the channels used as output with a descriptions and their structure +output: + - bam: + type: file + description: | + Channel containing BAM files + Structure: [ val(meta), path(bam) ] + pattern: "*.bam" + - bai: + type: file + description: | + Channel containing indexed BAM (BAI) files + Structure: [ val(meta), path(bai) ] + pattern: "*.bai" + - csi: + type: file + description: | + Channel containing CSI files + Structure: [ val(meta), path(csi) ] + pattern: "*.csi" + - versions: + type: file + description: | + File containing software versions + Structure: [ path(versions.yml) ] + pattern: "versions.yml" +authors: + - "@FernandoDuarteF" +maintainers: + - "@FernandoDuarteF" diff --git a/subworkflows/local/preprocessing/tests/main.nf.test b/subworkflows/local/preprocessing/tests/main.nf.test new file mode 100644 index 0000000..14b0c21 --- /dev/null +++ b/subworkflows/local/preprocessing/tests/main.nf.test @@ -0,0 +1,46 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core subworkflows test preprecessing +nextflow_workflow { + + name "Test Subworkflow PREPRECESSING" + script "../main.nf" + workflow "PREPRECESSING" + + tag "subworkflows" + tag "subworkflows_" + tag "subworkflows/preprecessing" + // TODO nf-core: Add tags for all modules used within this subworkflow. Example: + tag "samtools" + tag "samtools/sort" + tag "samtools/index" + + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used + test("sarscov2 - bam - single_end") { + + when { + workflow { + """ + // TODO nf-core: define inputs of the workflow here. Example: + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + ] + input[1] = [ + [ id:'genome' ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + ] + """ + } + } + then { + assert workflow.success + assertAll( + { assert snapshot( + workflow.out + //TODO nf-core: Add all required assertions to verify the test output. + ).match() } + ) + } + } +} diff --git a/workflows/fsb.nf b/workflows/fsb.nf index 8aa9237..8eef8be 100644 --- a/workflows/fsb.nf +++ b/workflows/fsb.nf @@ -3,7 +3,8 @@ IMPORT MODULES / SUBWORKFLOWS / FUNCTIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -include { FASTQC } from '../modules/nf-core/fastqc/main' + +include { PREPROCESSING } from '../subworkflows/local/preprocessing' include { MULTIQC } from '../modules/nf-core/multiqc/main' include { paramsSummaryMap } from 'plugin/nf-schema' include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline' @@ -24,14 +25,14 @@ workflow FSB { ch_versions = channel.empty() ch_multiqc_files = channel.empty() - // - // MODULE: Run FastQC - // - FASTQC ( + + PREPROCESSING ( ch_samplesheet ) - ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]}) - ch_versions = ch_versions.mix(FASTQC.out.versions.first()) + ch_versions = ch_versions.mix(PREPROCESSING.out.versions) + + // ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]}) + // ch_versions = ch_versions.mix(FASTQC.out.versions.first()) // // Collate and save software versions From cb78965338823271d9553579fd2fb69b7f9d9e34 Mon Sep 17 00:00:00 2001 From: Fernando Duarte <123090819+FernandoDuarteF@users.noreply.github.com> Date: Tue, 3 Feb 2026 16:17:52 +0000 Subject: [PATCH 2/2] Added preprocessing subworkflow --- subworkflows/local/preprocessing/main.nf | 6 +++--- workflows/fsb.nf | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/subworkflows/local/preprocessing/main.nf b/subworkflows/local/preprocessing/main.nf index 4b0a1ee..0c0e6dc 100644 --- a/subworkflows/local/preprocessing/main.nf +++ b/subworkflows/local/preprocessing/main.nf @@ -29,7 +29,7 @@ workflow PREPROCESSING { [], [] ) - ch_versions = ch_versions.mix{ FASTP.out.verions } + ch_versions = ch_versions.mix( FASTP.out.versions ) // // MODULE: Run FALCO @@ -37,7 +37,7 @@ workflow PREPROCESSING { FALCO ( FASTP.out.reads ) - ch_versions = ch_versions.mix{ FALCO.out.verions } + ch_versions = ch_versions.mix( FALCO.out.versions ) // // MODULE: Run FastQC @@ -46,7 +46,7 @@ workflow PREPROCESSING { FASTQC ( ch_samplesheet ) - ch_versions = ch_versions.mix{ FASTQC.out.verions } + ch_versions = ch_versions.mix( FASTQC.out.versions ) emit: // TODO nf-core: edit emitted channels diff --git a/workflows/fsb.nf b/workflows/fsb.nf index 8eef8be..bb9fd1e 100644 --- a/workflows/fsb.nf +++ b/workflows/fsb.nf @@ -29,7 +29,7 @@ workflow FSB { PREPROCESSING ( ch_samplesheet ) - ch_versions = ch_versions.mix(PREPROCESSING.out.versions) + ch_versions = ch_versions.mix( PREPROCESSING.out.versions ) // ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]}) // ch_versions = ch_versions.mix(FASTQC.out.versions.first())