Skip to content
Draft
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: 1 addition & 1 deletion main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ workflow {
NFCORE_TBANALYZER.out.multiqc_report
)
}

// Everything seemed okay
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THE END
Expand Down
47 changes: 47 additions & 0 deletions modules/tbpore/modules/local/tbpore_cluster/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
process TBPORE_CLUSTER {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/tbpore:0.7.1--pyhdfd78af_0':
'biocontainers/tbpore:0.7.1--pyhdfd78af_0' }"

input:
tuple val(meta), path(consensus_fa)

output:

tuple val(meta), path("*.txt"), emit: txt
path "versions.yml" , emit: versions

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

script:
def args = task.ext.args ?: ''

"""
tbpore cluster $args \\
--threads $task.cpus \\
$consensus_fa

cat <<-END_VERSIONS > versions.yml
"${task.process}":
tbpore: \$(tbpore --version |& sed s/tbpore, version //')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

"""
touch ${prefix}.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
tbpore: \$(tbpore --version |& sed s/tbpore, version //')
END_VERSIONS
"""
}
55 changes: 55 additions & 0 deletions modules/tbpore/modules/local/tbpore_cluster/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
nextflow_process {

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

setup {
run("TBPORE_PROCESS") {
script "../../tbpore_process/main.nf"

params {
modules_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/'
}

process {
"""

input[0] = Channel.of([
[ id:'test', single_end:true ],
file(
params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz',
checkIfExists: true
)
])

input[1] = Channel.of(
file("/.tbpore/decontamination_db/remove_contam.map-ont.mmi")
)
"""
}
}
}

test("sarscov2 single end [fastq]") {

when {
params {
// define parameters here. Example:
outdir = "tests/results"
}
process {
"""
// input[0] = TBPORE_PROCESS.out.fa | collect
"""
}
}

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

}

}
61 changes: 61 additions & 0 deletions modules/tbpore/modules/local/tbpore_process/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

process TBPORE_PROCESS {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/tbpore:0.7.1--pyhdfd78af_0':
'biocontainers/tbpore:0.7.1--pyhdfd78af_0' }"

input:
tuple val(meta), path(fastq)
path db

output:
tuple val(meta), path("*.json"), emit: json
tuple val(meta), path("*.fa") , emit: fa
tuple val(meta), path("*.bcf") , emit: bcf
tuple val(meta), path("*.txt") , emit: txt
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}"

"""
tbpore process $args \\
--threads $task.cpus \\
--name $prefix \\
--db $db \\
$fastq

cat <<-END_VERSIONS > versions.yml
"${task.process}":
tbpore: \$(tbpore --version |& sed s/tbpore, version //')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
// TODO nf-core: A stub section should mimic the execution of the original module as best as possible
// Have a look at the following examples:
// Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63
// Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54
"""
touch ${prefix}.json
touch ${prefix}.fa
touch ${prefix}.bcf
touch ${prefix}.txt


cat <<-END_VERSIONS > versions.yml
"${task.process}":
tbpore: \$(tbpore --version |& sed s/tbpore, version //')
END_VERSIONS
"""
}
43 changes: 43 additions & 0 deletions modules/tbpore/modules/local/tbpore_process/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
nextflow_process {

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

tag TBPORE_PROCESS

test("sarscov2 single end fastq") {

when {
params {
//define parameters here. Example:
modules_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/'
outdir = "tests/results"
}
process {
"""
input[0] = Channel.of([
[ id:'test', single_end:true ],
file(
params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz',
checkIfExists: true
)
])
input[1] = Channel.fromPath(
file("/.tbpore/decontamination_db/remove_contam.map-ont.mmi")
)
"""
}
}

then {
assertAll(

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

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"real data fastq": {
"content": [
{
"0": [

],
"1": [

],
"2": [

],
"3": [

],
"4": [

],
"bcf": [

],
"fa": [

],
"json": [

],
"txt": [

],
"versions": [

]
}
],
"meta": {
"nf-test": "0.9.1",
"nextflow": "24.04.4"
},
"timestamp": "2024-11-03T12:51:08.385030023"
}
}
8 changes: 8 additions & 0 deletions nf-test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config {

testsDir "tests"
workDir ".nf-test"
configFile "tests/nextflow.config"
profile ""

}
5 changes: 5 additions & 0 deletions tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
========================================================================================
Nextflow config file for running tests
========================================================================================
*/