Add gatk/indelrealigner

This commit is contained in:
James Fellows Yates 2022-05-30 21:12:21 +02:00
parent 3bb32b2def
commit 7ffe98ac8b
6 changed files with 152 additions and 0 deletions

View file

@ -0,0 +1,43 @@
process GATK_INDELREALIGNER {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::gatk=3.5" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/gatk:3.5--hdfd78af_11':
'quay.io/biocontainers/gatk:3.5--hdfd78af_11' }"
input:
tuple val(meta), path(bam), path(bai), path(intervals)
tuple val(meta), path(fasta)
tuple val(meta), path(known_vcf)
output:
tuple val(meta), path("*.bam"), emit: bam
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
if ("$bam" == "${prefix}.bam") error "Input and output names are the same, set prefix in module configuration to disambiguate!"
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def known = known_vcf ? "-known ${known_vcf}" : ""
"""
gatk3 \\
-T RealignerTargetCreator \\
-R ${fasta} \\
-nt ${task.cpus}
-I ${bam} \\
-targetIntervals ${intervals} \\
${known} \\
-o ${prefix}.bam \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
gatk: \$(echo \$(gatk3 --version))
END_VERSIONS
"""
}

View file

@ -0,0 +1,63 @@
name: "gatk_indelrealigner"
description: Performs local realignment around indels to correct for mapping errors
keywords:
- bam
- vcf
- variant calling
- indel
- realignment
tools:
- "gatk":
description: "The full Genome Analysis Toolkit (GATK) framework, license restricted."
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']"
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
type: file
description: Sorted and indexed BAM/CRAM/SAM file
pattern: "*.bam"
- bai:
type: file
description: BAM index file
pattern: "*.bai"
- intervals:
type: file
description: Intervals file created by gatk3 RealignerTargetCreator
pattern: "*.{intervals,list}"
- fasta:
type: file
description: Reference file used to generate BAM file
pattern: ".{fasta,fa,fna}"
- known_vcf:
type: file
description: Optional input VCF file(s) with known indels
pattern: ".vcf"
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"
- bam:
type: file
description: Sorted and indexed BAM/CRAM/SAM file with local realignment around variants
pattern: "*.bam"
- bai:
type: file
description: Output BAM Index file
pattern: "*.bai"
authors:
- "@jfy133"

View file

@ -715,6 +715,10 @@ gamma/gamma:
- modules/gamma/gamma/**
- tests/modules/gamma/gamma/**
gatk/indelrealigner:
- modules/gatk/indelrealigner/**
- tests/modules/gatk/indelrealigner/**
gatk4/applybqsr:
- modules/gatk4/applybqsr/**
- tests/modules/gatk4/applybqsr/**

View file

@ -0,0 +1,22 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { GATK_INDELREALIGNER } from '../../../../modules/gatk/indelrealigner/main.nf'
// TODO add REalignerTargetCrator
workflow test_gatk_indelrealigner {
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_bai'], checkIfExists: true),
GATK_REALIGNERTARGETCREATOR.out.intervals
]
reference = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
GATK_INDELREALIGNER ( input, reference, [] )
}

View file

@ -0,0 +1,6 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
ext.prefix = "${meta.id}.realigned"
}

View file

@ -0,0 +1,14 @@
## TODO nf-core: Please run the following command to build this file:
# nf-core modules create-test-yml gatk/indelrealigner
- name: "gatk indelrealigner"
command: nextflow run ./tests/modules/gatk/indelrealigner -entry test_gatk_indelrealigner -c ./tests/config/nextflow.config -c ./tests/modules/gatk/indelrealigner/nextflow.config
tags:
- "gatk"
#
- "gatk/indelrealigner"
#
files:
- path: "output/gatk/test.bam"
md5sum: e667c7caad0bc4b7ac383fd023c654fc
- path: output/gatk/versions.yml
md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b