Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/nf-core/phispy/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ channels:
dependencies:
- bioconda::phispy=4.2.21
- conda-forge::biopython=1.81
- conda-forge::python=3.10.5
- conda-forge::setuptools=63.3.0
43 changes: 17 additions & 26 deletions modules/nf-core/phispy/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ process PHISPY {
tuple val(meta), path("${prefix}.tsv") , emit: coordinates
tuple val(meta), path("${prefix}.gb*") , emit: gbk
tuple val(meta), path("${prefix}.log") , emit: log
tuple val(meta), path("${prefix}_prophage_information.tsv"), optional:true, emit: information
tuple val(meta), path("${prefix}_bacteria.fasta") , optional:true, emit: bacteria_fasta
tuple val(meta), path("${prefix}_bacteria.gbk") , optional:true, emit: bacteria_gbk
tuple val(meta), path("${prefix}_phage.fasta") , optional:true, emit: phage_fasta
tuple val(meta), path("${prefix}_phage.gbk") , optional:true, emit: phage_gbk
tuple val(meta), path("${prefix}_prophage.gff3") , optional:true, emit: prophage_gff
tuple val(meta), path("${prefix}_prophage.tbl") , optional:true, emit: prophage_tbl
tuple val(meta), path("${prefix}_prophage.tsv") , optional:true, emit: prophage_tsv
path "versions.yml" , emit: versions
tuple val(meta), path("${prefix}_prophage_information.tsv"), emit: information , optional:true
tuple val(meta), path("${prefix}_bacteria.fasta") , emit: bacteria_fasta, optional:true
tuple val(meta), path("${prefix}_bacteria.gbk") , emit: bacteria_gbk , optional:true
tuple val(meta), path("${prefix}_phage.fasta") , emit: phage_fasta , optional:true
tuple val(meta), path("${prefix}_phage.gbk") , emit: phage_gbk , optional:true
tuple val(meta), path("${prefix}_prophage.gff3") , emit: prophage_gff , optional:true
tuple val(meta), path("${prefix}_prophage.tbl") , emit: prophage_tbl , optional:true
tuple val(meta), path("${prefix}_prophage.tsv") , emit: prophage_tsv , optional:true
tuple val("${task.process}"), val('phispy'), eval('PhiSpy.py --version 2>&1'), topic: versions, emit: versions_phispy

when:
task.ext.when == null || task.ext.when
Expand All @@ -33,35 +33,31 @@ process PHISPY {
// Extract GBK file extension, i.e. .gbff, .gbk.gz
gbk_extension = gbk.getName() - gbk.getSimpleName()

if ("$gbk" == "${prefix}${gbk_extension}") error "Input and output names are the same, set prefix in module configuration to disambiguate!"
if ("${gbk}" == "${prefix}${gbk_extension}") error "Input and output names are the same, set prefix in module configuration to disambiguate!"

"""
PhiSpy.py \\
$args \\
--threads $task.cpus \\
-p $prefix \\
${args} \\
--threads ${task.cpus} \\
-p ${prefix} \\
-o . \\
$gbk
${gbk}

mv ${prefix}_prophage_coordinates.tsv ${prefix}.tsv
mv ${prefix}_${gbk} ${prefix}${gbk_extension}
mv ${prefix}_phispy.log ${prefix}.log

cat <<-END_VERSIONS > versions.yml
"${task.process}":
PhiSpy: \$(echo \$(PhiSpy.py --version 2>&1))
END_VERSIONS
"""

stub:
prefix = task.ext.prefix ?: "${meta.id}"
gbk_extension = gbk.getName() - gbk.getSimpleName()
gbl_create_cmd = gbk_extension.endsWith(".gz") ? 'echo "" | gzip >' : "touch"

if ("$gbk" == "${prefix}${gbk_extension}") error "Input and output names are the same, set prefix in module configuration to disambiguate!"
if ("${gbk}" == "${prefix}${gbk_extension}") error "Input and output names are the same, set prefix in module configuration to disambiguate!"

"""
touch ${prefix}.tsv
touch ${prefix}${gbk_extension}
${gbl_create_cmd} ${prefix}${gbk_extension}
touch ${prefix}.log
touch ${prefix}_prophage_information.tsv
touch ${prefix}_bacteria.fasta
Expand All @@ -71,10 +67,5 @@ process PHISPY {
touch ${prefix}_prophage.gff3
touch ${prefix}_prophage.tbl
touch ${prefix}_prophage.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
PhiSpy: \$(echo \$(PhiSpy.py --version 2>&1))
END_VERSIONS
"""
}
32 changes: 24 additions & 8 deletions modules/nf-core/phispy/meta.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json
name: "phispy"
description: Predict prophages in bacterial genomes
keywords:
Expand All @@ -15,7 +14,8 @@ 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"
identifier: ""
input:
- - meta:
Expand Down Expand Up @@ -163,13 +163,29 @@ output:
pattern: "*.{tsv}"
ontologies:
- edam: http://edamontology.org/format_3475 # TSV
versions_phispy:
- - ${task.process}:
type: string
description: The name of the process
- phispy:
type: string
description: The name of the tool
- PhiSpy.py --version 2>&1:
type: eval
description: The expression to obtain the version of the tool

topics:
versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: http://edamontology.org/format_3750 # YAML
- - ${task.process}:
type: string
description: The name of the process
- phispy:
type: string
description: The name of the tool
- PhiSpy.py --version 2>&1:
type: eval
description: The expression to obtain the version of the tool

authors:
- "@jvfe"
maintainers:
Expand Down
48 changes: 14 additions & 34 deletions modules/nf-core/phispy/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ nextflow_process {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[ id:'test' ],
file( params.modules_testdata_base_path + "/genomics/prokaryotes/bacteroides_fragilis/genome/genome.gbff.gz", checkIfExists: true )
]
"""
Expand All @@ -25,25 +25,20 @@ nextflow_process {
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')
}
},
{ 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() }
{ assert snapshot(sanitizeOutput(process.out, unstableKeys:["log", "coordinates", "gbk"])).match() }
)
}

}

test("bacteroides_fragilis - gbff - stub") {
Expand All @@ -54,7 +49,7 @@ nextflow_process {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[ id:'test' ],
file( params.modules_testdata_base_path + "/genomics/prokaryotes/bacteroides_fragilis/genome/genome.gbff.gz", checkIfExists: true )
]
"""
Expand All @@ -64,24 +59,9 @@ nextflow_process {
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()
}
{ assert snapshot(sanitizeOutput(process.out)).match() }
)
}

}

}
Loading