Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wipertools module (#7184) #7185

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 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
7 changes: 7 additions & 0 deletions modules/nf-core/wipertools/fastqgather/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.3"
46 changes: 46 additions & 0 deletions modules/nf-core/wipertools/fastqgather/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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 "" | gzip > ${prefix}_gather.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools fastqgather: \$(wipertools fastqgather --version)
END_VERSIONS
"""
}
59 changes: 59 additions & 0 deletions modules/nf-core/wipertools/fastqgather/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 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: ""
args_id: "$args"

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test' ]
- fastq_in:
type: file
description: List of FASTQ chunk files 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' ]
- "*_gather.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"
91 changes: 91 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,91 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "wipertools"
tag "wipertools/fastqgather"
tag "wipertools/fastqscatter"

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

config "./nextflow.config"

setup {
run("WIPERTOOLS_FASTQSCATTER") {
script "../../fastqscatter/main.nf"
process {
"""
input[0] = [
[ id:'pp_' ], // meta map
file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/fastq/test_1.fastq.gz", checkIfExists: true)
]
input[1] = 2 // number of splits
"""
}
}
mazzalab marked this conversation as resolved.
Show resolved Hide resolved
}

when {
params {
module_args = '--prefix pp_'
}
process {
"""
input[0] = WIPERTOOLS_FASTQSCATTER.out.chunks.map { tuple( [id: 'fastq_chunks'], it[1] ) }
"""
}
}

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

}

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

options "-stub"
config "./nextflow.config"

setup {
run("WIPERTOOLS_FASTQSCATTER") {
script "../../fastqscatter/main.nf"
process {
"""
input[0] = [
[ id:'pp_' ], // meta map
file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/fastq/test_1.fastq.gz", checkIfExists: true)
]
input[1] = 2 // number of splits
"""
}
}
}

when {
params {
module_args = '--prefix pp_'
}
process {
"""
input[0] = WIPERTOOLS_FASTQSCATTER.out.chunks.map { tuple( [id: 'fastq_chunks'], it[1] ) }
"""
}
}

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

}
68 changes: 68 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,68 @@
{
"merge two gzipped fastq - fastq.gz - stub": {
"content": [
{
"0": [
[
{
"id": "fastq_chunks"
},
"fastq_chunks_gather.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"1": [
"versions.yml:md5,291a2e6d58146bfcf57b4d9ef850cbd9"
],
"fastq_out": [
[
{
"id": "fastq_chunks"
},
"fastq_chunks_gather.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"versions": [
"versions.yml:md5,291a2e6d58146bfcf57b4d9ef850cbd9"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-11T20:28:51.132317"
},
"merge two gzipped fastq - fastq.gz": {
"content": [
{
"0": [
[
{
"id": "fastq_chunks"
},
"fastq_chunks_gather.fastq.gz:md5,eedbbe1317d4d464da30d56cff7d677e"
]
],
"1": [
"versions.yml:md5,291a2e6d58146bfcf57b4d9ef850cbd9"
],
"fastq_out": [
[
{
"id": "fastq_chunks"
},
"fastq_chunks_gather.fastq.gz:md5,eedbbe1317d4d464da30d56cff7d677e"
]
],
"versions": [
"versions.yml:md5,291a2e6d58146bfcf57b4d9ef850cbd9"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-12-11T20:28:40.144022"
}
}
5 changes: 5 additions & 0 deletions modules/nf-core/wipertools/fastqgather/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: WIPERTOOLS_FASTQGATHER {
ext.args = params.module_args
}
}
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.3"
55 changes: 55 additions & 0 deletions modules/nf-core/wipertools/fastqscatter/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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
mazzalab marked this conversation as resolved.
Show resolved Hide resolved

cat <<-END_VERSIONS > versions.yml
"${task.process}":
wipertools fastqscatter: \$(wipertools fastqscatter --version)
END_VERSIONS
"""
}
Loading
Loading