Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
27 changes: 18 additions & 9 deletions modules/nf-core/vrhyme/extractunbinned/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,45 @@ process VRHYME_EXTRACTUNBINNED {

input:
tuple val(meta), path(membership)
tuple val(meta), path(fasta)
tuple val(meta2), path(fasta)

output:
tuple val(meta), path("*_unbinned_sequences.fasta") , emit: unbinned_sequences
path "versions.yml" , emit: versions
tuple val(meta), path("${prefix}.fasta") , emit: unbinned_sequences
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
prefix = task.ext.prefix ?: "${meta.id}_unbinned_sequences"
def fasta_input = fasta.toString().replaceAll(/\.gz$/, '')
def gunzip = fasta.getExtension() == "gz" ? "gunzip -c ${fasta} > ${fasta_input}" : ""
def cleanup = fasta.getExtension() == "gz" ? "rm ${fasta_input}" : ""
if( "$fasta_input" == "${prefix}.fasta" ) error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
"""
${gunzip}

extract_unbinned_sequences.py \\
-i $membership \\
-f $fasta \\
-o ${prefix}_unbinned_sequences.fasta \\
-f $fasta_input \\
-o ${prefix}.fasta \\
$args

${cleanup}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
vrhyme: \$(echo \$(vRhyme --version 2>&1) | sed 's/^.*vRhyme v//; s/Using.*\$//' )
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
prefix = task.ext.prefix ?: "${meta.id}_unbinned_sequences"
def fasta_input = fasta.toString() - ~/\.gz$/
if( "$fasta_input" == "${prefix}.fasta" ) error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
"""
touch ${prefix}_unbinned_sequences.fasta
touch ${prefix}.fasta

cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
18 changes: 12 additions & 6 deletions modules/nf-core/vrhyme/extractunbinned/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,38 @@ input:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
e.g. [ id:'test' ]
- membership:
type: file
description: TSV file containing information regarding which bins input sequences
were placed information
pattern: "*.{tsv}"
- - meta:
ontologies:
- edam: http://edamontology.org/format_3475 # TSV
- - meta2:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
Groovy Map containing information related to the fasta
e.g. [ id:'test' ]
- fasta:
type: file
description: FASTA file containing contigs/scaffolds input into vRhyme
pattern: "*.{fasta,fna,fa}"
pattern: "*.{fasta,fna,fa,fasta.gz,fna.gz,fa.gz}"
ontologies:
- edam: http://edamontology.org/format_1929 # FASTA
output:
- unbinned_sequences:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*_unbinned_sequences.fasta":
- "${prefix}.fasta":
type: file
description: FASTA file containing unbinned sequences
pattern: "*_unbinned_sequences.fasta"
ontologies:
- edam: http://edamontology.org/format_1929 # FASTA
- versions:
- versions.yml:
type: file
Expand Down
79 changes: 79 additions & 0 deletions modules/nf-core/vrhyme/extractunbinned/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
nextflow_process {

name "Test Process VRHYME_EXTRACTUNBINNED"

script "../main.nf"
process "VRHYME_EXTRACTUNBINNED"

tag "modules"
tag "modules_nfcore"
tag "vrhyme"
tag "vrhyme/vrhyme"
tag "vrhyme/extractunbinned"

setup {

run("VRHYME_VRHYME") {
script "../../vrhyme/main.nf"

process {
"""
input[0] = [
[id:'test',single_end:false],
[
file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fastq/test1_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fastq/test1_2.fastq.gz', checkIfExists: true)
]
]
input[1] = [
[id:'test',single_end:false],// meta map
file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fasta/test1.contigs.fa.gz', checkIfExists: true)
]
"""
}
}
}

test("test_vrhyme_extractunbinned") {

when {
process {
"""
input[0] = VRHYME_VRHYME.out.membership
input[1] = [
[id:'test',single_end:false],// meta map
file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fasta/test1.contigs.fa.gz', checkIfExists: true)
]
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}


test("test_vrhyme_extractunbinned -- stub") {
options '-stub'
when {
process {
"""
input[0] = VRHYME_VRHYME.out.membership
input[1] = [
[id:'test',single_end:false],// meta map
file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fasta/test1.contigs.fa.gz', checkIfExists: true)
]
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
72 changes: 72 additions & 0 deletions modules/nf-core/vrhyme/extractunbinned/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"test_vrhyme_extractunbinned -- stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test_unbinned_sequences.fasta:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,19f257878bced6c770eaf8ed45151b96"
],
"unbinned_sequences": [
[
{
"id": "test",
"single_end": false
},
"test_unbinned_sequences.fasta:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,19f257878bced6c770eaf8ed45151b96"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.5"
},
"timestamp": "2025-03-30T20:31:33.979555851"
},
"test_vrhyme_extractunbinned": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test_unbinned_sequences.fasta:md5,816e986c8ad8f277eb4a4891a12d7aff"
]
],
"1": [
"versions.yml:md5,19f257878bced6c770eaf8ed45151b96"
],
"unbinned_sequences": [
[
{
"id": "test",
"single_end": false
},
"test_unbinned_sequences.fasta:md5,816e986c8ad8f277eb4a4891a12d7aff"
]
],
"versions": [
"versions.yml:md5,19f257878bced6c770eaf8ed45151b96"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.5"
},
"timestamp": "2025-03-31T10:00:14.099653894"
}
}
5 changes: 4 additions & 1 deletion modules/nf-core/vrhyme/linkbins/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ input:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
e.g. [ id:'test' ]
- bins:
type: directory
description: Directory file containing bin FASTA files output by vRhyme (each
Expand All @@ -38,11 +38,14 @@ output:
type: file
description: FASTA file containing all bins that have been linked by N's
pattern: "*_linked_bins.fasta"
ontologies:
- edam: http://edamontology.org/format_1929 # FASTA
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies: []
authors:
- "@CarsonJM"
maintainers:
Expand Down
70 changes: 70 additions & 0 deletions modules/nf-core/vrhyme/linkbins/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
nextflow_process {

name "Test Process VRHYME_LINKBINS"

script "../main.nf"
process "VRHYME_LINKBINS"

tag "modules"
tag "modules_nfcore"
tag "vrhyme"
tag "vrhyme/vrhyme"
tag "vrhyme/linkbins"

setup {
run("VRHYME_VRHYME") {
script "../../vrhyme/main.nf"

process {
"""
input[0] = [
[ id:'test' ],
[
file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fastq/test1_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fastq/test1_2.fastq.gz', checkIfExists: true)
]
]
input[1] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fasta/test1.contigs.fa.gz', checkIfExists: true)
]
"""
}
}
}

test("vrhyme_linkbins") {

when {
process {
"""
input[0] = VRHYME_VRHYME.out.bins
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}


test("test_vrhyme_linkbins -- stub") {
options '-stub'
when {
process {
"""
input[0] = VRHYME_VRHYME.out.bins
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
Loading
Loading