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 8 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"
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}
mazzalab marked this conversation as resolved.
Show resolved Hide resolved

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
mazzalab marked this conversation as resolved.
Show resolved Hide resolved

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 ]
mazzalab marked this conversation as resolved.
Show resolved Hide resolved
- 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', single_end:false ]
mazzalab marked this conversation as resolved.
Show resolved Hide resolved
- "*_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"
5 changes: 5 additions & 0 deletions modules/nf-core/wipertools/fastqgather/tests/base.config
mazzalab marked this conversation as resolved.
Show resolved Hide resolved
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)]
mazzalab marked this conversation as resolved.
Show resolved Hide resolved
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.fastq_out, process.out.versions).match() }
mazzalab marked this conversation as resolved.
Show resolved Hide resolved
)
}

}

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)]
mazzalab marked this conversation as resolved.
Show resolved Hide resolved
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.fastq_out, process.out.versions).match() }
mazzalab marked this conversation as resolved.
Show resolved Hide resolved
)
}
}

}
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.3"
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'))

mazzalab marked this conversation as resolved.
Show resolved Hide resolved
"""
wipertools fastqscatter -f ${fastq} -n ${num_splits} -p ${prefix} ${args}
mazzalab marked this conversation as resolved.
Show resolved Hide resolved

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
"""
}
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 ]
mazzalab marked this conversation as resolved.
Show resolved Hide resolved
- "${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
mazzalab marked this conversation as resolved.
Show resolved Hide resolved
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
Loading