Skip to content

Commit

Permalink
Added new module for Toulligqc (nf-core#5131)
Browse files Browse the repository at this point in the history
* ADD: working toulligqc as module

* ToulligQC module passed tests

* [automated] Fix linting with Prettier

* Remove whitespaces

* Update main.nf

* Update main.nf

* Update modules/nf-core/toulligqc/meta.yml

Co-authored-by: Friederike Hanssen <Friederike.hanssen@qbic.uni-tuebingen.de>

* Update modules/nf-core/toulligqc/meta.yml

Co-authored-by: Friederike Hanssen <Friederike.hanssen@qbic.uni-tuebingen.de>

* Update modules/nf-core/toulligqc/meta.yml

Co-authored-by: Friederike Hanssen <Friederike.hanssen@qbic.uni-tuebingen.de>

* Update modules/nf-core/toulligqc/main.nf

Co-authored-by: Friederike Hanssen <Friederike.hanssen@qbic.uni-tuebingen.de>

* UPDATE: added fastq as input option

* Update environment.yml

* UPDATE: moved to ToulligQC v2.5.4 and added BAM as input file option

* Update modules/nf-core/toulligqc/meta.yml

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Update modules/nf-core/toulligqc/meta.yml

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* UPDATE: added meta map to module

* UPDATE: added stub section to module

* Update modules/nf-core/toulligqc/main.nf

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* FIX: pass seq_summarry, fastq, bam as one tuple

---------

Co-authored-by: nf-core-bot <core@nf-co.re>
Co-authored-by: Jonathan Manning <jonathan.manning@seqera.io>
Co-authored-by: Friederike Hanssen <Friederike.hanssen@qbic.uni-tuebingen.de>
Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
  • Loading branch information
5 people authored Mar 28, 2024
1 parent 30d3ca4 commit 49423bb
Show file tree
Hide file tree
Showing 6 changed files with 454 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/nf-core/toulligqc/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
name: "toulligqc"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::toulligqc=2.5.4"
64 changes: 64 additions & 0 deletions modules/nf-core/toulligqc/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
process TOULLIGQC {
label 'process_low'
tag "$meta.id"

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

input:
tuple val(meta), path(seq_summary), path(fastq), path(bam)

output:
tuple val(meta), path("*/*.data") , emit: report_data
path "*/*.html" , emit: report_html, optional: true
path "*/images/*.html" , emit: plots_html
path "*/images/plotly.min.js" , emit: plotly_js

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 seq_summary_input = seq_summary ? "--sequencing-summary-source ${seq_summary}" : ""
def fastq_input = fastq ? "--fastq ${fastq}" : ""
def bam_input = bam ? "--bam ${bam}" : ""

"""
toulligqc \\
${seq_summary_input} \\
${fastq_input} \\
${bam_input} \\
--output-directory ${prefix} \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
toulligqc: \$(toulligqc --version 2>&1)
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir ${prefix}
mkdir ${prefix}/images
touch ${prefix}/report.data
touch ${prefix}/images/Correlation_between_read_length_and_PHRED_score.html
touch ${prefix}/images/Distribution_of_read_lengths.html
touch ${prefix}/images/PHRED_score_density_distribution.html
touch ${prefix}/images/Read_count_histogram.html
touch ${prefix}/images/plotly.min.js
cat <<-END_VERSIONS > versions.yml
"${task.process}":
toulligqc: \$(toulligqc --version 2>&1)
END_VERSIONS
"""
}
66 changes: 66 additions & 0 deletions modules/nf-core/toulligqc/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "toulligqc"
description: "A post sequencing QC tool for Oxford Nanopore sequencers"
keywords:
- nanopore sequencing
- quality control
- genomics
tools:
- "toulligqc":
description: "A post sequencing QC tool for Oxford Nanopore sequencers"
homepage: https://github.com/GenomiqueENS/toulligQC
documentation: https://github.com/GenomiqueENS/toulligQC
tool_dev_url: https://github.com/GenomiqueENS/toulligQC
licence: ["CECILL-2.1"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- seq_summary:
type: file
description: Basecaller sequencing summary source
pattern: "*.txt"
- fastq:
type: file
description: FASTQ file (necessary if no sequencing summary file)
pattern: "*.{fq,fastq,fq.gz,fastq.gz}"
- bam:
type: file
description: BAM file (necessary if no sequencing summary file)
pattern: "*.bam"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- report_data:
type: file
description: Report data emitted from toulligqc
pattern: "*.data"
- report_html:
type: file
description: Report data in html format
pattern: "*.html"
- plots_html:
type: file
description: Plots emitted in html format
pattern: "*.html"
- plotly_js:
type: file
description: Plots emitted from toulligqc
pattern: "plotly.min.js"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@Salome-Brunon"
maintainers:
- "@Salome-Brunon"
105 changes: 105 additions & 0 deletions modules/nf-core/toulligqc/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "toulligqc"

test("sarscov2 - nanopore sequencing_summary") {
when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.test_data['sarscov2']['nanopore']['test2_sequencing_summary'], checkIfExists: true),
[],
[]
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(file(process.out.report_data.get(0).get(1)).readLines()[11..74]).match() },
{ assert process.out.report_html[0] ==~ ".*/report.html"}
)
}

}

test("sarscov2 - nanopore fastq") {
when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[],
file(params.test_data['sarscov2']['nanopore']['test_fastq_gz'], checkIfExists: true),
[]
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(file(process.out.report_data.get(0).get(1)).readLines()[11..67]).match() },
{ assert process.out.report_html[0] ==~ ".*/report.html"}
)
}

}

test("sarscov2 - nanopore bam") {
when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[],
[],
file(params.test_data['sarscov2']['nanopore']['test_sorted_bam'], checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(file(process.out.report_data.get(0).get(1)).readLines()[11..74]).match() },
{ assert process.out.report_html[0] ==~ ".*/report.html"}
)
}

}
test("sarscov2 - naopore bam - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[],
[],
file(params.test_data['sarscov2']['nanopore']['test_sorted_bam'], checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success }
)
}
}
}
Loading

0 comments on commit 49423bb

Please sign in to comment.