Skip to content

Commit

Permalink
Add foldmason msa2lddtreport (#7191)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Update modules/nf-core/foldmason/msa2lddtreport/tests/main.nf.test

Co-authored-by: Jose Espinosa-Carrasco <[email protected]>

---------

Co-authored-by: Jose Espinosa-Carrasco <[email protected]>
  • Loading branch information
luisas and JoseEspinosa authored Dec 10, 2024
1 parent 13e7d10 commit d3555a4
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/nf-core/foldmason/msa2lddtreport/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::foldmason=2.7bd21ed
52 changes: 52 additions & 0 deletions modules/nf-core/foldmason/msa2lddtreport/main.nf
Original file line number Diff line number Diff line change
@@ -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
"""
}
74 changes: 74 additions & 0 deletions modules/nf-core/foldmason/msa2lddtreport/meta.yml
Original file line number Diff line number Diff line change
@@ -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"
101 changes: 101 additions & 0 deletions modules/nf-core/foldmason/msa2lddtreport/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -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() }
)
}

}

}
68 changes: 68 additions & 0 deletions modules/nf-core/foldmason/msa2lddtreport/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit d3555a4

Please sign in to comment.