From ad4f8389cb419a3d23fb4cd4fdbe3b3c77bbc7ad Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Mon, 9 May 2022 08:33:21 +0000 Subject: [PATCH 1/4] Add meryl unionsum --- modules/meryl/unionsum/main.nf | 35 +++++++++++++++++ modules/meryl/unionsum/meta.yml | 40 ++++++++++++++++++++ tests/config/pytest_modules.yml | 12 ++++-- tests/modules/meryl/unionsum/main.nf | 20 ++++++++++ tests/modules/meryl/unionsum/nextflow.config | 6 +++ tests/modules/meryl/unionsum/test.yml | 14 +++++++ 6 files changed, 123 insertions(+), 4 deletions(-) create mode 100644 modules/meryl/unionsum/main.nf create mode 100644 modules/meryl/unionsum/meta.yml create mode 100644 tests/modules/meryl/unionsum/main.nf create mode 100644 tests/modules/meryl/unionsum/nextflow.config create mode 100644 tests/modules/meryl/unionsum/test.yml diff --git a/modules/meryl/unionsum/main.nf b/modules/meryl/unionsum/main.nf new file mode 100644 index 00000000..0d7b80b6 --- /dev/null +++ b/modules/meryl/unionsum/main.nf @@ -0,0 +1,35 @@ +process MERYL_UNIONSUM { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::meryl=1.3" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/meryl:1.3--h87f3376_1': + 'quay.io/biocontainers/meryl:1.3--h87f3376_1' }" + + input: + tuple val(meta), path(meryl_dbs) + + output: + tuple val(meta), path("*.meryldb"), emit: meryl_db + 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}" + """ + meryl union-sum \\ + threads=$task.cpus \\ + $args \\ + output ${prefix}.meryl \\ + $meryl_dbs + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + meryl: \$( meryl --version |& sed 's/meryl //' ) + END_VERSIONS + """ +} diff --git a/modules/meryl/unionsum/meta.yml b/modules/meryl/unionsum/meta.yml new file mode 100644 index 00000000..04dabac1 --- /dev/null +++ b/modules/meryl/unionsum/meta.yml @@ -0,0 +1,40 @@ +name: "meryl_unionsum" +description: A genomic k-mer counter (and sequence utility) with nice features. +keywords: + - k-mer + - unionsum +tools: + - "meryl": + description: "A genomic k-mer counter (and sequence utility) with nice features. " + homepage: "https://github.com/marbl/meryl" + documentation: "https://meryl.readthedocs.io/en/latest/quick-start.html" + tool_dev_url: "https://github.com/marbl/meryl" + doi: "" + licence: "['GPL']" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - meryl_dbs: + type: directory + description: Meryl k-mer databases + +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" + - meryl_db: + type: directory + description: A Meryl k-mer database that is the union sum of the input databases + +authors: + - "@mahesh-panchal" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index b9c67363..1122c060 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1214,6 +1214,10 @@ meningotype: - modules/meningotype/** - tests/modules/meningotype/** +meryl/unionsum: + - modules/meryl/unionsum/** + - tests/modules/meryl/unionsum/** + metabat2/jgisummarizebamcontigdepths: - modules/metabat2/jgisummarizebamcontigdepths/** - tests/modules/metabat2/jgisummarizebamcontigdepths/** @@ -1763,14 +1767,14 @@ slimfastq: - modules/slimfastq/** - tests/modules/slimfastq/** -snapaligner/index: - - modules/snapaligner/index/** - - tests/modules/snapaligner/index/** - snapaligner/align: - modules/snapaligner/align/** - tests/modules/snapaligner/align/** +snapaligner/index: + - modules/snapaligner/index/** + - tests/modules/snapaligner/index/** + snpdists: - modules/snpdists/** - tests/modules/snpdists/** diff --git a/tests/modules/meryl/unionsum/main.nf b/tests/modules/meryl/unionsum/main.nf new file mode 100644 index 00000000..7cffe046 --- /dev/null +++ b/tests/modules/meryl/unionsum/main.nf @@ -0,0 +1,20 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { MERYL_COUNT } from '../../../../modules/meryl/count/main.nf' +include { MERYL_UNIONSUM } from '../../../../modules/meryl/unionsum/main.nf' + +workflow test_meryl_unionsum { + + 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) + ] + ] + + MERYL_COUNT ( input ) + MERYL_UNIONSUM ( MERYL_COUNT.out.meryl_db ) +} diff --git a/tests/modules/meryl/unionsum/nextflow.config b/tests/modules/meryl/unionsum/nextflow.config new file mode 100644 index 00000000..6d899c50 --- /dev/null +++ b/tests/modules/meryl/unionsum/nextflow.config @@ -0,0 +1,6 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + ext.args = 'k=21' + +} diff --git a/tests/modules/meryl/unionsum/test.yml b/tests/modules/meryl/unionsum/test.yml new file mode 100644 index 00000000..f495e946 --- /dev/null +++ b/tests/modules/meryl/unionsum/test.yml @@ -0,0 +1,14 @@ +## TODO nf-core: Please run the following command to build this file: +# nf-core modules create-test-yml meryl/unionsum +- name: "meryl unionsum" + command: nextflow run ./tests/modules/meryl/unionsum -entry test_meryl_unionsum -c ./tests/config/nextflow.config -c ./tests/modules/meryl/unionsum/nextflow.config + tags: + - "meryl" + # + - "meryl/unionsum" + # + files: + - path: "output/meryl/test.bam" + md5sum: e667c7caad0bc4b7ac383fd023c654fc + - path: output/meryl/versions.yml + md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b From 662176855055f6f9698fa4754d01803e6465ff54 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Mon, 9 May 2022 12:54:31 +0000 Subject: [PATCH 2/4] Update pytest outputs --- modules/meryl/unionsum/main.nf | 6 +++--- tests/modules/meryl/unionsum/main.nf | 2 +- tests/modules/meryl/unionsum/test.yml | 16 +++++----------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/modules/meryl/unionsum/main.nf b/modules/meryl/unionsum/main.nf index 0d7b80b6..98baa870 100644 --- a/modules/meryl/unionsum/main.nf +++ b/modules/meryl/unionsum/main.nf @@ -11,8 +11,8 @@ process MERYL_UNIONSUM { tuple val(meta), path(meryl_dbs) output: - tuple val(meta), path("*.meryldb"), emit: meryl_db - path "versions.yml" , emit: versions + tuple val(meta), path("*.unionsum.meryldb"), emit: meryl_db + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -24,7 +24,7 @@ process MERYL_UNIONSUM { meryl union-sum \\ threads=$task.cpus \\ $args \\ - output ${prefix}.meryl \\ + output ${prefix}.unionsum.meryldb \\ $meryl_dbs cat <<-END_VERSIONS > versions.yml diff --git a/tests/modules/meryl/unionsum/main.nf b/tests/modules/meryl/unionsum/main.nf index 7cffe046..e861cceb 100644 --- a/tests/modules/meryl/unionsum/main.nf +++ b/tests/modules/meryl/unionsum/main.nf @@ -8,7 +8,7 @@ include { MERYL_UNIONSUM } from '../../../../modules/meryl/unionsum/main.nf' workflow test_meryl_unionsum { input = [ - [ id:'test' ], // meta map + [ 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) diff --git a/tests/modules/meryl/unionsum/test.yml b/tests/modules/meryl/unionsum/test.yml index f495e946..1ba33a93 100644 --- a/tests/modules/meryl/unionsum/test.yml +++ b/tests/modules/meryl/unionsum/test.yml @@ -1,14 +1,8 @@ -## TODO nf-core: Please run the following command to build this file: -# nf-core modules create-test-yml meryl/unionsum -- name: "meryl unionsum" - command: nextflow run ./tests/modules/meryl/unionsum -entry test_meryl_unionsum -c ./tests/config/nextflow.config -c ./tests/modules/meryl/unionsum/nextflow.config +- name: meryl unionsum test_meryl_unionsum + command: nextflow run tests/modules/meryl/unionsum -entry test_meryl_unionsum -c tests/config/nextflow.config tags: - - "meryl" - # - - "meryl/unionsum" - # + - meryl + - meryl/unionsum files: - - path: "output/meryl/test.bam" - md5sum: e667c7caad0bc4b7ac383fd023c654fc - path: output/meryl/versions.yml - md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b + md5sum: c864aa98f55b9ec7fa1fb2716ec736dd From 57fee2b3d6759c36f2a3e9181ab5f309cf62b6f1 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Mon, 9 May 2022 12:56:22 +0000 Subject: [PATCH 3/4] Add description pattern --- modules/meryl/unionsum/meta.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/meryl/unionsum/meta.yml b/modules/meryl/unionsum/meta.yml index 04dabac1..cea7f0f6 100644 --- a/modules/meryl/unionsum/meta.yml +++ b/modules/meryl/unionsum/meta.yml @@ -35,6 +35,7 @@ output: - meryl_db: type: directory description: A Meryl k-mer database that is the union sum of the input databases + pattern: "*.unionsum.meryldb" authors: - "@mahesh-panchal" From f0f414d5192aaf3fa913608b387a073a5fd58b90 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Mon, 9 May 2022 13:00:10 +0000 Subject: [PATCH 4/4] Update pytests --- tests/modules/meryl/unionsum/main.nf | 13 ++++++++++++- tests/modules/meryl/unionsum/test.yml | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tests/modules/meryl/unionsum/main.nf b/tests/modules/meryl/unionsum/main.nf index e861cceb..6dd40c82 100644 --- a/tests/modules/meryl/unionsum/main.nf +++ b/tests/modules/meryl/unionsum/main.nf @@ -5,7 +5,18 @@ nextflow.enable.dsl = 2 include { MERYL_COUNT } from '../../../../modules/meryl/count/main.nf' include { MERYL_UNIONSUM } from '../../../../modules/meryl/unionsum/main.nf' -workflow test_meryl_unionsum { +workflow test_meryl_unionsum_single_end { + + input = [ + [ id:'test', single_end: true ], // meta map + file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + ] + + MERYL_COUNT ( input ) + MERYL_UNIONSUM ( MERYL_COUNT.out.meryl_db ) +} + +workflow test_meryl_unionsum_paired_end { input = [ [ id:'test', single_end: false ], // meta map diff --git a/tests/modules/meryl/unionsum/test.yml b/tests/modules/meryl/unionsum/test.yml index 1ba33a93..10a1a155 100644 --- a/tests/modules/meryl/unionsum/test.yml +++ b/tests/modules/meryl/unionsum/test.yml @@ -1,8 +1,17 @@ -- name: meryl unionsum test_meryl_unionsum - command: nextflow run tests/modules/meryl/unionsum -entry test_meryl_unionsum -c tests/config/nextflow.config +- name: meryl unionsum test_meryl_unionsum_single_end + command: nextflow run tests/modules/meryl/unionsum -entry test_meryl_unionsum_single_end -c tests/config/nextflow.config tags: - meryl - meryl/unionsum files: - path: output/meryl/versions.yml - md5sum: c864aa98f55b9ec7fa1fb2716ec736dd + md5sum: 7de859c6d3a29d72f6c9c976609d0913 + +- name: meryl unionsum test_meryl_unionsum_paired_end + command: nextflow run tests/modules/meryl/unionsum -entry test_meryl_unionsum_paired_end -c tests/config/nextflow.config + tags: + - meryl + - meryl/unionsum + files: + - path: output/meryl/versions.yml + md5sum: a16decdec014ccb9bdab69a4a1d30818