Skip to content

Commit

Permalink
Newmodule ngmerge (nf-core#3626)
Browse files Browse the repository at this point in the history
* ngmerge first commit

* main module code

* complete module

* remove trailing whitespace

* fix versions.yml

* fix version yml

* versions yml

* vyml

* try vyml again

* touch versions yml

* vyml
  • Loading branch information
CharlotteAnne authored and limrp committed Jul 28, 2023
1 parent 9f28ebe commit 9a7a2ec
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 0 deletions.
52 changes: 52 additions & 0 deletions modules/nf-core/ngmerge/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
process NGMERGE {
tag "$meta.id"
label 'process_medium'

conda "bioconda::ngmerge=0.3"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ngmerge:0.3--ha92aebf_1':
'biocontainers/ngmerge:0.3--ha92aebf_1' }"

input:
tuple val(meta), path(reads1), path(reads2)

output:
tuple val(meta), path("*.merged.fq.gz"), emit: merged_reads
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}"

"""
NGmerge \\
-1 $reads1 \\
-2 $reads2 \\
-o ${prefix}.merged.fq.gz \\
-z \\
-n $task.cpus \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
NGmerge: \$(echo \$(NGmerge --version 2>&1) | sed 's/^.*NGmerge, version //; s/ Copyright.*// ; s/: //g' ))
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

"""
touch ${prefix}.merged.fq.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":
NGmerge: \$(echo \$(NGmerge --version 2>&1) | sed 's/^.*NGmerge, version //; s/ Copyright.*// ; s/: //g' ))
END_VERSIONS
"""
}
54 changes: 54 additions & 0 deletions modules/nf-core/ngmerge/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: "ngmerge"

description: Merging paired-end reads and removing sequencing adapters.
keywords:
- sort
- reads merging
- merge mate pairs
tools:
- "ngmerge":
description: "Merging paired-end reads and removing sequencing adapters."
homepage: "https://github.com/jsh58/NGmerge"
documentation: "https://github.com/jsh58/NGmerge"
tool_dev_url: "https://github.com/jsh58/NGmerge"
doi: "10.1186/s12859-018-2579-2"
licence: "['MIT']"

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- reads1:
type: file
description: fastq file paired end read 1
pattern: "*.{fa,fasta,fastq,fq,fa.gz,fasta.gz,fastq.gz,fq.gz}"

- reads2:
type: file
description: fastq file paired end read 2
pattern: "*.{fa,fasta,fastq,fq,fa.gz,fasta.gz,fastq.gz,fq.gz}"

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"

- merged_reads:
type: file
description: fastq file paired end read 2
pattern: "*.{fa,fasta,fastq,fq,fa.gz,fasta.gz,fastq.gz,fq.gz}"

authors:
- "@charlotteanne"
- "@jsh58"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2531,6 +2531,10 @@ ngmaster:
- modules/nf-core/ngmaster/**
- tests/modules/nf-core/ngmaster/**

ngmerge:
- modules/nf-core/ngmerge/**
- tests/modules/nf-core/ngmerge/**

ngsbits/samplegender:
- modules/nf-core/ngsbits/samplegender/**
- tests/modules/nf-core/ngsbits/samplegender/**
Expand Down
15 changes: 15 additions & 0 deletions tests/modules/nf-core/ngmerge/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl = 2

include { NGMERGE } from '../../../../modules/nf-core/ngmerge/main.nf'

workflow test_ngmerge {
input = [
[ id:'test', single_end:false ], // 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)]
]

NGMERGE ( input )
}
5 changes: 5 additions & 0 deletions tests/modules/nf-core/ngmerge/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {

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

}
7 changes: 7 additions & 0 deletions tests/modules/nf-core/ngmerge/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- name: ngmerge test_ngmerge
command: nextflow run ./tests/modules/nf-core/ngmerge -entry test_ngmerge -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/ngmerge/nextflow.config
tags:
- ngmerge
files:
- path: output/ngmerge/test.merged.fq.gz
- path: output/ngmerge/versions.yml

0 comments on commit 9a7a2ec

Please sign in to comment.