Skip to content

Commit

Permalink
nf-test: Migrate phispy tests to nf-test (nf-core#5292)
Browse files Browse the repository at this point in the history
* nf-test: Migrate phispy tests

* chore: Remove pytest test for phispy

* style: Change name to lowercase and fix license

* refactor: Change to test data base path

Signed-off-by: jvfe <jvfecav@gmail.com>

* refactor: Use with instead of variables

Signed-off-by: jvfe <jvfecav@gmail.com>

* refactor: Wrap with statements in assertAll

Signed-off-by: jvfe <jvfecav@gmail.com>

* refactor: Check the snapshot of every output except gbk

Signed-off-by: jvfe <jvfecav@gmail.com>

* fix: Change biopython version in environment

Signed-off-by: jvfe <jvfecav@gmail.com>

---------

Signed-off-by: jvfe <jvfecav@gmail.com>
  • Loading branch information
jvfe authored Apr 2, 2024
1 parent b626cd7 commit 89f5a0a
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 38 deletions.
3 changes: 2 additions & 1 deletion modules/nf-core/phispy/environment.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: PhiSpy
name: phispy
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- bioconda::phispy=4.2.21
- conda-forge::biopython=1.81
4 changes: 2 additions & 2 deletions modules/nf-core/phispy/meta.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json
name: "PhiSpy"
name: "phispy"
description: Predict prophages in bacterial genomes
keywords:
- genomics
Expand All @@ -16,7 +16,7 @@ tools:
documentation: "https://github.com/linsalrob/PhiSpy/blob/master/README.md"
tool_dev_url: "https://github.com/linsalrob/PhiSpy/"
doi: "10.1093/nar/gks406"
licence: "['MIT']"
licence: ["MIT"]
input:
- meta:
type: map
Expand Down
87 changes: 87 additions & 0 deletions modules/nf-core/phispy/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// nf-core modules test phispy
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "phispy"

test("bacteroides_fragilis - gbff") {

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file( params.modules_testdata_base_path + "/genomics/prokaryotes/bacteroides_fragilis/genome/genome.gbff.gz", checkIfExists: true )
]
"""
}
}

then {
assertAll(
{ assert process.success },
{
with(process.out.log[0]) {
assert path(get(1)).text.contains('NZ_CP069563.1')
assert path(get(1)).text.contains('91')
assert path(get(1)).text.contains('Kept')
}
},
{
with(process.out.coordinates[0]) {
assert path(get(1)).text.contains('NZ_CP069563.1')
assert path(get(1)).text.contains('pp1')
assert path(get(1)).text.contains('Longest Repeat flanking phage and within 2000 bp')
}
},
{ assert path(process.out.gbk[0][1]).linesGzip.toString().contains('5150703 bp') },
{ assert snapshot(process.out.versions).match() }
)
}

}

test("bacteroides_fragilis - gbff - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file( params.modules_testdata_base_path + "/genomics/prokaryotes/bacteroides_fragilis/genome/genome.gbff.gz", checkIfExists: true )
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert path(process.out.gbk[0][1]).exists() },
{ assert snapshot(
process.out.coordinates,
process.out.log,
process.out.information,
process.out.bacteria_fasta,
process.out.bacteria_gbk,
process.out.phage_fasta,
process.out.phage_gbk,
process.out.prophage_gff,
process.out.prophage_tbl,
process.out.prophage_tsv,
process.out.versions
).match()
}
)
}

}

}
106 changes: 106 additions & 0 deletions modules/nf-core/phispy/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions modules/nf-core/phispy/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
phispy:
- "modules/nf-core/phispy/**"
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1468,9 +1468,6 @@ peka:
phantompeakqualtools:
- modules/nf-core/phantompeakqualtools/**
- tests/modules/nf-core/phantompeakqualtools/**
phispy:
- modules/nf-core/phispy/**
- tests/modules/nf-core/phispy/**
phyloflash:
- modules/nf-core/phyloflash/**
- tests/modules/nf-core/phyloflash/**
Expand Down
15 changes: 0 additions & 15 deletions tests/modules/nf-core/phispy/main.nf

This file was deleted.

5 changes: 0 additions & 5 deletions tests/modules/nf-core/phispy/nextflow.config

This file was deleted.

12 changes: 0 additions & 12 deletions tests/modules/nf-core/phispy/test.yml

This file was deleted.

0 comments on commit 89f5a0a

Please sign in to comment.