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

Adding sequali module to nf-core modules #6896

Merged
merged 10 commits into from
Oct 31, 2024
7 changes: 7 additions & 0 deletions modules/nf-core/sequali/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::sequali=0.12.0"
irliampa marked this conversation as resolved.
Show resolved Hide resolved
58 changes: 58 additions & 0 deletions modules/nf-core/sequali/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
process SEQUALI {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'oras://community.wave.seqera.io/library/sequali:0.12.0--c288fa2befb47d0f':
'community.wave.seqera.io/library/sequali:0.12.0--07485bec824d914a' }"

input:

tuple val(meta), path(reads)
LouisLeNezet marked this conversation as resolved.
Show resolved Hide resolved

output:

tuple val(meta), path("*.html"), emit: html
tuple val(meta), path("*.json"), emit: json
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 read_1_bam = reads.size() == 1 ? reads : reads[0]
def read_2 = reads.size() == 2 ? reads[1]: ""

"""
sequali \\
$args \\
-t $task.cpus \\
--html ${prefix}.html \\
--json ${prefix}.json \\
$read_1_bam \\
$read_2

cat <<-END_VERSIONS > versions.yml
"${task.process}":
sequali: \$(sequali --version |& sed '1!d ; s/sequali //')
END_VERSIONS
"""

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

"""
touch ${prefix}.html
touch ${prefix}.json

cat <<-END_VERSIONS > versions.yml
"${task.process}":
sequali: \$(sequali --version |& sed '1!d ; s/sequali //')
END_VERSIONS
"""
}

60 changes: 60 additions & 0 deletions modules/nf-core/sequali/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name: sequali
description: Sequence quality metrics for FASTQ and uBAM files.
keywords:
- quality_control
- qc
- preprocessing
tools:
- sequali:
description: Fast sequencing quality metrics
homepage: "https://github.com/rhpvorderman/sequali"
documentation: "https://sequali.readthedocs.io/en/latest/"
tool_dev_url: "https://github.com/rhpvorderman/sequali"
doi: "10.5281/zenodo.10854010"
licence: ["AGPL v3-or-later"]

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`

- reads:
type: file
description: Input FASTQ(s) or uBAM file. The format is autodetected and compressed formats are supported.
pattern: "*.{fastq,fq,fastq.gz,fq.gz,bam}"
output:
- json:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.json":
type: file
description: JSON output file.
pattern: "*.{json}"
- html:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.html":
type: file
description: HTML output file.
pattern: "*.{html}"

- versions:
- "versions.yml":
type: file
description: File containing software versions.
pattern: "versions.yml"
authors:
- "@irliampa"
- "@DarkoCucin"
maintainers:
- "@irliampa"
- "@DarkoCucin"
163 changes: 163 additions & 0 deletions modules/nf-core/sequali/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "sequali"

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

when {
process {
"""
input[0] = [
[ id:'test', single_end:true], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert process.out.html[0][1] ==~ ".*/test.html"},
{ assert process.out.json[0][1] ==~ ".*/test.json"},
{ assert snapshot(process.out.versions).match() }
LouisLeNezet marked this conversation as resolved.
Show resolved Hide resolved
)
}

}

test("sarscov2 - fastq paired-end [sequali]") {

when {
process {
"""
input[0] = Channel.of([
[id: 'test', single_end: false], // meta map
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) ]
])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert process.out.html[0][1] ==~ ".*/test.html"},
{ assert process.out.json[0][1] ==~ ".*/test.json"},
{ assert snapshot(process.out.versions).match() }
)
}

}


test("sarscov2 - unaligned bam [sequali]") {

when {
process {
"""
input[0] = Channel.of([
[id: 'test', single_end: true], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.unaligned.bam', checkIfExists: true) ])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert process.out.html[0][1] ==~ ".*/test.html"},
{ assert process.out.json[0][1] ==~ ".*/test.json"},
{ assert snapshot(process.out.versions).match() }
)
}

}

test("sarscov2 - fastq single-end - stub[sequali]") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert process.out.html[0][1] ==~ ".*/test.html"},
{ assert process.out.json[0][1] ==~ ".*/test.json"},
{ assert snapshot(process.out.versions).match() }
)
}

}

test("sarscov2 - fastq paired-end - stub[sequali]") {

options "-stub"

when {
process {
"""
input[0] = Channel.of([
[id: 'test', single_end: false], // meta map
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) ]
])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert process.out.html[0][1] ==~ ".*/test.html"},
{ assert process.out.json[0][1] ==~ ".*/test.json"},
{ assert snapshot(process.out.versions).match() }
)
}

}

test("sarscov2 - unaligned bam - stub[sequali]") {

options "-stub"

when {
process {
"""
input[0] = Channel.of([
[id: 'test', single_end: true], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.unaligned.bam', checkIfExists: true) ])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert process.out.html[0][1] ==~ ".*/test.html"},
{ assert process.out.json[0][1] ==~ ".*/test.json"},
{ assert snapshot(process.out.versions).match() }
)
}

}


}
74 changes: 74 additions & 0 deletions modules/nf-core/sequali/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"sarscov2 - unaligned bam stub [sequali]": {
"content": [
[
"versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30"
]
],
"meta": {
"nf-test": "0.9.1",
"nextflow": "24.10.0"
},
"timestamp": "2024-10-29T12:56:50.266586"
},
"sarscov2 - fastq paired-end [sequali]": {
"content": [
[
"versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30"
]
],
"meta": {
"nf-test": "0.9.1",
"nextflow": "24.10.0"
},
"timestamp": "2024-10-29T12:55:13.71146"
},
"sarscov2 - fastq paired-end stub[sequali]": {
"content": [
[
"versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30"
]
],
"meta": {
"nf-test": "0.9.1",
"nextflow": "24.10.0"
},
"timestamp": "2024-10-29T12:56:28.225926"
},
"sarscov2 - fastq single-end - stub[sequali]": {
"content": [
[
"versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30"
]
],
"meta": {
"nf-test": "0.9.1",
"nextflow": "24.10.0"
},
"timestamp": "2024-10-29T12:56:05.920598"
},
"sarscov2 - fastq single-end [sequali]": {
"content": [
[
"versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30"
]
],
"meta": {
"nf-test": "0.9.1",
"nextflow": "24.10.0"
},
"timestamp": "2024-10-29T12:54:09.135042"
},
"sarscov2 - unaligned bam [sequali]": {
"content": [
[
"versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30"
]
],
"meta": {
"nf-test": "0.9.1",
"nextflow": "24.10.0"
},
"timestamp": "2024-10-29T12:55:43.528332"
}
}
Loading