Skip to content

Commit

Permalink
Foldmason (nf-core#6355)
Browse files Browse the repository at this point in the history
* Add foldmason

* Add test

* fix prettier

* fix prettier

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

Co-authored-by: Simon Pearce <[email protected]>

* Update modules/nf-core/foldmason/easymsa/main.nf

Co-authored-by: Simon Pearce <[email protected]>

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

Co-authored-by: Simon Pearce <[email protected]>

* Update main.nf

* Update main.nf.test

* Update meta.yml

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

Co-authored-by: Simon Pearce <[email protected]>

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

Co-authored-by: Simon Pearce <[email protected]>

* Add stub run tests

---------

Co-authored-by: Simon Pearce <[email protected]>
  • Loading branch information
luisas and SPPearce authored Aug 28, 2024
1 parent a35bf30 commit 5a38b71
Show file tree
Hide file tree
Showing 6 changed files with 385 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/nf-core/foldmason/easymsa/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
name: "foldmason_easymsa"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- bioconda::foldmason=1.763a428
- conda-forge::pigz=2.8
55 changes: 55 additions & 0 deletions modules/nf-core/foldmason/easymsa/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
process FOLDMASON_EASYMSA {
tag "$meta.id"
label 'process_medium'

conda "${moduleDir}/environment.yml"
container "community.wave.seqera.io/library/foldmason_pigz:97b3311addb0f4a7"

input:
tuple val(meta), path(pdbs)
val(compress)

output:
tuple val(meta), path("${prefix}_3di.fa${compress ? '.gz' : ''}"), emit: msa_3di
tuple val(meta), path("${prefix}_aa.fa${compress ? '.gz' : ''}"), emit: msa_aa
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}"
"""
foldmason easy-msa \\
$args \\
--threads $task.cpus \\
${pdbs} \\
${prefix} \\
tmp
if ${compress}; then
pigz -p ${task.cpus} ${prefix}.fa
fi
cat <<-END_VERSIONS > versions.yml
"${task.process}":
foldmason: \$(foldmason | grep "foldmason Version:" | cut -d":" -f 2 | awk '{\$1=\$1;print}')
pigz: \$(echo \$(pigz --version 2>&1) | sed 's/^.*pigz\\w*//' ))
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
"""
echo "" ${compress ? '| gzip' : ''} > ${prefix}_3di.fa${compress ? '.gz' : ''}
echo "" ${compress ? '| gzip' : ''} > ${prefix}_aa.fa${compress ? '.gz' : ''}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
foldmason: \$(foldmason | grep "foldmason Version:" | cut -d":" -f 2 | awk '{\$1=\$1;print}')
pigz: \$(echo \$(pigz --version 2>&1) | sed 's/^.*pigz\\w*//' ))
END_VERSIONS
"""
}
55 changes: 55 additions & 0 deletions modules/nf-core/foldmason/easymsa/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "foldmason_easymsa"
description: Aligns protein structures 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"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- pdbs:
type: file
description: Input protein structures in PDB format.
pattern: "*.{pdb,mmcif}"
- compress:
type: boolean
description: Flag representing whether the output MSA should be compressed. Set to true to enable/false to disable compression. Compression is done using pigz, and is multithreaded.

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- msa_3di:
type: file
description: Fasta file containing the multiple sequence alignment with 3Di alphabet
pattern: "*.{fa}"
- msa_aa:
type: file
description: Fasta file containing the multiple sequence alignment with Amino Acid alphabet
pattern: "*.{fa}"

authors:
- "@luisas"
maintainers:
- "@luisas"
114 changes: 114 additions & 0 deletions modules/nf-core/foldmason/easymsa/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
nextflow_process {

name "Test Process FOLDMASON_EASYMSA"
script "../main.nf"
process "FOLDMASON_EASYMSA"

tag "modules"
tag "modules_nfcore"
tag "foldmason"
tag "foldmason/easymsa"
tag "untar"

test("Test on seatoxin dataset - uncompressed") {
setup {

run("UNTAR") {
script "../../../../../modules/nf-core/untar/main.nf"
process {
"""
archive = file("https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/testdata/structures/seatoxin-ref.tar.gz", checkIfExists: true)
input[0] = Channel.of(tuple([id:'test'], archive))
"""
}
}
}

when {
params {
}
process {
"""
input[0] = UNTAR.out.untar.map { meta,dir -> [meta, file(dir).listFiles().collect()]}
input[1] = false
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("Test on seatoxin dataset - compressed") {
setup {

run("UNTAR") {
script "../../../../../modules/nf-core/untar/main.nf"
process {
"""
archive = file("https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/testdata/structures/seatoxin-ref.tar.gz", checkIfExists: true)
input[0] = Channel.of(tuple([id:'test'], archive))
"""
}
}
}

when {
params {
}
process {
"""
input[0] = UNTAR.out.untar.map { meta,dir -> [[ id:'test' ], file(dir).listFiles().collect()]}
input[1] = false
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("Stub run") {
options "-stub"

setup {

run("UNTAR") {
script "../../../../../modules/nf-core/untar/main.nf"
process {
"""
archive = file("https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/testdata/structures/seatoxin-ref.tar.gz", checkIfExists: true)
input[0] = Channel.of(tuple([id:'test'], archive))
"""
}
}
}

when {
params {
}
process {
"""
input[0] = UNTAR.out.untar.map { meta,dir -> [meta, file(dir).listFiles().collect()]}
input[1] = false
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

}
149 changes: 149 additions & 0 deletions modules/nf-core/foldmason/easymsa/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{
"Stub run": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test_3di.fa:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"1": [
[
{
"id": "test"
},
"test_aa.fa:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"2": [
"versions.yml:md5,da4694171d1b0bb9559f7049334126ed"
],
"msa_3di": [
[
{
"id": "test"
},
"test_3di.fa:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"msa_aa": [
[
{
"id": "test"
},
"test_aa.fa:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"versions": [
"versions.yml:md5,da4694171d1b0bb9559f7049334126ed"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-28T09:10:12.591561643"
},
"Test on seatoxin dataset - uncompressed": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test_3di.fa:md5,ba1b6c8c5df11bdebfea12070bd9cb17"
]
],
"1": [
[
{
"id": "test"
},
"test_aa.fa:md5,33e93479603115b46ef76af3f6a20cf1"
]
],
"2": [
"versions.yml:md5,da4694171d1b0bb9559f7049334126ed"
],
"msa_3di": [
[
{
"id": "test"
},
"test_3di.fa:md5,ba1b6c8c5df11bdebfea12070bd9cb17"
]
],
"msa_aa": [
[
{
"id": "test"
},
"test_aa.fa:md5,33e93479603115b46ef76af3f6a20cf1"
]
],
"versions": [
"versions.yml:md5,da4694171d1b0bb9559f7049334126ed"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-28T08:58:09.52040475"
},
"Test on seatoxin dataset - compressed": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test_3di.fa:md5,ba1b6c8c5df11bdebfea12070bd9cb17"
]
],
"1": [
[
{
"id": "test"
},
"test_aa.fa:md5,33e93479603115b46ef76af3f6a20cf1"
]
],
"2": [
"versions.yml:md5,da4694171d1b0bb9559f7049334126ed"
],
"msa_3di": [
[
{
"id": "test"
},
"test_3di.fa:md5,ba1b6c8c5df11bdebfea12070bd9cb17"
]
],
"msa_aa": [
[
{
"id": "test"
},
"test_aa.fa:md5,33e93479603115b46ef76af3f6a20cf1"
]
],
"versions": [
"versions.yml:md5,da4694171d1b0bb9559f7049334126ed"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-28T08:58:21.721568566"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/foldmason/easymsa/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
foldmason/easymsa:
- "modules/nf-core/foldmason/easymsa/**"

0 comments on commit 5a38b71

Please sign in to comment.