Skip to content

Commit

Permalink
Add input gt foldmason (#7155)
Browse files Browse the repository at this point in the history
* add gt input

* add

* update tests

* update
  • Loading branch information
luisas authored Dec 4, 2024
1 parent 58e95bf commit 8541ec4
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 53 deletions.
13 changes: 8 additions & 5 deletions modules/nf-core/foldmason/easymsa/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ process FOLDMASON_EASYMSA {
label 'process_medium'

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

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

output:
Expand All @@ -20,13 +21,15 @@ process FOLDMASON_EASYMSA {
script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
def options_tree = tree ? "--guide-tree $tree" : ""
"""
foldmason easy-msa \\
$args \\
--threads $task.cpus \\
${pdbs} \\
${prefix} \\
tmp
tmp \\
${options_tree} \\
$args \\
--threads $task.cpus
if ${compress}; then
pigz -p ${task.cpus} ${prefix}_3di.fa
Expand Down
9 changes: 9 additions & 0 deletions modules/nf-core/foldmason/easymsa/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ input:
type: file
description: Input protein structures in PDB format.
pattern: "*.{pdb,mmcif}"
- - meta2:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- tree:
type: file
description: Input guide tree in Newick format.
pattern: "*.{dnd,nwk}"
- - compress:
type: boolean
description: Flag representing whether the output MSA should be compressed.
Expand Down
89 changes: 52 additions & 37 deletions modules/nf-core/foldmason/easymsa/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,44 @@ nextflow_process {
tag "foldmason"
tag "foldmason/easymsa"
tag "untar"
tag "famsa"
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))
"""
}
}

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))
"""
}
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)
]
"""
}
}
}


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

when {
params {
}
process {
"""
input[0] = UNTAR.out.untar.map { meta,dir -> [meta, file(dir).listFiles().collect()]}
input[1] = false
input[1] = [[:],[]]
input[2] = false
"""
}
}
Expand All @@ -44,26 +60,37 @@ nextflow_process {
}

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] = [[:],[]]
input[2] = true
"""
}
}

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

test("Test on seatoxin dataset - guide_tree") {

when {
params {
}
process {
"""
input[0] = UNTAR.out.untar.map { meta,dir -> [[ id:'test' ], file(dir).listFiles().collect()]}
input[1] = true
input[1] = FAMSA_GUIDETREE.out.tree.collect{ meta, tree -> tree }.map{ tree -> [[ id: 'test_tree'], tree]}
input[2] = false
"""
}
}
Expand All @@ -79,26 +106,14 @@ nextflow_process {
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
input[1] = [[:],[]]
input[2] = false
"""
}
}
Expand Down
83 changes: 72 additions & 11 deletions modules/nf-core/foldmason/easymsa/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@
]
}
],
"timestamp": "2024-08-28T09:10:12.591561643"
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-04T10:56:12.836231763"
},
"Test on seatoxin dataset - uncompressed": {
"content": [
Expand All @@ -52,15 +56,15 @@
{
"id": "test"
},
"test_3di.fa:md5,ba1b6c8c5df11bdebfea12070bd9cb17"
"test_3di.fa:md5,e7da437c6ddb5ced60ff7c49b147a65d"
]
],
"1": [
[
{
"id": "test"
},
"test_aa.fa:md5,33e93479603115b46ef76af3f6a20cf1"
"test_aa.fa:md5,2d90cd080424db8024e6c404c1cfc0b4"
]
],
"2": [
Expand All @@ -71,23 +75,27 @@
{
"id": "test"
},
"test_3di.fa:md5,ba1b6c8c5df11bdebfea12070bd9cb17"
"test_3di.fa:md5,e7da437c6ddb5ced60ff7c49b147a65d"
]
],
"msa_aa": [
[
{
"id": "test"
},
"test_aa.fa:md5,33e93479603115b46ef76af3f6a20cf1"
"test_aa.fa:md5,2d90cd080424db8024e6c404c1cfc0b4"
]
],
"versions": [
"versions.yml:md5,da4694171d1b0bb9559f7049334126ed"
]
}
],
"timestamp": "2024-08-28T08:58:09.52040475"
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-04T10:55:41.89060384"
},
"Test on seatoxin dataset - compressed": {
"content": [
Expand All @@ -97,15 +105,15 @@
{
"id": "test"
},
"test_3di.fa.gz:md5,ba1b6c8c5df11bdebfea12070bd9cb17"
"test_3di.fa.gz:md5,e7da437c6ddb5ced60ff7c49b147a65d"
]
],
"1": [
[
{
"id": "test"
},
"test_aa.fa.gz:md5,33e93479603115b46ef76af3f6a20cf1"
"test_aa.fa.gz:md5,2d90cd080424db8024e6c404c1cfc0b4"
]
],
"2": [
Expand All @@ -116,22 +124,75 @@
{
"id": "test"
},
"test_3di.fa.gz:md5,ba1b6c8c5df11bdebfea12070bd9cb17"
"test_3di.fa.gz:md5,e7da437c6ddb5ced60ff7c49b147a65d"
]
],
"msa_aa": [
[
{
"id": "test"
},
"test_aa.fa.gz:md5,33e93479603115b46ef76af3f6a20cf1"
"test_aa.fa.gz:md5,2d90cd080424db8024e6c404c1cfc0b4"
]
],
"versions": [
"versions.yml:md5,da4694171d1b0bb9559f7049334126ed"
]
}
],
"timestamp": "2024-08-29T13:44:02.750191"
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-04T10:55:52.135344443"
},
"Test on seatoxin dataset - guide_tree": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test_3di.fa:md5,46fa911158bb736c054dfad0378832b4"
]
],
"1": [
[
{
"id": "test"
},
"test_aa.fa:md5,7ada48f0152342787a46505b9e8a2fae"
]
],
"2": [
"versions.yml:md5,da4694171d1b0bb9559f7049334126ed"
],
"msa_3di": [
[
{
"id": "test"
},
"test_3di.fa:md5,46fa911158bb736c054dfad0378832b4"
]
],
"msa_aa": [
[
{
"id": "test"
},
"test_aa.fa:md5,7ada48f0152342787a46505b9e8a2fae"
]
],
"versions": [
"versions.yml:md5,da4694171d1b0bb9559f7049334126ed"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-04T10:56:02.473496089"
}
}

0 comments on commit 8541ec4

Please sign in to comment.