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
This commit is contained in:
Júlia Mir Pedrol 2022-07-15 10:28:31 +02:00 committed by GitHub
parent edfe28a5e0
commit 9bda3dc7f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 156 additions and 0 deletions

44
modules/pear/main.nf Normal file
View file

@ -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
"""
}

50
modules/pear/meta.yml Normal file
View file

@ -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"

View file

@ -1615,6 +1615,10 @@ pbccs:
- modules/pbccs/** - modules/pbccs/**
- tests/modules/pbccs/** - tests/modules/pbccs/**
pear:
- modules/pear/**
- tests/modules/pear/**
peddy: peddy:
- modules/peddy/** - modules/peddy/**
- tests/modules/peddy/** - tests/modules/peddy/**

View file

@ -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/**

View file

@ -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 )
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -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