From d3555a4a33ae94269b65f79f7066ac2fcb836005 Mon Sep 17 00:00:00 2001 From: Luisa Santus Date: Tue, 10 Dec 2024 12:09:54 +0100 Subject: [PATCH] Add foldmason msa2lddtreport (#7191) * add module * add test * update test * up * add * update * fix test * Update modules/nf-core/foldmason/msa2lddtreport/main.nf Co-authored-by: Jose Espinosa-Carrasco * Update modules/nf-core/foldmason/msa2lddtreport/tests/main.nf.test Co-authored-by: Jose Espinosa-Carrasco --------- Co-authored-by: Jose Espinosa-Carrasco --- .../foldmason/msa2lddtreport/environment.yml | 5 + .../nf-core/foldmason/msa2lddtreport/main.nf | 52 +++++++++ .../nf-core/foldmason/msa2lddtreport/meta.yml | 74 +++++++++++++ .../msa2lddtreport/tests/main.nf.test | 101 ++++++++++++++++++ .../msa2lddtreport/tests/main.nf.test.snap | 68 ++++++++++++ 5 files changed, 300 insertions(+) create mode 100644 modules/nf-core/foldmason/msa2lddtreport/environment.yml create mode 100644 modules/nf-core/foldmason/msa2lddtreport/main.nf create mode 100644 modules/nf-core/foldmason/msa2lddtreport/meta.yml create mode 100644 modules/nf-core/foldmason/msa2lddtreport/tests/main.nf.test create mode 100644 modules/nf-core/foldmason/msa2lddtreport/tests/main.nf.test.snap diff --git a/modules/nf-core/foldmason/msa2lddtreport/environment.yml b/modules/nf-core/foldmason/msa2lddtreport/environment.yml new file mode 100644 index 00000000000..80d4dd371d9 --- /dev/null +++ b/modules/nf-core/foldmason/msa2lddtreport/environment.yml @@ -0,0 +1,5 @@ +channels: + - conda-forge + - bioconda +dependencies: + - bioconda::foldmason=2.7bd21ed diff --git a/modules/nf-core/foldmason/msa2lddtreport/main.nf b/modules/nf-core/foldmason/msa2lddtreport/main.nf new file mode 100644 index 00000000000..e07a7552b73 --- /dev/null +++ b/modules/nf-core/foldmason/msa2lddtreport/main.nf @@ -0,0 +1,52 @@ +process FOLDMASON_MSA2LDDTREPORT { + tag "$meta.id" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/a8/a88d162c3f39a1518d48c3faec235e6fcde750586da868b62fc5f0a08a89aa9d/data' : + 'community.wave.seqera.io/library/foldmason:2.7bd21ed--e7f739473ad6578d' }" + input: + tuple val(meta) , path(msa) + tuple val(meta2), path(db) + tuple val(meta3), path(pdbs) + tuple val(meta4), path(tree) + + output: + tuple val(meta), path("${prefix}.html"), emit: html + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + def options_tree = tree ? "--guide-tree $tree" : "" + """ + foldmason msa2lddtreport \\ + ${meta.id} \\ + ${msa} \\ + ${prefix}.html \\ + $args \\ + ${options_tree} \\ + --threads $task.cpus + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + foldmason: \$(foldmason | grep "foldmason Version:" | cut -d":" -f 2 | awk '{\$1=\$1;print}') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.html + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + foldmason: \$(foldmason | grep "foldmason Version:" | cut -d":" -f 2 | awk '{\$1=\$1;print}') + END_VERSIONS + """ +} diff --git a/modules/nf-core/foldmason/msa2lddtreport/meta.yml b/modules/nf-core/foldmason/msa2lddtreport/meta.yml new file mode 100644 index 00000000000..cf9749acb07 --- /dev/null +++ b/modules/nf-core/foldmason/msa2lddtreport/meta.yml @@ -0,0 +1,74 @@ +name: "foldmason_msa2lddtreport" +description: Renders a visualization report using foldmason +keywords: + - alignment + - MSA + - genomics + - structure +tools: + - "foldmason": + description: "Multiple Protein Structure Alignment at Scale with FoldMason" + homepage: "https://github.com/steineggerlab/foldmason" + documentation: "https://github.com/steineggerlab/foldmason" + tool_dev_url: "https://github.com/steineggerlab/foldmason" + doi: "10.1101/2024.08.01.606130" + licence: ["GPL v3"] + identifier: biotools:foldmason + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - msa: + type: file + description: Input alignment file. + pattern: "*.{fa,fasta,aln}" + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - db: + type: file + description: Input foldmason database. + pattern: "*" + - - meta3: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - pdbs: + type: file + description: Protein structures used for the visualization. + pattern: "*.{pdb}" + - - meta4: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - tree: + type: file + description: Guide tree used for the visualization . + pattern: "*.{nwk,dnd}" +output: + - html: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "${prefix}.html": + type: file + description: HTML file with the foldmason visualization + pattern: "*.{html}" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@luisas" +maintainers: + - "@luisas" diff --git a/modules/nf-core/foldmason/msa2lddtreport/tests/main.nf.test b/modules/nf-core/foldmason/msa2lddtreport/tests/main.nf.test new file mode 100644 index 00000000000..b92c05d0704 --- /dev/null +++ b/modules/nf-core/foldmason/msa2lddtreport/tests/main.nf.test @@ -0,0 +1,101 @@ +nextflow_process { + + name "Test Process FOLDMASON_MSA2LDDTREPORT" + script "../main.nf" + process "FOLDMASON_MSA2LDDTREPORT" + + tag "modules" + tag "modules_nfcore" + tag "foldmason" + tag "foldmason/msa2lddtreport" + tag "foldmason/createdb" + tag "untar" + tag "famsa/guidetree" + + + setup{ + run("UNTAR") { + script "../../../../../modules/nf-core/untar/main.nf" + process { + """ + archive = file("https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/testdata/af2_structures/seatoxin-ref.tar.gz", checkIfExists: true) + input[0] = Channel.of(tuple([id:'test'], archive)) + """ + } + } + + run("FAMSA_GUIDETREE") { + script "../../../../../modules/nf-core/famsa/guidetree/main.nf" + process { + """ + input[0] = [ [ id:'test_tree' ], // meta map + file(params.modules_testdata_base_path + "../../multiplesequencealign/testdata/setoxin-ref.fa", checkIfExists: true) + ] + """ + } + } + + run("FOLDMASON_CREATEDB") { + script "../../../../../modules/nf-core/foldmason/createdb/main.nf" + process { + """ + input[0] = UNTAR.out.untar.map { meta,dir -> [meta, file(dir).listFiles().collect()]} + """ + } + } + + + } + + test("seatoxin") { + + + when { + process { + """ + input[0] =[ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + "../../multiplesequencealign/testdata/setoxin.ref", checkIfExists: true) + ] + input[1] = FOLDMASON_CREATEDB.out.db.collect{ meta, db -> db }.map{ db -> [[ id: 'test'], db]} + input[2] = UNTAR.out.untar.map { meta,dir -> [meta, file(dir).listFiles().collect()]} + input[3] = FAMSA_GUIDETREE.out.tree.collect{ meta, tree -> tree }.map{ tree -> [[ id: 'test_tree'], tree]} + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("seatixin - stub") { + + options "-stub" + + when { + process { + """ + input[0] =[ [ id:'test_tree' ], // meta map + file(params.modules_testdata_base_path + "../../multiplesequencealign/testdata/setoxin.ref", checkIfExists: true) + ] + input[1] = FOLDMASON_CREATEDB.out.db.collect{ meta, db -> db }.map{ db -> [[ id: 'test'], db]} + input[2] = UNTAR.out.untar.map { meta,dir -> [meta, file(dir).listFiles().collect()]} + input[3] = FAMSA_GUIDETREE.out.tree.collect{ meta, tree -> tree }.map{ tree -> [[ id: 'test_tree'], tree]} + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/foldmason/msa2lddtreport/tests/main.nf.test.snap b/modules/nf-core/foldmason/msa2lddtreport/tests/main.nf.test.snap new file mode 100644 index 00000000000..da11cfad2df --- /dev/null +++ b/modules/nf-core/foldmason/msa2lddtreport/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "seatixin - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test_tree" + }, + "test_tree.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,ed922d0faa7a3e3c8171a05296939468" + ], + "html": [ + [ + { + "id": "test_tree" + }, + "test_tree.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,ed922d0faa7a3e3c8171a05296939468" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-10T09:36:23.360594258" + }, + "seatoxin": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.html:md5,7a90a8e674dc45ce4181498b8f53b519" + ] + ], + "1": [ + "versions.yml:md5,ed922d0faa7a3e3c8171a05296939468" + ], + "html": [ + [ + { + "id": "test" + }, + "test.html:md5,7a90a8e674dc45ce4181498b8f53b519" + ] + ], + "versions": [ + "versions.yml:md5,ed922d0faa7a3e3c8171a05296939468" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.2" + }, + "timestamp": "2024-12-10T09:54:03.711567262" + } +} \ No newline at end of file