Skip to content

Commit

Permalink
migrating flash to nf-test (#5470)
Browse files Browse the repository at this point in the history
* migrating flash to nf-test

* removing args2 from main.nf

* Update nextflow.config

* Changes discussed in the outputs

---------

Co-authored-by: Simon Pearce <[email protected]>
  • Loading branch information
DavideBag and SPPearce authored Apr 29, 2024
1 parent e0616fb commit 4db86a0
Show file tree
Hide file tree
Showing 10 changed files with 157 additions and 42 deletions.
29 changes: 24 additions & 5 deletions modules/nf-core/flash/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@ process FLASH {

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

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

output:
tuple val(meta), path("*.fastq.gz"), emit: reads
path "versions.yml" , emit: versions
tuple val(meta), path("${prefix}.extendedFrags.fastq.gz"), emit: merged
tuple val(meta), path("${prefix}.notCombined_*.fastq.gz"), emit: notcombined
tuple val(meta), path("${prefix}.hist") , emit: histogram
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}"
if ("$reads" == "${prefix}.extendedFrags.fastq.gz") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
if ("$reads" == "${prefix}.notCombined_1.fastq.gz") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
if ("$reads" == "${prefix}.notCombined_2.fastq.gz") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"

"""
flash \\
$args \\
Expand All @@ -33,4 +39,17 @@ process FLASH {
flash: \$(echo \$(flash --version 2>&1) | sed 's/^.*FLASH v//; s/ .*\$//')
END_VERSIONS
"""


stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.fastq.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":
flash: \$(echo \$(flash --version 2>&1) | sed 's/^.*FLASH v//; s/ .*\$//')
END_VERSIONS
"""
}
12 changes: 10 additions & 2 deletions modules/nf-core/flash/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,18 @@ output:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reads:
- merged:
type: file
description: The merged fastq reads
pattern: "*fastq.gz"
pattern: ".extendedFrags.fastq.gz"
- notcombined:
type: file
description: Not combined reads from flash
pattern: ".notCombined_*.fastq.gz"
- histogram:
type: file
description: HistogramNumeric histogram of merged read lengths.
pattern: ".hist"
- versions:
type: file
description: File containing software versions
Expand Down
37 changes: 37 additions & 0 deletions modules/nf-core/flash/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
nextflow_process {

name "Test Process FLASH"
script "../main.nf"
process "FLASH"
config "./nextflow.config"
tag "modules"
tag "modules_nfcore"
tag "flash"

test("sarscov2 - bam") {

when {
params{
outdir = "test"
}
process {
"""
input[0] = [
[ id: "test", single_end:false], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ]
]
"""
}
}

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

}

}
79 changes: 79 additions & 0 deletions modules/nf-core/flash/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"sarscov2 - bam": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.extendedFrags.fastq.gz:md5,a2f163bfc21f9d6f9cb6b02c2bbcc57f"
]
],
"1": [
[
{
"id": "test",
"single_end": false
},
[
"test.notCombined_1.fastq.gz:md5,3597e676a09cd3426ab3904a6ebed111",
"test.notCombined_2.fastq.gz:md5,9bb71579b34567a15c11b30e46bae6aa"
]
]
],
"2": [
[
{
"id": "test",
"single_end": false
},
"test.hist:md5,6aa28c9bcb430ba16c0fd0115dacda5f"
]
],
"3": [
"versions.yml:md5,324e2f6592d7c6aa86f624076a88a10f"
],
"histogram": [
[
{
"id": "test",
"single_end": false
},
"test.hist:md5,6aa28c9bcb430ba16c0fd0115dacda5f"
]
],
"merged": [
[
{
"id": "test",
"single_end": false
},
"test.extendedFrags.fastq.gz:md5,a2f163bfc21f9d6f9cb6b02c2bbcc57f"
]
],
"notcombined": [
[
{
"id": "test",
"single_end": false
},
[
"test.notCombined_1.fastq.gz:md5,3597e676a09cd3426ab3904a6ebed111",
"test.notCombined_2.fastq.gz:md5,9bb71579b34567a15c11b30e46bae6aa"
]
]
],
"versions": [
"versions.yml:md5,324e2f6592d7c6aa86f624076a88a10f"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-04-29T13:53:22.274475538"
}
}
5 changes: 5 additions & 0 deletions modules/nf-core/flash/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: FLASH {
ext.args = '-m 20 -M 150'
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/flash/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flash:
- "modules/nf-core/flash/**"
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,6 @@ fgbio/sortbam:
fgbio/zipperbams:
- modules/nf-core/fgbio/zipperbams/**
- tests/modules/nf-core/fgbio/zipperbams/**
flash:
- modules/nf-core/flash/**
- tests/modules/nf-core/flash/**
fqtk:
- modules/nf-core/fqtk/**
- modules/nf-core/untar/**
Expand Down
15 changes: 0 additions & 15 deletions tests/modules/nf-core/flash/main.nf

This file was deleted.

9 changes: 0 additions & 9 deletions tests/modules/nf-core/flash/nextflow.config

This file was deleted.

8 changes: 0 additions & 8 deletions tests/modules/nf-core/flash/test.yml

This file was deleted.

0 comments on commit 4db86a0

Please sign in to comment.