diff --git a/modules/merquryfk/ploidyplot/main.nf b/modules/merquryfk/ploidyplot/main.nf new file mode 100644 index 00000000..99a54e34 --- /dev/null +++ b/modules/merquryfk/ploidyplot/main.nf @@ -0,0 +1,44 @@ +process MERQURYFK_PLOIDYPLOT { + tag "$meta.id" + label 'process_medium' + + if (params.enable_conda) { + error "Conda environments cannot be used when using the FastK tool. Please use docker or singularity containers." + } + container 'ghcr.io/nbisweden/fastk_genescopefk_merquryfk:1.0' + + input: + tuple val(meta), path(fastk_hist), path(fastk_ktab) + + output: + tuple val(meta), path("*.fi.png"), emit: filled_plodiy_plot_png , optional: true + tuple val(meta), path("*.fi.pdf"), emit: filled_plodiy_plot_pdf , optional: true + tuple val(meta), path("*.ln.png"), emit: line_plodiy_plot_png , optional: true + tuple val(meta), path("*.ln.pdf"), emit: line_plodiy_plot_pdf , optional: true + tuple val(meta), path("*.st.png"), emit: stacked_plodiy_plot_png, optional: true + tuple val(meta), path("*.st.pdf"), emit: stacked_plodiy_plot_pdf, optional: true + 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}" + def FASTK_VERSION = 'f18a4e6d2207539f7b84461daebc54530a9559b0' + def MERQURY_VERSION = '8f3ab706e4cf4d7b7d1dfe5739859e3ebd26c494' + """ + PloidyPlot \\ + $args \\ + -T$task.cpus \\ + -o$prefix \\ + ${fastk_ktab.find{ it.toString().endsWith(".ktab") }} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fastk: $FASTK_VERSION + merquryfk: $MERQURY_VERSION + r: \$( R --version | sed '1!d; s/.*version //; s/ .*//' ) + END_VERSIONS + """ +} diff --git a/modules/merquryfk/ploidyplot/meta.yml b/modules/merquryfk/ploidyplot/meta.yml new file mode 100644 index 00000000..68956b14 --- /dev/null +++ b/modules/merquryfk/ploidyplot/meta.yml @@ -0,0 +1,67 @@ +name: "merquryfk_ploidyplot" +description: An improved version of Smudgeplot using FastK +keywords: + - kmer + - smudgeplot + - ploidy +tools: + - "merquryfk": + description: "FastK based version of Merqury" + homepage: "https://github.com/thegenemyers/MERQURY.FK" + documentation: "" + tool_dev_url: "https://github.com/thegenemyers/MERQURY.FK" + doi: "" + licence: "https://github.com/thegenemyers/MERQURY.FK/blob/main/LICENSE" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fastk_hist: + type: file + description: A histogram files from the program FastK + pattern: "*.hist" + - fastk_ktab: + type: file + description: ktab files from the program FastK + pattern: "*.ktab*" + +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" + - filled_ploidy_plot_png: + type: file + description: A filled ploidy plot in PNG format + pattern: "*.fi.png" + - filled_ploidy_plot_pdf: + type: file + description: A filled ploidy plot in PDF format + pattern: "*.fi.pdf" + - line_ploidy_plot_png: + type: file + description: A line ploidy plot in PNG format + pattern: "*.ln.png" + - line_ploidy_plot_pdf: + type: file + description: A lin4 ploidy plot in PDF format + pattern: "*.ln.pdf" + - stacked_ploidy_plot_png: + type: file + description: A stacked ploidy plot in PNG format + pattern: "*.st.png" + - stacked_ploidy_plot_pdf: + type: file + description: A stacked ploidy plot in PDF format + pattern: "*.st.pdf" + +authors: + - "@mahesh-panchal" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 8906795f..21501108 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1338,6 +1338,10 @@ merquryfk/merquryfk: - modules/merquryfk/merquryfk/** - tests/modules/merquryfk/merquryfk/** +merquryfk/ploidyplot: + - modules/merquryfk/ploidyplot/** + - tests/modules/merquryfk/ploidyplot/** + meryl/count: - modules/meryl/count/** - tests/modules/meryl/count/** diff --git a/tests/modules/merquryfk/ploidyplot/main.nf b/tests/modules/merquryfk/ploidyplot/main.nf new file mode 100644 index 00000000..df582b98 --- /dev/null +++ b/tests/modules/merquryfk/ploidyplot/main.nf @@ -0,0 +1,33 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { FASTK_FASTK } from '../../../../modules/fastk/fastk/main.nf' +include { MERQURYFK_PLOIDYPLOT } from '../../../../modules/merquryfk/ploidyplot/main.nf' + +workflow test_merquryfk_ploidyplot_png { + + input = [ + [ id:'test', single_end:true ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_1_fastq_gz'], checkIfExists: true) + ] + + FASTK_FASTK ( input ) + MERQURYFK_PLOIDYPLOT ( FASTK_FASTK.out.hist + .join( FASTK_FASTK.out.ktab ) + ) +} + +workflow test_merquryfk_ploidyplot_pdf { + + input = [ + [ id:'test', single_end:true ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_1_fastq_gz'], checkIfExists: true) + ] + + FASTK_FASTK ( input ) + MERQURYFK_PLOIDYPLOT ( + FASTK_FASTK.out.hist + .join( FASTK_FASTK.out.ktab ) + ) +} diff --git a/tests/modules/merquryfk/ploidyplot/nextflow.config b/tests/modules/merquryfk/ploidyplot/nextflow.config new file mode 100644 index 00000000..64737e06 --- /dev/null +++ b/tests/modules/merquryfk/ploidyplot/nextflow.config @@ -0,0 +1,13 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: 'FASTK_.*' { + ext.args = '-t' + publishDir = [ enabled: false ] + } + withName: 'test_merquryfk_ploidyplot_pdf:MERQURYFK_PLOIDYPLOT' { + ext.args = '-pdf' + } + +} diff --git a/tests/modules/merquryfk/ploidyplot/test.yml b/tests/modules/merquryfk/ploidyplot/test.yml new file mode 100644 index 00000000..5189f53d --- /dev/null +++ b/tests/modules/merquryfk/ploidyplot/test.yml @@ -0,0 +1,22 @@ +- name: merquryfk ploidyplot test_merquryfk_ploidyplot_png + command: nextflow run ./tests/modules/merquryfk/ploidyplot -entry test_merquryfk_ploidyplot_png -c ./tests/config/nextflow.config -c ./tests/modules/merquryfk/ploidyplot/nextflow.config + tags: + - merquryfk + - merquryfk/ploidyplot + files: + - path: output/merquryfk/test.fi.png + md5sum: c6f883f3d57ad64727219052e97d39b3 + - path: output/merquryfk/test.ln.png + md5sum: bd299e2eceb258328d1a41c024d7fbf4 + - path: output/merquryfk/test.st.png + md5sum: 4f858ed9712196606859675c3f3ba7a9 + +- name: merquryfk ploidyplot test_merquryfk_ploidyplot_pdf + command: nextflow run ./tests/modules/merquryfk/ploidyplot -entry test_merquryfk_ploidyplot_pdf -c ./tests/config/nextflow.config -c ./tests/modules/merquryfk/ploidyplot/nextflow.config + tags: + - merquryfk + - merquryfk/ploidyplot + files: + - path: output/merquryfk/test.fi.pdf + - path: output/merquryfk/test.ln.pdf + - path: output/merquryfk/test.st.pdf