diff --git a/modules/gatk4/mergemutectstats/main.nf b/modules/gatk4/mergemutectstats/main.nf new file mode 100644 index 00000000..bb9f91fb --- /dev/null +++ b/modules/gatk4/mergemutectstats/main.nf @@ -0,0 +1,41 @@ +process GATK4_MERGEMUTECTSTATS { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::gatk4=4.2.5.0" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.5.0--hdfd78af_0' : + 'quay.io/biocontainers/gatk4:4.2.5.0--hdfd78af_0' }" + + input: + tuple val(meta), path(stats) + output: + tuple val(meta), path("*.vcf.gz.stats"), emit: stats + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + def input = stats.collect{ " -stats ${it} "}.join() + + def avail_mem = 3 + if (!task.memory) { + log.info '[GATK MergeMutectStats] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.' + } else { + avail_mem = task.memory.giga + } + """ + gatk --java-options "-Xmx${avail_mem}g" MergeMutectStats \\ + ${input} \\ + -output ${meta.id}.vcf.gz.stats \\ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//') + END_VERSIONS + """ +} diff --git a/modules/gatk4/mergemutectstats/meta.yml b/modules/gatk4/mergemutectstats/meta.yml new file mode 100644 index 00000000..c9950e14 --- /dev/null +++ b/modules/gatk4/mergemutectstats/meta.yml @@ -0,0 +1,42 @@ +name: gatk4_mergemutectstats +description: Merges mutect2 stats generated on different intervals/regions +keywords: + - mutectstats + - merge +tools: + - gatk4: + description: Genome Analysis Toolkit (GATK4) + homepage: https://gatk.broadinstitute.org/hc/en-us + documentation: https://gatk.broadinstitute.org/hc/en-us/categories/360002369672s + tool_dev_url: https://github.com/broadinstitute/gatk + doi: "10.1158/1538-7445.AM2017-3590" + licence: ["BSD-3-clause"] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - stats: + type: (list of) file(s) + description: Stats file + pattern: "*.{stats}" + +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" + - stats: + type: file + description: Stats file + pattern: "*.vcf.gz.stats" + +authors: + - "@FriederikeHanssen" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index d9fa981e..317207e8 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -628,6 +628,10 @@ gatk4/mergebamalignment: - modules/gatk4/mergebamalignment/** - tests/modules/gatk4/mergebamalignment/** +gatk4/mergemutectstats: + - modules/gatk4/mergemutectstats/** + - tests/modules/gatk4/mergemutectstats/** + gatk4/mergevcfs: - modules/gatk4/mergevcfs/** - tests/modules/gatk4/mergevcfs/** diff --git a/tests/modules/gatk4/mergemutectstats/main.nf b/tests/modules/gatk4/mergemutectstats/main.nf new file mode 100644 index 00000000..bf65a6a6 --- /dev/null +++ b/tests/modules/gatk4/mergemutectstats/main.nf @@ -0,0 +1,15 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { GATK4_MERGEMUTECTSTATS } from '../../../../modules/gatk4/mergemutectstats/main.nf' + +workflow test_gatk4_mergemutectstats { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_test2_paired_mutect2_calls_vcf_gz_stats'], checkIfExists: true) + ] + + GATK4_MERGEMUTECTSTATS ( input ) +} diff --git a/tests/modules/gatk4/mergemutectstats/nextflow.config b/tests/modules/gatk4/mergemutectstats/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/gatk4/mergemutectstats/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/gatk4/mergemutectstats/test.yml b/tests/modules/gatk4/mergemutectstats/test.yml new file mode 100644 index 00000000..44d1c5f2 --- /dev/null +++ b/tests/modules/gatk4/mergemutectstats/test.yml @@ -0,0 +1,8 @@ +- name: gatk4 mergemutectstats + command: nextflow run ./tests/modules/gatk4/mergemutectstats -entry test_gatk4_mergemutectstats -c ./tests/config/nextflow.config -c ./tests/modules/gatk4/mergemutectstats/nextflow.config + tags: + - gatk4 + - gatk4/mergemutectstats + files: + - path: output/gatk4/test.vcf.gz.stats + md5sum: 17d2091015d04cbd4a26b7a67dc659e6