From 7633d7816b10d8bd1fb97a748ee1006dd0ea5d09 Mon Sep 17 00:00:00 2001 From: James Fellows Yates Date: Tue, 31 May 2022 20:35:54 +0200 Subject: [PATCH] Add GATK(3)/realignertargetcreator --- modules/gatk/realignertargetcreator/main.nf | 20 +++---- modules/gatk/realignertargetcreator/meta.yml | 57 ++++++++++++------- .../gatk/realignertargetcreator/main.nf | 12 +++- .../gatk/realignertargetcreator/test.yml | 18 ++---- 4 files changed, 60 insertions(+), 47 deletions(-) diff --git a/modules/gatk/realignertargetcreator/main.nf b/modules/gatk/realignertargetcreator/main.nf index 76ac2dd7..e3a03a5f 100644 --- a/modules/gatk/realignertargetcreator/main.nf +++ b/modules/gatk/realignertargetcreator/main.nf @@ -8,13 +8,13 @@ process GATK_REALIGNERTARGETCREATOR { 'quay.io/biocontainers/gatk:3.5--hdfd78af_11' }" input: - tuple val(meta), path(bam) - tuple val(meta), path(reference) - tuple val(meta), path(known_vcf) + tuple val(meta), path(bam), path(bai) + tuple path(fasta), path(fasta_fai), path(fasta_dict) + path(known_vcf) output: - tuple val(meta), path("*.bam"), emit: bam - path "versions.yml" , emit: versions + tuple val(meta), path("*.intervals"), emit: intervals + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -22,16 +22,16 @@ process GATK_REALIGNERTARGETCREATOR { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def known = known_vcf ? "-known ${known_vcf}" ? "" + def known = known_vcf ? "-known ${known_vcf}" : "" if ("$bam" == "${prefix}.bam") error "Input and output names are the same, set prefix in module configuration to disambiguate!" """ gatk3 \\ - -T RealigerTargetCreator \\ - -nt ${task.cpus} + -T RealignerTargetCreator \\ + -nt ${task.cpus} \\ -I ${bam} \\ - -R ${reference} \\ - -o ${prefix}.bam \\ + -R ${fasta} \\ + -o ${prefix}.intervals \\ ${known} \\ $args diff --git a/modules/gatk/realignertargetcreator/meta.yml b/modules/gatk/realignertargetcreator/meta.yml index a33db8f1..70df7b78 100644 --- a/modules/gatk/realignertargetcreator/meta.yml +++ b/modules/gatk/realignertargetcreator/meta.yml @@ -1,51 +1,64 @@ name: "gatk_realignertargetcreator" -## TODO nf-core: Add a description of the module and list keywords -description: write your description here +description: Generates a list of locations that should be considered for local realignment prior genotyping. keywords: - - sort + - bam + - vcf + - variant calling + - indel + - realignment + - targets tools: - "gatk": - ## TODO nf-core: Add a description and other details for the software below description: "The full Genome Analysis Toolkit (GATK) framework, license restricted." - homepage: "None" - documentation: "None" - tool_dev_url: "None" - doi: "" - licence: "['https://software.broadinstitute.org/gatk/download/licensing', 'https://www.broadinstitute.org/gatk/about/#licensing', 'BSD']" + homepage: "https://gatk.broadinstitute.org/hc/en-us" + documentation: "https://github.com/broadinstitute/gatk-docs" + licence: "['https://software.broadinstitute.org/gatk/download/licensing', 'BSD', 'https://www.broadinstitute.org/gatk/about/#licensing']" -## 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}" + description: Sorted and indexed BAM/CRAM/SAM file + pattern: "*.bam" + - bai: + type: file + description: BAM index file + pattern: "*.bai" + - fasta: + type: file + description: Reference file used to generate BAM file + pattern: ".{fasta,fa,fna}" + - fasta_fai: + type: file + description: Index of reference file used to generate BAM file + pattern: ".fai" + - dict: + type: file + description: GATK dict file for reference + pattern: ".dict" + - known_vcf: + type: file + description: Optional input VCF file(s) with known indels + pattern: ".vcf" -## 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: + - intervals: type: file - description: Sorted BAM/CRAM/SAM file - pattern: "*.{bam,cram,sam}" + description: File containg intervals that represent sites of extant and potential indels. + pattern: "*.intervals" authors: - "@jfy133" diff --git a/tests/modules/gatk/realignertargetcreator/main.nf b/tests/modules/gatk/realignertargetcreator/main.nf index 63908069..02e62d93 100644 --- a/tests/modules/gatk/realignertargetcreator/main.nf +++ b/tests/modules/gatk/realignertargetcreator/main.nf @@ -5,11 +5,17 @@ nextflow.enable.dsl = 2 include { GATK_REALIGNERTARGETCREATOR } from '../../../../modules/gatk/realignertargetcreator/main.nf' workflow test_gatk_realignertargetcreator { - + input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) + ] + reference = [ + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true), + file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true), + file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true), ] - GATK_REALIGNERTARGETCREATOR ( input ) + GATK_REALIGNERTARGETCREATOR ( input, reference, [] ) } diff --git a/tests/modules/gatk/realignertargetcreator/test.yml b/tests/modules/gatk/realignertargetcreator/test.yml index a45fbb93..0e247013 100644 --- a/tests/modules/gatk/realignertargetcreator/test.yml +++ b/tests/modules/gatk/realignertargetcreator/test.yml @@ -1,14 +1,8 @@ -## TODO nf-core: Please run the following command to build this file: -# nf-core modules create-test-yml gatk/realignertargetcreator -- name: "gatk realignertargetcreator" - command: nextflow run ./tests/modules/gatk/realignertargetcreator -entry test_gatk_realignertargetcreator -c ./tests/config/nextflow.config -c ./tests/modules/gatk/realignertargetcreator/nextflow.config +- name: gatk realignertargetcreator test_gatk_realignertargetcreator + command: nextflow run ./tests/modules/gatk/realignertargetcreator -entry test_gatk_realignertargetcreator -c ./tests/config/nextflow.config -c ./tests/modules/gatk/realignertargetcreator/nextflow.config tags: - - "gatk" - # - - "gatk/realignertargetcreator" - # + - gatk + - gatk/realignertargetcreator files: - - path: "output/gatk/test.bam" - md5sum: e667c7caad0bc4b7ac383fd023c654fc - - path: output/gatk/versions.yml - md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b + - path: output/gatk/test.intervals + md5sum: 7aa7a1b235a510e6591e262382086bf8