From 7111e571cc5b6069de4673cd6165af680f17b4d7 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Fri, 25 Mar 2022 12:11:40 -0500 Subject: [PATCH] Split preseq lcextrap and ccurve (#1440) * fix(preseq): Update lcextrap file name * chore(preseq): Bump lcextrap image * feat: Initialize preseq c_curve * docs(preseq): Update documentation --- modules/preseq/ccurve/main.nf | 40 +++++++++++++++++ modules/preseq/ccurve/meta.yml | 48 +++++++++++++++++++++ modules/preseq/lcextrap/main.nf | 12 +++--- modules/preseq/lcextrap/meta.yml | 9 ++-- tests/config/pytest_modules.yml | 4 ++ tests/modules/preseq/ccurve/main.nf | 25 +++++++++++ tests/modules/preseq/ccurve/nextflow.config | 5 +++ tests/modules/preseq/ccurve/test.yml | 19 ++++++++ tests/modules/preseq/lcextrap/test.yml | 4 +- 9 files changed, 154 insertions(+), 12 deletions(-) create mode 100644 modules/preseq/ccurve/main.nf create mode 100644 modules/preseq/ccurve/meta.yml create mode 100644 tests/modules/preseq/ccurve/main.nf create mode 100644 tests/modules/preseq/ccurve/nextflow.config create mode 100644 tests/modules/preseq/ccurve/test.yml diff --git a/modules/preseq/ccurve/main.nf b/modules/preseq/ccurve/main.nf new file mode 100644 index 00000000..febf83cc --- /dev/null +++ b/modules/preseq/ccurve/main.nf @@ -0,0 +1,40 @@ +process PRESEQ_CCURVE { + tag "$meta.id" + label 'process_medium' + label 'error_ignore' + + conda (params.enable_conda ? "bioconda::preseq=3.1.2" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/preseq:3.1.2--h445547b_2': + 'quay.io/biocontainers/preseq:3.1.2--h445547b_2' }" + + input: + tuple val(meta), path(bam) + + output: + tuple val(meta), path("*.c_curve.txt"), emit: c_curve + tuple val(meta), path("*.log") , emit: log + 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 paired_end = meta.single_end ? '' : '-pe' + """ + preseq \\ + c_curve \\ + $args \\ + $paired_end \\ + -output ${prefix}.c_curve.txt \\ + $bam + cp .command.err ${prefix}.command.log + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + preseq: \$(echo \$(preseq 2>&1) | sed 's/^.*Version: //; s/Usage:.*\$//') + END_VERSIONS + """ +} diff --git a/modules/preseq/ccurve/meta.yml b/modules/preseq/ccurve/meta.yml new file mode 100644 index 00000000..86ed6296 --- /dev/null +++ b/modules/preseq/ccurve/meta.yml @@ -0,0 +1,48 @@ +name: preseq_ccurve +description: Software for predicting library complexity and genome coverage in high-throughput sequencing +keywords: + - preseq + - library + - complexity +tools: + - preseq: + description: Software for predicting library complexity and genome coverage in high-throughput sequencing + homepage: http://smithlabresearch.org/software/preseq/ + documentation: http://smithlabresearch.org/wp-content/uploads/manual.pdf + tool_dev_url: https://github.com/smithlabcode/preseq + doi: "" + licence: ["GPL"] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - bam: + type: file + description: BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - ccurve: + type: file + description: File containing output of Preseq c curve + pattern: "*.{c_curve.txt}" + - log: + type: file + description: Log file containing stderr produced by Preseq + pattern: "*.{log}" + +authors: + - "@drpatelh" + - "@Emiller88" diff --git a/modules/preseq/lcextrap/main.nf b/modules/preseq/lcextrap/main.nf index d6dd19e2..97261557 100644 --- a/modules/preseq/lcextrap/main.nf +++ b/modules/preseq/lcextrap/main.nf @@ -5,16 +5,16 @@ process PRESEQ_LCEXTRAP { conda (params.enable_conda ? "bioconda::preseq=3.1.2" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/preseq:3.1.2--h06ef8b0_1' : - 'quay.io/biocontainers/preseq:3.1.2--h06ef8b0_1' }" + 'https://depot.galaxyproject.org/singularity/preseq:3.1.2--h445547b_2': + 'quay.io/biocontainers/preseq:3.1.2--h445547b_2' }" input: tuple val(meta), path(bam) output: - tuple val(meta), path("*.ccurve.txt"), emit: ccurve - tuple val(meta), path("*.log") , emit: log - path "versions.yml" , emit: versions + tuple val(meta), path("*.lc_extrap.txt"), emit: lc_extrap + tuple val(meta), path("*.log") , emit: log + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -28,7 +28,7 @@ process PRESEQ_LCEXTRAP { lc_extrap \\ $args \\ $paired_end \\ - -output ${prefix}.ccurve.txt \\ + -output ${prefix}.lc_extrap.txt \\ $bam cp .command.err ${prefix}.command.log diff --git a/modules/preseq/lcextrap/meta.yml b/modules/preseq/lcextrap/meta.yml index 0e33df25..f1be05a2 100755 --- a/modules/preseq/lcextrap/meta.yml +++ b/modules/preseq/lcextrap/meta.yml @@ -8,8 +8,8 @@ tools: - preseq: description: Software for predicting library complexity and genome coverage in high-throughput sequencing homepage: http://smithlabresearch.org/software/preseq/ - documentation: None - tool_dev_url: None + documentation: http://smithlabresearch.org/wp-content/uploads/manual.pdf + tool_dev_url: https://github.com/smithlabcode/preseq doi: "" licence: ["GPL"] @@ -34,10 +34,10 @@ output: type: file description: File containing software versions pattern: "versions.yml" - - ccurve: + - lc_extrap: type: file description: File containing output of Preseq lcextrap - pattern: "*.{ccurve.txt}" + pattern: "*.{lc_extrap.txt}" - log: type: file description: Log file containing stderr produced by Preseq @@ -45,3 +45,4 @@ output: authors: - "@drpatelh" + - "@Emiller88" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 78c3fe56..183708dc 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1367,6 +1367,10 @@ porechop: - modules/porechop/** - tests/modules/porechop/** +preseq/ccurve: + - modules/preseq/ccurve/** + - tests/modules/preseq/ccurve/** + preseq/lcextrap: - modules/preseq/lcextrap/** - tests/modules/preseq/lcextrap/** diff --git a/tests/modules/preseq/ccurve/main.nf b/tests/modules/preseq/ccurve/main.nf new file mode 100644 index 00000000..59149563 --- /dev/null +++ b/tests/modules/preseq/ccurve/main.nf @@ -0,0 +1,25 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { PRESEQ_CCURVE } from '../../../../modules/preseq/ccurve/main.nf' + +workflow test_preseq_ccurve_single_end { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + PRESEQ_CCURVE ( input ) +} + +workflow test_preseq_ccurve_paired_end { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + PRESEQ_CCURVE ( input ) +} diff --git a/tests/modules/preseq/ccurve/nextflow.config b/tests/modules/preseq/ccurve/nextflow.config new file mode 100644 index 00000000..8730f1c4 --- /dev/null +++ b/tests/modules/preseq/ccurve/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} diff --git a/tests/modules/preseq/ccurve/test.yml b/tests/modules/preseq/ccurve/test.yml new file mode 100644 index 00000000..c94dc978 --- /dev/null +++ b/tests/modules/preseq/ccurve/test.yml @@ -0,0 +1,19 @@ +- name: preseq ccurve single-end + command: nextflow run ./tests/modules/preseq/ccurve -entry test_preseq_ccurve_single_end -c ./tests/config/nextflow.config -c ./tests/modules/preseq/ccurve/nextflow.config + tags: + - preseq + - preseq/ccurve + files: + - path: output/preseq/test.c_curve.txt + md5sum: cf4743abdd355595d6ec1fb3f38e66e5 + - path: output/preseq/test.command.log + +- name: preseq ccurve paired-end + command: nextflow run ./tests/modules/preseq/ccurve -entry test_preseq_ccurve_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/preseq/ccurve/nextflow.config + tags: + - preseq + - preseq/ccurve + files: + - path: output/preseq/test.c_curve.txt + md5sum: cf4743abdd355595d6ec1fb3f38e66e5 + - path: output/preseq/test.command.log diff --git a/tests/modules/preseq/lcextrap/test.yml b/tests/modules/preseq/lcextrap/test.yml index ecd1d046..f5b5aea4 100644 --- a/tests/modules/preseq/lcextrap/test.yml +++ b/tests/modules/preseq/lcextrap/test.yml @@ -4,7 +4,7 @@ - preseq - preseq/lcextrap files: - - path: output/preseq/test.ccurve.txt + - path: output/preseq/test.lc_extrap.txt md5sum: 1fa5cdd601079329618f61660bee00de - path: output/preseq/test.command.log @@ -14,6 +14,6 @@ - preseq - preseq/lcextrap files: - - path: output/preseq/test.ccurve.txt + - path: output/preseq/test.lc_extrap.txt md5sum: 10e5ea860e87fb6f5dc10f4f20c62040 - path: output/preseq/test.command.log