Skip to content

Commit

Permalink
mtmalign/align - clean tests and fix output (nf-core#6684)
Browse files Browse the repository at this point in the history
* clean

* Update modules/nf-core/mtmalign/align/main.nf

Co-authored-by: Nicolas Vannieuwkerke <[email protected]>

* update align

---------

Co-authored-by: Nicolas Vannieuwkerke <[email protected]>
  • Loading branch information
2 people authored and Helle Rus Povlsen committed Oct 2, 2024
1 parent 4c08524 commit 7aa5ee6
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 38 deletions.
10 changes: 4 additions & 6 deletions modules/nf-core/mtmalign/align/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,16 @@ process MTMALIGN_ALIGN {
mtm-align -i input_list.txt -o ${prefix}.pdb
# -o does not affect the fasta naming, so move it to the new name
mv ./mTM_result/result.fasta ./mTM_result/${prefix}.aln
mv ./mTM_result/result.fasta ${prefix}.aln
mv ./mTM_result/${prefix}.pdb ${prefix}.pdb
# Remove ".pdb" from the ids in the alignment file
sed -i 's/\\.pdb//g' ./mTM_result/${prefix}.aln
sed -i 's/\\.pdb//g' ${prefix}.aln
# compress both output files
if ${compress}; then
pigz -p ${task.cpus} ./mTM_result/${prefix}.aln ./mTM_result/${prefix}.pdb
pigz -p ${task.cpus} ${prefix}.aln ${prefix}.pdb
fi
# move everything in mTM_result to the working directory
mv ./mTM_result/* .
# mtm-align -v prints the wrong version 20180725, so extract it from the cosmetic output in the help message
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
60 changes: 36 additions & 24 deletions modules/nf-core/mtmalign/align/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@ nextflow_process {
tag "mtmalign/align"
tag "untar"

test("Test on seatoxin dataset - uncompressed") {
setup {
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("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))
"""
}
}
}

test("seatoxin - uncompressed") {

when {
params {
Expand Down Expand Up @@ -49,19 +50,7 @@ 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))
"""
}
}
}
test("seatoxin - compressed") {

when {
params {
Expand All @@ -87,4 +76,27 @@ nextflow_process {
)
}
}

test("seatoxin - uncompressed - stub") {

options '-stub'
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() }
)
}
}

}
53 changes: 45 additions & 8 deletions modules/nf-core/mtmalign/align/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"versions.yml:md5,7cbacec15bb9e0c8cbb27610bde74c10"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-03T11:01:13.729263689"
},
"versions1": {
Expand All @@ -17,10 +13,51 @@
"versions.yml:md5,7cbacec15bb9e0c8cbb27610bde74c10"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-03T11:01:37.28539854"
},
"seatoxin - uncompressed - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.aln:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
{
"id": "test"
},
"test.pdb:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
"versions.yml:md5,7cbacec15bb9e0c8cbb27610bde74c10"
],
"alignment": [
[
{
"id": "test"
},
"test.aln:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"structure": [
[
{
"id": "test"
},
"test.pdb:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,7cbacec15bb9e0c8cbb27610bde74c10"
]
}
],
"timestamp": "2024-09-23T16:51:04.027375"
}
}

0 comments on commit 7aa5ee6

Please sign in to comment.