From 1c37161c14799b79d8366b3adb5f5a9506be5564 Mon Sep 17 00:00:00 2001 From: erkutilaslan Date: Tue, 29 Oct 2024 14:42:01 +0100 Subject: [PATCH 1/4] add fq_lint module --- modules.json | 5 ++ modules/nf-core/fq/lint/environment.yml | 5 ++ modules/nf-core/fq/lint/main.nf | 33 ++++++++++ modules/nf-core/fq/lint/meta.yml | 43 +++++++++++++ modules/nf-core/fq/lint/tests/main.nf.test | 63 +++++++++++++++++++ .../nf-core/fq/lint/tests/main.nf.test.snap | 25 ++++++++ modules/nf-core/fq/lint/tests/tags.yml | 2 + workflows/seqinspector.nf | 9 +++ 8 files changed, 185 insertions(+) create mode 100644 modules/nf-core/fq/lint/environment.yml create mode 100644 modules/nf-core/fq/lint/main.nf create mode 100644 modules/nf-core/fq/lint/meta.yml create mode 100644 modules/nf-core/fq/lint/tests/main.nf.test create mode 100644 modules/nf-core/fq/lint/tests/main.nf.test.snap create mode 100644 modules/nf-core/fq/lint/tests/tags.yml diff --git a/modules.json b/modules.json index 8e632d5..8e9e949 100644 --- a/modules.json +++ b/modules.json @@ -10,6 +10,11 @@ "git_sha": "666652151335353eef2fcd58880bcef5bc2928e1", "installed_by": ["modules"] }, + "fq/lint": { + "branch": "master", + "git_sha": "a1abf90966a2a4016d3c3e41e228bfcbd4811ccc", + "installed_by": ["modules"] + }, "multiqc": { "branch": "master", "git_sha": "cf17ca47590cc578dfb47db1c2a44ef86f89976d", diff --git a/modules/nf-core/fq/lint/environment.yml b/modules/nf-core/fq/lint/environment.yml new file mode 100644 index 0000000..74b1460 --- /dev/null +++ b/modules/nf-core/fq/lint/environment.yml @@ -0,0 +1,5 @@ +channels: + - conda-forge + - bioconda +dependencies: + - bioconda::fq=0.12.0 diff --git a/modules/nf-core/fq/lint/main.nf b/modules/nf-core/fq/lint/main.nf new file mode 100644 index 0000000..943314c --- /dev/null +++ b/modules/nf-core/fq/lint/main.nf @@ -0,0 +1,33 @@ +process FQ_LINT { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/fq:0.12.0--h9ee0642_0': + 'biocontainers/fq:0.12.0--h9ee0642_0' }" + + input: + tuple val(meta), path(fastq) + + output: + tuple val(meta), path("*.fq_lint.txt"), emit: lint + 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}" + """ + fq lint \\ + $args \\ + $fastq > ${prefix}.fq_lint.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fq: \$(echo \$(fq lint --version | sed 's/fq-lint //g')) + END_VERSIONS + """ +} diff --git a/modules/nf-core/fq/lint/meta.yml b/modules/nf-core/fq/lint/meta.yml new file mode 100644 index 0000000..7240fb5 --- /dev/null +++ b/modules/nf-core/fq/lint/meta.yml @@ -0,0 +1,43 @@ +name: "fq_lint" +description: fq lint is a FASTQ file pair validator. +keywords: + - lint + - fastq + - validate +tools: + - "fq": + description: "fq is a library to generate and validate FASTQ file pairs." + homepage: "https://github.com/stjude-rust-labs/fq" + documentation: "https://github.com/stjude-rust-labs/fq" + tool_dev_url: "https://github.com/stjude-rust-labs/fq" + licence: ["MIT"] + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fastq: + type: file + description: FASTQ file list + pattern: "*.fastq{,.gz}" +output: + - lint: + - meta: + type: file + description: Lint output + pattern: "*.fq_lint.txt" + - "*.fq_lint.txt": + type: file + description: Lint output + pattern: "*.fq_lint.txt" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@adamrtalbot" +maintainers: + - "@adamrtalbot" diff --git a/modules/nf-core/fq/lint/tests/main.nf.test b/modules/nf-core/fq/lint/tests/main.nf.test new file mode 100644 index 0000000..ec2eaf8 --- /dev/null +++ b/modules/nf-core/fq/lint/tests/main.nf.test @@ -0,0 +1,63 @@ +nextflow_process { + + name "Test Process FQ_LINT" + script "../main.nf" + process "FQ_LINT" + + tag "modules" + tag "modules_nfcore" + tag "fq" + tag "fq/lint" + + test("test_fq_lint_success") { + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = [ [ 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.lint.get(0).get(1) ==~ ".*/test.fq_lint.txt" }, + { assert path(process.out.lint.get(0).get(1)).getText().contains("fq-lint start") }, + { assert path(process.out.lint.get(0).get(1)).getText().contains("read 100 records") }, + { assert path(process.out.lint.get(0).get(1)).getText().contains("fq-lint end") }, + ) + } + + } + + test("test_fq_lint_fail") { + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = [ [ 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/prokaryotes/candidatus_portiera_aleyrodidarum/illumina/fastq/test_2.fastq.gz', checkIfExists: true) ] + ] + """ + } + } + + then { + assertAll ( + { assert !process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + +} diff --git a/modules/nf-core/fq/lint/tests/main.nf.test.snap b/modules/nf-core/fq/lint/tests/main.nf.test.snap new file mode 100644 index 0000000..fec8e52 --- /dev/null +++ b/modules/nf-core/fq/lint/tests/main.nf.test.snap @@ -0,0 +1,25 @@ +{ + "test_fq_lint_fail": { + "content": [ + { + "0": [ + + ], + "1": [ + + ], + "lint": [ + + ], + "versions": [ + + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-19T16:37:02.133847389" + } +} \ No newline at end of file diff --git a/modules/nf-core/fq/lint/tests/tags.yml b/modules/nf-core/fq/lint/tests/tags.yml new file mode 100644 index 0000000..9c9c323 --- /dev/null +++ b/modules/nf-core/fq/lint/tests/tags.yml @@ -0,0 +1,2 @@ +fq/lint: + - modules/nf-core/fq/lint/** diff --git a/workflows/seqinspector.nf b/workflows/seqinspector.nf index ea62811..057c4df 100644 --- a/workflows/seqinspector.nf +++ b/workflows/seqinspector.nf @@ -4,6 +4,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ include { FASTQC } from '../modules/nf-core/fastqc/main' +include { FQ_LINT } from '../modules/nf-core/fq/lint/main' include { MULTIQC as MULTIQC_GLOBAL } from '../modules/nf-core/multiqc/main' include { MULTIQC as MULTIQC_PER_TAG } from '../modules/nf-core/multiqc/main' @@ -39,6 +40,14 @@ workflow SEQINSPECTOR { ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip) ch_versions = ch_versions.mix(FASTQC.out.versions.first()) + // + // MODULE: Run FastQC + // + FQ_LINT ( + ch_samplesheet + ) + ch_versions = ch_versions.mix(FQ_LINT.out.versions) + // // Collate and save software versions // From 0babe59d5bb945bcbcfd70335fd9b6296de351c4 Mon Sep 17 00:00:00 2001 From: erkutilaslan Date: Wed, 30 Oct 2024 11:19:20 +0100 Subject: [PATCH 2/4] add fq_lint config --- conf/modules.config | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/conf/modules.config b/conf/modules.config index c883822..8c84907 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -22,6 +22,22 @@ process { ext.args = '--quiet' } + withName: FQ_LINT { + ext.args = '--lint-mode log' + publishDir = [ + [ + path: { "${params.outdir}/fq/lint" }, + mode: params.publish_dir_mode, + pattern: "*.log" + ], + [ + path: { "${params.outdir}/fq/lint" }, + mode: params.publish_dir_mode, + pattern: "*.txt" + ] + ] + } + withName: 'MULTIQC_GLOBAL' { ext.args = { params.multiqc_title ? "--title \"$params.multiqc_title\"" : '' } publishDir = [ From 5321066dfc744036b7be1f212cbfc5527417b83c Mon Sep 17 00:00:00 2001 From: erkutilaslan Date: Wed, 30 Oct 2024 11:26:27 +0100 Subject: [PATCH 3/4] add fq_lint documentation --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f647af0..9f6cfbd 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,8 @@ 1. Read QC ([`FastQC`](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/)) -2. Present QC for raw reads ([`MultiQC`](http://multiqc.info/)) +2. Validate fastq pairs ([`FQ `](https://github.com/stjude-rust-labs/fq)) +3. Present QC for raw reads ([`MultiQC`](http://multiqc.info/)) ## Usage From 48eb720ebc7260509ca3ed7ef8d29b3dc7d67989 Mon Sep 17 00:00:00 2001 From: erkutilaslan Date: Wed, 30 Oct 2024 11:42:49 +0100 Subject: [PATCH 4/4] fix fq_lint config typo --- conf/modules.config | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index 8c84907..e0d085c 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -24,16 +24,16 @@ process { withName: FQ_LINT { ext.args = '--lint-mode log' - publishDir = [ - [ - path: { "${params.outdir}/fq/lint" }, - mode: params.publish_dir_mode, - pattern: "*.log" - ], - [ - path: { "${params.outdir}/fq/lint" }, - mode: params.publish_dir_mode, - pattern: "*.txt" + publishDir = [ + [ + path: { "${params.outdir}/fq/lint" }, + mode: params.publish_dir_mode, + pattern: "*.log" + ], + [ + path: { "${params.outdir}/fq/lint" }, + mode: params.publish_dir_mode, + pattern: "*.txt" ] ] }