From 129f57ccd9adc9016aaa3f2e2e6ab556ba8de7b6 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Mon, 9 May 2022 08:50:28 +0000 Subject: [PATCH 1/2] Add meryl histogram --- modules/meryl/histogram/main.nf | 34 +++++++++++++++ modules/meryl/histogram/meta.yml | 41 +++++++++++++++++++ tests/config/pytest_modules.yml | 12 ++++-- tests/modules/meryl/histogram/main.nf | 17 ++++++++ tests/modules/meryl/histogram/nextflow.config | 5 +++ tests/modules/meryl/histogram/test.yml | 14 +++++++ 6 files changed, 119 insertions(+), 4 deletions(-) create mode 100644 modules/meryl/histogram/main.nf create mode 100644 modules/meryl/histogram/meta.yml create mode 100644 tests/modules/meryl/histogram/main.nf create mode 100644 tests/modules/meryl/histogram/nextflow.config create mode 100644 tests/modules/meryl/histogram/test.yml diff --git a/modules/meryl/histogram/main.nf b/modules/meryl/histogram/main.nf new file mode 100644 index 00000000..a1f18f05 --- /dev/null +++ b/modules/meryl/histogram/main.nf @@ -0,0 +1,34 @@ +process MERYL_HISTOGRAM { + 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_db) + + output: + tuple val(meta), path("*.hist"), emit: hist + 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 histogram \\ + threads=$task.cpus \\ + $args \\ + $meryl_db > ${prefix}.hist + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + meryl: \$( meryl --version |& sed 's/meryl //' ) + END_VERSIONS + """ +} diff --git a/modules/meryl/histogram/meta.yml b/modules/meryl/histogram/meta.yml new file mode 100644 index 00000000..b786e076 --- /dev/null +++ b/modules/meryl/histogram/meta.yml @@ -0,0 +1,41 @@ +name: "meryl_histogram" +description: A genomic k-mer counter (and sequence utility) with nice features. +keywords: + - k-mer + - histogram +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 database + +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" + - hist: + type: file + description: Histogram of k-mers + pattern: "*.hist" + +authors: + - "@mahesh-panchal" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index b9c67363..2aa9a20d 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1214,6 +1214,10 @@ meningotype: - modules/meningotype/** - tests/modules/meningotype/** +meryl/histogram: + - modules/meryl/histogram/** + - tests/modules/meryl/histogram/** + 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/histogram/main.nf b/tests/modules/meryl/histogram/main.nf new file mode 100644 index 00000000..697a12ef --- /dev/null +++ b/tests/modules/meryl/histogram/main.nf @@ -0,0 +1,17 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { MERYL_COUNT } from '../../../../modules/meryl/count/main.nf' +include { MERYL_HISTOGRAM } from '../../../../modules/meryl/histogram/main.nf' + +workflow test_meryl_histogram { + + input = [ + [ id:'test' ], // meta map + file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + ] + + MERYL_COUNT ( input ) + MERYL_HISTOGRAM ( MERYL_COUNT.out.meryl_db ) +} diff --git a/tests/modules/meryl/histogram/nextflow.config b/tests/modules/meryl/histogram/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/meryl/histogram/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/meryl/histogram/test.yml b/tests/modules/meryl/histogram/test.yml new file mode 100644 index 00000000..ef358943 --- /dev/null +++ b/tests/modules/meryl/histogram/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/histogram +- name: "meryl histogram" + command: nextflow run ./tests/modules/meryl/histogram -entry test_meryl_histogram -c ./tests/config/nextflow.config -c ./tests/modules/meryl/histogram/nextflow.config + tags: + - "meryl" + # + - "meryl/histogram" + # + files: + - path: "output/meryl/test.bam" + md5sum: e667c7caad0bc4b7ac383fd023c654fc + - path: output/meryl/versions.yml + md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b From da93beaf606a9f4ea7ae335ed3e25afdeac2bc26 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Mon, 9 May 2022 13:50:49 +0000 Subject: [PATCH 2/2] Update pytests --- tests/modules/meryl/histogram/nextflow.config | 5 +++-- tests/modules/meryl/histogram/test.yml | 18 +++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/tests/modules/meryl/histogram/nextflow.config b/tests/modules/meryl/histogram/nextflow.config index 50f50a7a..6d899c50 100644 --- a/tests/modules/meryl/histogram/nextflow.config +++ b/tests/modules/meryl/histogram/nextflow.config @@ -1,5 +1,6 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file + ext.args = 'k=21' + +} diff --git a/tests/modules/meryl/histogram/test.yml b/tests/modules/meryl/histogram/test.yml index ef358943..dce26b65 100644 --- a/tests/modules/meryl/histogram/test.yml +++ b/tests/modules/meryl/histogram/test.yml @@ -1,14 +1,10 @@ -## TODO nf-core: Please run the following command to build this file: -# nf-core modules create-test-yml meryl/histogram -- name: "meryl histogram" - command: nextflow run ./tests/modules/meryl/histogram -entry test_meryl_histogram -c ./tests/config/nextflow.config -c ./tests/modules/meryl/histogram/nextflow.config +- name: meryl histogram test_meryl_histogram + command: nextflow run tests/modules/meryl/histogram -entry test_meryl_histogram -c tests/config/nextflow.config tags: - - "meryl" - # - - "meryl/histogram" - # + - meryl/histogram + - meryl files: - - path: "output/meryl/test.bam" - md5sum: e667c7caad0bc4b7ac383fd023c654fc + - path: output/meryl/test.hist + md5sum: 4bfdc8b287ee0cfd9922bbfa8cd64650 - path: output/meryl/versions.yml - md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b + md5sum: 050038f1b1df79977a393cce1b4b2ddb