diff --git a/modules/gatk4/filtervarianttranches/main.nf b/modules/gatk4/filtervarianttranches/main.nf new file mode 100644 index 00000000..d77fb29f --- /dev/null +++ b/modules/gatk4/filtervarianttranches/main.nf @@ -0,0 +1,49 @@ +process GATK4_FILTERVARIANTTRANCHES { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0': + 'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }" + + input: + tuple val(meta), path(vcf), path(intervals) + path ressources + path fasta + path fai + path dict + + + output: + tuple val(meta), path("*.bam"), emit: bam + 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 ressources = ressources.collect{"--ressources $it"}.join(' ') + def avail_mem = 3 + if (!task.memory) { + log.info '[GATK FilterVariantTranches] 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" FilterVariantTranches \\ + --variant $vcf \\ + $ressources \\ + --output ${prefix}.filtered.vcf.gz \\ + --tmp-dir . \\ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gatk4: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' )) + END_VERSIONS + """ +} diff --git a/modules/gatk4/filtervarianttranches/meta.yml b/modules/gatk4/filtervarianttranches/meta.yml new file mode 100644 index 00000000..e260a649 --- /dev/null +++ b/modules/gatk4/filtervarianttranches/meta.yml @@ -0,0 +1,51 @@ +name: "gatk4_filtervarianttranches" +## TODO nf-core: Add a description of the module and list keywords +description: write your description here +keywords: + - sort +tools: + - "gatk4": + ## TODO nf-core: Add a description and other details for the software below + description: "Genome Analysis Toolkit (GATK4)" + homepage: "None" + documentation: "None" + tool_dev_url: "https://github.com/broadinstitute/gatk" + doi: "" + licence: "['BSD-3-clause']" + +## TODO nf-core: Add a description of all of the variables used as input +input: + # Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + # + ## TODO nf-core: Delete / customise this example input + - bam: + type: file + description: BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + +## TODO nf-core: Add a description of all of the variables used as output +output: + #Only when we have meta + - 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" + ## TODO nf-core: Delete / customise this example output + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + +authors: + - "@FriederikeHanssen" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 3970c113..81dbf3c3 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -755,6 +755,10 @@ gatk4/filtermutectcalls: - modules/gatk4/filtermutectcalls/** - tests/modules/gatk4/filtermutectcalls/** +gatk4/filtervarianttranches: + - modules/gatk4/filtervarianttranches/** + - tests/modules/gatk4/filtervarianttranches/** + gatk4/gatherbqsrreports: - modules/gatk4/gatherbqsrreports/** - tests/modules/gatk4/gatherbqsrreports/** diff --git a/tests/modules/gatk4/filtervarianttranches/main.nf b/tests/modules/gatk4/filtervarianttranches/main.nf new file mode 100644 index 00000000..35cc5a6b --- /dev/null +++ b/tests/modules/gatk4/filtervarianttranches/main.nf @@ -0,0 +1,15 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { GATK4_FILTERVARIANTTRANCHES } from '../../../../modules/gatk4/filtervarianttranches/main.nf' + +workflow test_gatk4_filtervarianttranches { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + GATK4_FILTERVARIANTTRANCHES ( input ) +} diff --git a/tests/modules/gatk4/filtervarianttranches/nextflow.config b/tests/modules/gatk4/filtervarianttranches/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/gatk4/filtervarianttranches/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/filtervarianttranches/test.yml b/tests/modules/gatk4/filtervarianttranches/test.yml new file mode 100644 index 00000000..1ba2657e --- /dev/null +++ b/tests/modules/gatk4/filtervarianttranches/test.yml @@ -0,0 +1,14 @@ +## TODO nf-core: Please run the following command to build this file: +# nf-core modules create-test-yml gatk4/filtervarianttranches +- name: "gatk4 filtervarianttranches" + command: nextflow run ./tests/modules/gatk4/filtervarianttranches -entry test_gatk4_filtervarianttranches -c ./tests/config/nextflow.config -c ./tests/modules/gatk4/filtervarianttranches/nextflow.config + tags: + - "gatk4" + # + - "gatk4/filtervarianttranches" + # + files: + - path: "output/gatk4/test.bam" + md5sum: e667c7caad0bc4b7ac383fd023c654fc + - path: output/gatk4/versions.yml + md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b