diff --git a/subworkflows/local/functional_annotation/meta.yml b/subworkflows/local/functional_annotation/meta.yml new file mode 100644 index 0000000..5b682ee --- /dev/null +++ b/subworkflows/local/functional_annotation/meta.yml @@ -0,0 +1,47 @@ +name: functional_annotation +description: Performs functional annotation of protien sequences +keywords: + - annotation + - functional + - interproscan + - proteins + - fasta + +components: + - aria2 + - untar + - interproscan + +input: + - ch_fasta: + type: file + description: Channel containing FASTA files to be annotated. + pattern: "*.{fa,fasta,faa}" + - skip_interproscan: + type: boolean + description: Flag to skip the InterProScan annotation step entirely. + - interproscan_db_url: + type: string + description: URL to download the InterProScan database archive. + - interproscan_db: + type: string + description: Path to a pre-existing local InterProScan database directory. + If provided, skips the download and extraction steps. + +output: + - interproscan_tsv: + type: file + description: TSV file containing InterProScan functional annotation results. + Structure: [ val(meta), path(tsv) ] + pattern: "*.tsv" + - versions: + type: file + description: File containing software versions for all tools used in the workflow. + Structure: [ path(versions.yml) ] + pattern: "versions.yml" + +authors: + - "@vagkaratzas" + - "@Muskan-2464 +maintainers: + - "@vagkaratzas" diff --git a/subworkflows/local/functional_annotation/tests/main.nf.test b/subworkflows/local/functional_annotation/tests/main.nf.test new file mode 100644 index 0000000..c9e1aef --- /dev/null +++ b/subworkflows/local/functional_annotation/tests/main.nf.test @@ -0,0 +1,99 @@ +nextflow_workflow { + + name "Test Workflow FUNCTIONAL_ANNOTATION" + script "../main.nf" + workflow "FUNCTIONAL_ANNOTATION" + tag "subworkflows" + tag "subworkflows_local" + tag "functional_annotation" + + // ------------------------------------------------------- + // TEST 1: Skip InterProScan (safest for CI, no DB needed) + // ------------------------------------------------------- + test("fasta - skip_interproscan true") { + + when { + workflow { + """ + input[0] = Channel.of([ + [ id:'test_sample' ], + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/genome/genome.fna.gz', + checkIfExists: true) + ]) + input[1] = true // skip_interproscan + input[2] = [] // no url + input[3] = [] // no local db + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert workflow.out.interproscan_tsv == [] }, + { assert snapshot(workflow.out.versions).match("versions_skip") } + ) + } + } + + // ------------------------------------------------------- + // TEST 2: Stub run with skip=false (no real DB download) + // ------------------------------------------------------- + test("stub run - skip interproscan") { + + options "-stub" + + when { + workflow { + """ + input[0] = Channel.of([ + [ id:'test_sample' ], + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/genome/genome.fna.gz', + checkIfExists: true) + ]) + input[1] = true + input[2] = [] + input[3] = [] + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot(workflow.out).match("stub") } + ) + } + } + + // ------------------------------------------------------- + // TEST 3: Stub run - skip interproscan + // ------------------------------------------------------- + test("fasta - skip_interproscan true - stub") { + + options "-stub" + + when { + workflow { + """ + input[0] = Channel.of([ + [ id:'test_sample' ], + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/genome/genome.fna.gz', + checkIfExists: true) + ]) + input[1] = true + input[2] = [] + input[3] = [] + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert workflow.out.interproscan_tsv == [] }, + { assert workflow.out.versions == [] } + ) + } + } +} diff --git a/subworkflows/local/functional_annotation/tests/main.nf.test.snap b/subworkflows/local/functional_annotation/tests/main.nf.test.snap new file mode 100644 index 0000000..f4444ca --- /dev/null +++ b/subworkflows/local/functional_annotation/tests/main.nf.test.snap @@ -0,0 +1,37 @@ +{ + "versions_skip": { + "content": [ + [ + + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.4" + }, + "timestamp": "2026-03-13T17:28:57.029553387" + }, + "stub": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "interproscan_tsv": [ + + ], + "versions": [ + + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.4" + }, + "timestamp": "2026-03-13T17:29:04.51251929" + } +} \ No newline at end of file