From b7689e6b3c9003b58f7853bae896a727a5e7d44e Mon Sep 17 00:00:00 2001 From: alessiovignoli <45239231+alessiovignoli@users.noreply.github.com> Date: Tue, 19 Mar 2024 15:35:03 +0100 Subject: [PATCH] addedd optional output channel for lib files (#5257) * addedd optional output channel for lib files * added the output description for lin in meta.yml --- modules/nf-core/tcoffee/align/main.nf | 2 ++ modules/nf-core/tcoffee/align/meta.yml | 6 ++++ .../nf-core/tcoffee/align/tests/lib.config | 3 ++ .../nf-core/tcoffee/align/tests/main.nf.test | 27 +++++++++++++++++ .../tcoffee/align/tests/main.nf.test.snap | 29 +++++++++++++++++++ 5 files changed, 67 insertions(+) create mode 100644 modules/nf-core/tcoffee/align/tests/lib.config diff --git a/modules/nf-core/tcoffee/align/main.nf b/modules/nf-core/tcoffee/align/main.nf index 671aca8eacc9..e159bb801e23 100644 --- a/modules/nf-core/tcoffee/align/main.nf +++ b/modules/nf-core/tcoffee/align/main.nf @@ -15,6 +15,8 @@ process TCOFFEE_ALIGN { output: tuple val(meta), path("*.aln{.gz,}"), emit: alignment + // in the args there might be the request to generate a lib file, so the following is an optional output + tuple val(meta), path("*.*lib") , emit: lib, optional : true path "versions.yml" , emit: versions when: diff --git a/modules/nf-core/tcoffee/align/meta.yml b/modules/nf-core/tcoffee/align/meta.yml index 6cfcc72d46aa..4125d1ed2c24 100644 --- a/modules/nf-core/tcoffee/align/meta.yml +++ b/modules/nf-core/tcoffee/align/meta.yml @@ -61,6 +61,10 @@ output: type: file description: Alignment file in FASTA format. May be gzipped. pattern: "*.aln{.gz,}" + - lib: + type: file + description: optional output, the library generated from the MSA file. + pattern: "*.*lib" - versions: type: file description: File containing software versions @@ -68,7 +72,9 @@ output: authors: - "@luisas" - "@JoseEspinosa" + - "@alessiovignoli" maintainers: - "@luisas" - "@JoseEspinosa" - "@lrauschning" + - "@alessiovignoli" diff --git a/modules/nf-core/tcoffee/align/tests/lib.config b/modules/nf-core/tcoffee/align/tests/lib.config new file mode 100644 index 000000000000..2fc113efa0e2 --- /dev/null +++ b/modules/nf-core/tcoffee/align/tests/lib.config @@ -0,0 +1,3 @@ +process { + ext.args = { "-output fasta_aln -out_lib=sample_lib1.tc_lib" } +} \ No newline at end of file diff --git a/modules/nf-core/tcoffee/align/tests/main.nf.test b/modules/nf-core/tcoffee/align/tests/main.nf.test index 9d66f86bf393..307534fb55cb 100644 --- a/modules/nf-core/tcoffee/align/tests/main.nf.test +++ b/modules/nf-core/tcoffee/align/tests/main.nf.test @@ -147,4 +147,31 @@ nextflow_process { } } + + test("fasta - align_with_lib") { + + config "./lib.config" + + when { + process { + """ + input[0] = [ [ id:'test' ], + file("https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/testdata/setoxin-ref.fa", checkIfExists: true) + ] + input[1] = [[:],[]] + input[2] = [[:],[],[]] + input[3] = true + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.alignment).match("alignment - lib") }, + { assert path(process.out.lib.get(0).get(1)).getText().contains("1ahl") }, + { assert snapshot(process.out.versions).match("versions_lib") } + ) + } + } } \ No newline at end of file diff --git a/modules/nf-core/tcoffee/align/tests/main.nf.test.snap b/modules/nf-core/tcoffee/align/tests/main.nf.test.snap index 9bdadbd4e429..dfef40a73527 100644 --- a/modules/nf-core/tcoffee/align/tests/main.nf.test.snap +++ b/modules/nf-core/tcoffee/align/tests/main.nf.test.snap @@ -11,6 +11,18 @@ }, "timestamp": "2024-02-28T19:00:28.712838" }, + "versions_lib": { + "content": [ + [ + "versions.yml:md5,fb187c9186b50a8076d08cd3be3c1b70" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T14:04:06.031557" + }, "alignment - uncompressed": { "content": [ [ @@ -52,6 +64,23 @@ }, "timestamp": "2024-02-28T19:00:10.618213" }, + "alignment - lib": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.aln.gz:md5,bd1db08ad04514cc6d1334598c1a6ef0" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T13:57:39.653762" + }, "alignment": { "content": [ [