Skip to content

Commit

Permalink
Add wipertools module (nf-core#7184)
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzalab committed Dec 9, 2024
1 parent 1f94c91 commit e61c41f
Show file tree
Hide file tree
Showing 22 changed files with 926 additions and 0 deletions.
42 changes: 42 additions & 0 deletions modules/nf-core/wipertools/fastqgather/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
process WIPERTOOLS_FASTQGATHER {
tag "$meta.id"
label 'process_single'

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

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

output:
tuple val(meta), path("*_gather.fastq.gz") , emit: fastq_out
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}"
"""
wipertools fastqgather -i $fastq_in -o ${prefix}_gather.fastq.gz ${args}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools fastqgather: \$(wipertools fastqgather --version)
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
echo -e "@ERR001268.2 080821_HWI-EAS301_0002_30ALBAAXX:1:1:1090:1998/1" > ${prefix}_gather.fastq | gzip -c > ${prefix}_gather.fastq.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools fastqgather: \$(wipertools fastqgather --version)
END_VERSIONS
"""
}
58 changes: 58 additions & 0 deletions modules/nf-core/wipertools/fastqgather/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "wipertools_fastqgather"
description: A tool of the wipertools suite that merges FASTQ chunks produced by wipertools_fastqscatter
keywords:
- fastq
- merge
- union
tools:
- "fastqgather":
description:
"A tool of the wipertools suite that merges FASTQ chunks produced\
\ by wipertools_fastqscatter."
homepage: "https://github.com/mazzalab/fastqwiper"
documentation: "https://github.com/mazzalab/fastqwiper"
tool_dev_url: "https://github.com/mazzalab/fastqwiper"
doi: "no DOI available"
licence: ["GPL v2-or-later"]
identifier: ""

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- fastq_folder_in:
type: file
description: Directory containing FASTQ chunks to be merged
pattern: "*.{fastq,fastq.gz}"
ontologies:
- edam: "http://edamontology.org/format_1930"
- edam: "http://edamontology.org/format_3989"
output:
- fastq_out:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.fastq.gz":
type: file
description: The resulting FASTQ file
pattern: "*.fastq.gz"
ontologies:
- edam: "http://edamontology.org/format_1930"
- edam: "http://edamontology.org/format_3989"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: "http://edamontology.org/format_2330"
authors:
- "@tm4zza"
maintainers:
- "@mazzalab"
- "@tm4zza"
5 changes: 5 additions & 0 deletions modules/nf-core/wipertools/fastqgather/tests/base.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: WIPERTOOLS_FASTQGATHER {
ext.args = '--prefix pp_'
}
}
66 changes: 66 additions & 0 deletions modules/nf-core/wipertools/fastqgather/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "wipertools"
tag "wipertools/fastqgather"
tag "untar"

test("merge two gzipped fastq - fastq.gz") {

config "./base.config"

when {
params {
outdir = "$outputDir"
}
process {
"""
input[0] = [
[id: 'fastq_chunks'],
[file('https://raw.githubusercontent.com/nf-core/test-datasets/fastqrepair/testdata/pp_1-of-2_ss.fastq.gz', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/fastqrepair/testdata/pp_2-of-2_ss.fastq.gz', checkIfExists: true)]
]
"""
}
}

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

}

test("merge two gzipped fastq - fastq.gz - stub") {

options "-stub"
config "./base.config"

when {
process {
"""
input[0] = [
[id: 'fastq_chunks'],
[file('https://raw.githubusercontent.com/nf-core/test-datasets/fastqrepair/testdata/pp_1-of-2_ss.fastq.gz', checkIfExists: true),
file('https://raw.githubusercontent.com/nf-core/test-datasets/fastqrepair/testdata/pp_2-of-2_ss.fastq.gz', checkIfExists: true)]
]
"""
}
}

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

}
42 changes: 42 additions & 0 deletions modules/nf-core/wipertools/fastqgather/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"merge two gzipped fastq - fastq.gz - stub": {
"content": [
[
[
{
"id": "fastq_chunks"
},
"fastq_chunks_gather.fastq.gz:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
[
"versions.yml:md5,291a2e6d58146bfcf57b4d9ef850cbd9"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-09T23:41:07.264741"
},
"merge two gzipped fastq - fastq.gz": {
"content": [
[
[
{
"id": "fastq_chunks"
},
"fastq_chunks_gather.fastq.gz:md5,5ba7f1c78e2f6c979b8b88494a08977a"
]
],
[
"versions.yml:md5,291a2e6d58146bfcf57b4d9ef850cbd9"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-09T23:40:55.88226"
}
}
7 changes: 7 additions & 0 deletions modules/nf-core/wipertools/fastqscatter/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::wipertools=1.1.1"
51 changes: 51 additions & 0 deletions modules/nf-core/wipertools/fastqscatter/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
process WIPERTOOLS_FASTQSCATTER {
tag "$meta.id"
label 'process_single'

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

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

output:
tuple val(meta), path("${out_folder}/*") , emit: chunks
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}"
def args_list = args.tokenize()
out_folder = (args_list.contains('--out_folder') ? args_list[args_list.indexOf('--out_folder')+1] : (args_list.contains('-o') ? args_list[args_list.indexOf('-o')+1] : 'chunks'))

"""
wipertools fastqscatter -f ${fastq} -n ${num_splits} -p ${prefix} ${args}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools fastqscatter: \$(wipertools fastqscatter --version)
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def args_list = args.tokenize()
out_folder = (args_list.contains('--out_folder') ? args_list[args_list.indexOf('--out_folder')+1] : (args_list.contains('-o') ? args_list[args_list.indexOf('-o')+1] : 'chunks'))
"""
mkdir ${out_folder}
echo -e "@ERR001268.1 080821_HWI-EAS301_0002_30ALBAAXX:1:1:1090:1998/1" > ${out_folder}/prefix_1-of-2_suffix.fastq
echo -e "@ERR001268.2 080821_HWI-EAS301_0002_30ALBAAXX:1:1:1090:1998/2" > ${out_folder}/prefix_2-of-2_suffix.fastq
cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools fastqscatter: \$(wipertools fastqscatter --version)
END_VERSIONS
"""
}
60 changes: 60 additions & 0 deletions modules/nf-core/wipertools/fastqscatter/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "wipertools_fastqscatter"
description: A tool of the wipertools suite that splits FASTQ files into chunks
keywords:
- fastq
- split
- partitioning
tools:
- "fastqscatter":
description: "A tool of the wipertools suite that splits FASTQ files into chunks."
homepage: "https://github.com/mazzalab/fastqwiper"
documentation: "https://github.com/mazzalab/fastqwiper"
tool_dev_url: "https://github.com/mazzalab/fastqwiper"
doi: "no DOI available"
licence: ["GPL v2-or-later"]
identifier: ""

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- fastq:
type: file
description: FASTQ file
pattern: "*.{fastq,fastq.gz}"
ontologies:
- edam: "http://edamontology.org/format_1930"
- - num_splits:
type: integer
description: Number of desired chunks
pattern: "[1-9][0-9]*"

output:
- chunks:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "${out_folder}/*":
type: file
description: Chunk FASTQ files
pattern: "*.{fastq,fastq.gz}"
ontologies:
- edam: "http://edamontology.org/format_1930"
- edam: "http://edamontology.org/format_3989"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: "http://edamontology.org/format_3750"
authors:
- "@tm4zza"
maintainers:
- "@mazzalab"
- "@tm4zza"
5 changes: 5 additions & 0 deletions modules/nf-core/wipertools/fastqscatter/tests/base.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: WIPERTOOLS_FASTQSCATTER {
ext.args = '-o chunks_custom -O unix'
}
}
Loading

0 comments on commit e61c41f

Please sign in to comment.