From 8c8be7d7c6c5b17b89f1c392866fc433b0f79d69 Mon Sep 17 00:00:00 2001 From: FriederikeHanssen Date: Thu, 17 Feb 2022 15:05:21 +0100 Subject: [PATCH] Add gatherpileupsummaries (#1311) * Add gatherpileupsummaries * fix checksum * Update modules/gatk4/gatherpileupsummaries/main.nf * Add in when --- modules/gatk4/gatherpileupsummaries/main.nf | 45 +++++++++++++++++++ modules/gatk4/gatherpileupsummaries/meta.yml | 41 +++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ .../gatk4/gatherpileupsummaries/main.nf | 18 ++++++++ .../gatherpileupsummaries/nextflow.config | 5 +++ .../gatk4/gatherpileupsummaries/test.yml | 8 ++++ 6 files changed, 121 insertions(+) create mode 100644 modules/gatk4/gatherpileupsummaries/main.nf create mode 100644 modules/gatk4/gatherpileupsummaries/meta.yml create mode 100644 tests/modules/gatk4/gatherpileupsummaries/main.nf create mode 100644 tests/modules/gatk4/gatherpileupsummaries/nextflow.config create mode 100644 tests/modules/gatk4/gatherpileupsummaries/test.yml diff --git a/modules/gatk4/gatherpileupsummaries/main.nf b/modules/gatk4/gatherpileupsummaries/main.nf new file mode 100644 index 00000000..52e57127 --- /dev/null +++ b/modules/gatk4/gatherpileupsummaries/main.nf @@ -0,0 +1,45 @@ +process GATK4_GATHERPILEUPSUMMARIES { + 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(pileup) + path dict + + output: + tuple val(meta), path("*.pileupsummaries.table"), emit: table + 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 input = pileup.collect{ "-I ${it} " }.join(' ') + + def avail_mem = 3 + if (!task.memory) { + log.info '[GATK GatherPileupSummaries] 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" \ + GatherPileupSummaries \ + --sequence-dictionary ${dict} \ + ${input} \ + -O ${prefix}.pileupsummaries.table + + 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/gatherpileupsummaries/meta.yml b/modules/gatk4/gatherpileupsummaries/meta.yml new file mode 100644 index 00000000..7885a930 --- /dev/null +++ b/modules/gatk4/gatherpileupsummaries/meta.yml @@ -0,0 +1,41 @@ +name: gatk4_gatherpileupsummaries +description: write your description here +keywords: + - sort +tools: + - gatk4: + description: Genome Analysis Toolkit (GATK4) + homepage: https://gatk.broadinstitute.org/hc/en-us + documentation: https://gatk.broadinstitute.org/hc/en-us + 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 ] + - pileup: + type: (list of) file(s) + description: Pileup files from gatk4/getpileupsummaries + pattern: "*.pileups.table" + +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" + - table: + type: file + description: Pileup file + pattern: "*.pileups.table" + +authors: + - "@FriederikeHanssen" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 1b855da9..3825a873 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -580,6 +580,10 @@ gatk4/gatherbqsrreports: - modules/gatk4/gatherbqsrreports/** - tests/modules/gatk4/gatherbqsrreports/** +gatk4/gatherpileupsummaries: + - modules/gatk4/gatherpileupsummaries/** + - tests/modules/gatk4/gatherpileupsummaries/** + gatk4/genomicsdbimport: - modules/gatk4/genomicsdbimport/** - tests/modules/gatk4/genomicsdbimport/** diff --git a/tests/modules/gatk4/gatherpileupsummaries/main.nf b/tests/modules/gatk4/gatherpileupsummaries/main.nf new file mode 100644 index 00000000..2bd7e98c --- /dev/null +++ b/tests/modules/gatk4/gatherpileupsummaries/main.nf @@ -0,0 +1,18 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { GATK4_GATHERPILEUPSUMMARIES } from '../../../../modules/gatk4/gatherpileupsummaries/main.nf' + +workflow test_gatk4_gatherpileupsummaries { + + input = [ + [ id:'test', single_end:false ], // meta map + [file(params.test_data['homo_sapiens']['illumina']['test_pileups_table'], checkIfExists: true)] + //file(params.test_data['homo_sapiens']['illumina']['test_pileups_table'], checkIfExists: true)] + ] + + dict = file(params.test_data['homo_sapiens']['genome']['genome_21_dict'], checkIfExists: true) + + GATK4_GATHERPILEUPSUMMARIES ( input, dict ) +} diff --git a/tests/modules/gatk4/gatherpileupsummaries/nextflow.config b/tests/modules/gatk4/gatherpileupsummaries/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/gatk4/gatherpileupsummaries/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/gatherpileupsummaries/test.yml b/tests/modules/gatk4/gatherpileupsummaries/test.yml new file mode 100644 index 00000000..0c38a602 --- /dev/null +++ b/tests/modules/gatk4/gatherpileupsummaries/test.yml @@ -0,0 +1,8 @@ +- name: gatk4 gatherpileupsummaries + command: nextflow run ./tests/modules/gatk4/gatherpileupsummaries -entry test_gatk4_gatherpileupsummaries -c ./tests/config/nextflow.config -c ./tests/modules/gatk4/gatherpileupsummaries/nextflow.config + tags: + - gatk4 + - gatk4/gatherpileupsummaries + files: + - path: output/gatk4/test.pileupsummaries.table + md5sum: 8e0ca6f66e112bd2f7ec1d31a2d62469