From a9dd46f010e3974f00616606e209db8d81587c64 Mon Sep 17 00:00:00 2001 From: FriederikeHanssen Date: Wed, 8 Dec 2021 23:43:36 +0100 Subject: [PATCH] add gatk4/gatherbqsr (#1130) * nf-core modules create * add module files * indent * remove templte code * manually revert pytest changes from tools * manually revert pytest changes from tools * add include statement back in Co-authored-by: Maxime U. Garcia --- modules/gatk4/gatherbqsrreports/main.nf | 41 ++++++++++++++++++ modules/gatk4/gatherbqsrreports/meta.yml | 43 +++++++++++++++++++ tests/config/pytest_modules.yml | 28 ++++++------ tests/modules/gatk4/gatherbqsrreports/main.nf | 27 ++++++++++++ .../gatk4/gatherbqsrreports/nextflow.config | 5 +++ .../modules/gatk4/gatherbqsrreports/test.yml | 21 +++++++++ 6 files changed, 153 insertions(+), 12 deletions(-) create mode 100644 modules/gatk4/gatherbqsrreports/main.nf create mode 100644 modules/gatk4/gatherbqsrreports/meta.yml create mode 100644 tests/modules/gatk4/gatherbqsrreports/main.nf create mode 100644 tests/modules/gatk4/gatherbqsrreports/nextflow.config create mode 100644 tests/modules/gatk4/gatherbqsrreports/test.yml diff --git a/modules/gatk4/gatherbqsrreports/main.nf b/modules/gatk4/gatherbqsrreports/main.nf new file mode 100644 index 00000000..1567f9aa --- /dev/null +++ b/modules/gatk4/gatherbqsrreports/main.nf @@ -0,0 +1,41 @@ +process GATK4_GATHERBQSRREPORTS { + tag "$meta.id" + label 'process_medium' + + conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_1': + 'quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_1' }" + + input: + tuple val(meta), path(recal_table) + + output: + tuple val(meta), path("*.table"), emit: table + path "versions.yml" , emit: versions + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def input = recal_table.collect{"-I ${it}"}.join(' ') + + def avail_mem = 3 + if (!task.memory) { + log.info '[GATK GatherBQSRReports] 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" \\ + GatherBQSRReports \ + ${input} \ + --tmp-dir . \ + $args \ + --output ${prefix}.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/gatherbqsrreports/meta.yml b/modules/gatk4/gatherbqsrreports/meta.yml new file mode 100644 index 00000000..f71afd69 --- /dev/null +++ b/modules/gatk4/gatherbqsrreports/meta.yml @@ -0,0 +1,43 @@ +name: gatk4_gatherbqsrreports +description: write your description here +keywords: + - gatk4 + - gatk4_gatherbqsrreports + - base_recalibration +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 ] + - recal_table: + type: file + description: File(s) containing BQSR table(s) + pattern: "*.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" + - recal_table: + type: file + description: File containing joined BQSR table + pattern: "*.table" + +authors: + - "@FriederikeHanssen" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index e35f8908..6dbfc1fd 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -314,26 +314,26 @@ cnvkit/batch: - modules/cnvkit/batch/** - tests/modules/cnvkit/batch/** -cooler/digest: - - modules/cooler/digest/** - - tests/modules/cooler/digest/** - cooler/cload: - modules/cooler/cload/** - tests/modules/cooler/cload/** +cooler/digest: + - modules/cooler/digest/** + - tests/modules/cooler/digest/** + cooler/dump: - modules/cooler/dump/** - tests/modules/cooler/dump/** -cooler/zoomify: - - modules/cooler/zoomify/** - - tests/software/cooler/zoomify/** - cooler/merge: - modules/cooler/merge/** - tests/modules/cooler/merge/** +cooler/zoomify: + - modules/cooler/zoomify/** + - tests/software/cooler/zoomify/** + csvtk/concat: - modules/csvtk/concat/** - tests/modules/csvtk/concat/** @@ -538,6 +538,10 @@ gatk4/filtermutectcalls: #&gatk4_filtermutectcalls - modules/gatk4/filtermutectcalls/** - tests/modules/gatk4/filtermutectcalls/** +gatk4/gatherbqsrreports: + - modules/gatk4/gatherbqsrreports/** + - tests/modules/gatk4/gatherbqsrreports/** + gatk4/genomicsdbimport: #&gatk4_genomicsdbimport - modules/gatk4/genomicsdbimport/** - tests/modules/gatk4/genomicsdbimport/** @@ -1035,6 +1039,10 @@ pbccs: - modules/pbccs/** - tests/modules/pbccs/** +peddy: + - modules/peddy/** + - tests/modules/peddy/** + phyloflash: - modules/phyloflash/** - tests/modules/phyloflash/** @@ -1043,10 +1051,6 @@ picard/collecthsmetrics: - modules/picard/collecthsmetrics/** - tests/modules/picard/collecthsmetrics/** -peddy: - - modules/peddy/** - - tests/modules/peddy/** - picard/collectmultiplemetrics: - modules/picard/collectmultiplemetrics/** - tests/modules/picard/collectmultiplemetrics/** diff --git a/tests/modules/gatk4/gatherbqsrreports/main.nf b/tests/modules/gatk4/gatherbqsrreports/main.nf new file mode 100644 index 00000000..2693a06a --- /dev/null +++ b/tests/modules/gatk4/gatherbqsrreports/main.nf @@ -0,0 +1,27 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { GATK4_GATHERBQSRREPORTS } from '../../../../modules/gatk4/gatherbqsrreports/main.nf' + +workflow test_gatk4_gatherbqsrreports { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_baserecalibrator_table'], checkIfExists: true) + ] + + GATK4_GATHERBQSRREPORTS ( input ) +} + +workflow test_gatk4_gatherbqsrreports_multiple { + + input = [ + [ id:'test', single_end:false ], // meta map + [file(params.test_data['homo_sapiens']['illumina']['test_baserecalibrator_table'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_baserecalibrator_table'], checkIfExists: true) + ] + ] + + GATK4_GATHERBQSRREPORTS ( input ) +} diff --git a/tests/modules/gatk4/gatherbqsrreports/nextflow.config b/tests/modules/gatk4/gatherbqsrreports/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/gatk4/gatherbqsrreports/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/gatherbqsrreports/test.yml b/tests/modules/gatk4/gatherbqsrreports/test.yml new file mode 100644 index 00000000..76c90120 --- /dev/null +++ b/tests/modules/gatk4/gatherbqsrreports/test.yml @@ -0,0 +1,21 @@ +- name: gatk4 gatherbqsrreports test_gatk4_gatherbqsrreports + command: nextflow run tests/modules/gatk4/gatherbqsrreports -entry test_gatk4_gatherbqsrreports -c tests/config/nextflow.config + tags: + - gatk4 + - gatk4/gatherbqsrreports + files: + - path: output/gatk4/test.table + md5sum: 9603b69fdc3b5090de2e0dd78bfcc4bf + - path: output/gatk4/versions.yml + md5sum: 50238fd0f3b6f4efb2b5335b6324f905 + +- name: gatk4 gatherbqsrreports test_gatk4_gatherbqsrreports_multiple + command: nextflow run tests/modules/gatk4/gatherbqsrreports -entry test_gatk4_gatherbqsrreports_multiple -c tests/config/nextflow.config + tags: + - gatk4 + - gatk4/gatherbqsrreports + files: + - path: output/gatk4/test.table + md5sum: 0c1257eececf95db8ca378272d0f21f9 + - path: output/gatk4/versions.yml + md5sum: c6ce163062dd3609848fc5bc10660427