From 9bda3dc7f0dd1c0607eeb134fb6e4c9f2d1c5ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Mir=20Pedrol?= Date: Fri, 15 Jul 2022 10:28:31 +0200 Subject: [PATCH] Add new module: Pear (#1779) * create pear module * add command and tests * remove md5sum from known empty file * add force -f to gzip and gunzip to avoid problems with symbolic links * apply suggestions from review --- modules/pear/main.nf | 44 ++++++++++++++++++++++++ modules/pear/meta.yml | 50 ++++++++++++++++++++++++++++ tests/config/pytest_modules.yml | 4 +++ tests/config/pytest_modules_test.yml | 23 +++++++++++++ tests/modules/pear/main.nf | 18 ++++++++++ tests/modules/pear/nextflow.config | 5 +++ tests/modules/pear/test.yml | 12 +++++++ 7 files changed, 156 insertions(+) create mode 100644 modules/pear/main.nf create mode 100644 modules/pear/meta.yml create mode 100644 tests/config/pytest_modules_test.yml create mode 100644 tests/modules/pear/main.nf create mode 100644 tests/modules/pear/nextflow.config create mode 100644 tests/modules/pear/test.yml diff --git a/modules/pear/main.nf b/modules/pear/main.nf new file mode 100644 index 00000000..7569d611 --- /dev/null +++ b/modules/pear/main.nf @@ -0,0 +1,44 @@ +process PEAR { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::pear=0.9.6" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/pear:0.9.6--h67092d7_8': + 'quay.io/biocontainers/pear:0.9.6--h67092d7_8' }" + + input: + tuple val(meta), path(reads) + + output: + tuple val(meta), path("*.assembled.fastq.gz") , emit: assembled + tuple val(meta), path("*.unassembled.forward.fastq.gz"), path("*.unassembled.reverse.fastq.gz"), emit: unassembled + tuple val(meta), path("*.discarded.fastq.gz") , emit: discarded + 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}" + """ + gunzip -f ${reads[0]} + gunzip -f ${reads[1]} + pear \\ + -f ${reads[0].baseName} \\ + -r ${reads[1].baseName} \\ + -o $prefix \\ + -j $task.cpus \\ + $args + gzip -f ${prefix}.assembled.fastq + gzip -f ${prefix}.unassembled.forward.fastq + gzip -f ${prefix}.unassembled.reverse.fastq + gzip -f ${prefix}.discarded.fastq + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pear: \$(pear -h | grep 'PEAR v' | sed 's/PEAR v//' | sed 's/ .*//' )) + END_VERSIONS + """ +} diff --git a/modules/pear/meta.yml b/modules/pear/meta.yml new file mode 100644 index 00000000..44792835 --- /dev/null +++ b/modules/pear/meta.yml @@ -0,0 +1,50 @@ +name: "pear" +description: PEAR is an ultrafast, memory-efficient and highly accurate pair-end read merger. +keywords: + - pair-end + - read +tools: + - "pear": + description: "paired-end read merger" + homepage: "{https://cme.h-its.org/exelixis/web/software/pear/}" + documentation: "{https://cme.h-its.org/exelixis/web/software/pear/doc.html}" + tool_dev_url: "{}" + doi: "" + licence: "['Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported']" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test' ] + - reads: + type: file + description: | + List of input FastQ files with paired-end reads forward and reverse. + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test' ] + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - assembled: + type: file + description: FastQ file containing Assembled reads. + pattern: "*.{fastq.gz}" + - unassembled: + type: file + description: FastQ files containing Unassembled forward and reverse reads. + pattern: "*.{fastq.gz}" + - discarded: + type: file + description: FastQ file containing discarded reads. + pattern: "*.{fastq.gz}" + +authors: + - "@mirpedrol" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index d0a4e20e..5eca74a7 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1615,6 +1615,10 @@ pbccs: - modules/pbccs/** - tests/modules/pbccs/** +pear: + - modules/pear/** + - tests/modules/pear/** + peddy: - modules/peddy/** - tests/modules/peddy/** diff --git a/tests/config/pytest_modules_test.yml b/tests/config/pytest_modules_test.yml new file mode 100644 index 00000000..eba3c1cc --- /dev/null +++ b/tests/config/pytest_modules_test.yml @@ -0,0 +1,23 @@ +abacas: + - modules/abacas/** + - tests/modules/abacas/** + +kallisto/index: + - modules/kallisto/index/** + - tests/modules/kallisto/index/** + +kallistobustools/count: + - modules/kallistobustools/count/** + - tests/modules/kallistobustools/count/** + +kallistobustools/ref: + - modules/kallistobustools/ref/** + - tests/modules/kallistobustools/ref/** + +kat/hist: + - modules/kat/hist/** + - tests/modules/kat/hist/** + +spades: + - modules/spades/** + - tests/modules/spades/** diff --git a/tests/modules/pear/main.nf b/tests/modules/pear/main.nf new file mode 100644 index 00000000..3646740d --- /dev/null +++ b/tests/modules/pear/main.nf @@ -0,0 +1,18 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { PEAR } from '../../../modules/pear/main.nf' + +workflow test_pear { + + input = [ + [ id:'test' ], // meta map + [ + file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) + ] + ] + + PEAR ( input ) +} diff --git a/tests/modules/pear/nextflow.config b/tests/modules/pear/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/pear/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/tests/modules/pear/test.yml b/tests/modules/pear/test.yml new file mode 100644 index 00000000..6e77e6e5 --- /dev/null +++ b/tests/modules/pear/test.yml @@ -0,0 +1,12 @@ +- name: pear test_pear + command: nextflow run ./tests/modules/pear -entry test_pear -c ./tests/config/nextflow.config -c ./tests/modules/pear/nextflow.config + tags: + - pear + files: + - path: output/pear/test.assembled.fastq.gz + md5sum: d02799ee04909655e7be5c9161c876b2 + - path: output/pear/test.discarded.fastq.gz # Known empty file + - path: output/pear/test.unassembled.forward.fastq.gz + md5sum: 2e35f09a6abbb4559127c512f5652e7e + - path: output/pear/test.unassembled.reverse.fastq.gz + md5sum: 6e1c73c502230869c21b03a41faddafb