Merge pull request #1729 from jfy133/gatk-unifiedgenotyper

Add gatk/unifiedgenotyper
This commit is contained in:
James A. Fellows Yates 2022-06-03 21:31:31 +02:00 committed by GitHub
commit af890b1417
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 172 additions and 0 deletions

View file

@ -0,0 +1,63 @@
process GATK_UNIFIEDGENOTYPER {
tag "$meta.id"
label 'process_medium'
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(input), path(index)
path fasta
path fai
path dict
path intervals
path contamination
path dbsnp
path comp
output:
tuple val(meta), path("*.vcf.gz"), emit: vcf
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 contamination_file = contamination ? "-contaminationFile ${contamination}" : ""
def dbsnp_file = dbsnp ? "--dbsnp ${dbsnp}" : ""
def comp_file = comp ? "--comp ${comp}" : ""
def intervals_file = intervals ? "--intervals ${intervals}" : ""
def avail_mem = 3
if (!task.memory) {
log.info '[GATK RealignerTargetCreator] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
"""
gatk3 \\
-Xmx${avail_mem}g \\
-nt ${task.cpus} \\
-T UnifiedGenotyper \\
-I ${input} \\
-R ${fasta} \\
${contamination_file} \\
${dbsnp_file} \\
${comp_file} \\
${intervals_file} \\
-o ${prefix}.vcf \\
$args
gzip -n *.vcf
cat <<-END_VERSIONS > versions.yml
"${task.process}":
gatk: \$(echo \$(gatk3 --version))
END_VERSIONS
"""
}

View file

@ -0,0 +1,73 @@
name: "gatk_unifiedgenotyper"
keywords:
- bam
- vcf
- variant calling
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 ]
- input:
type: file
description: Sorted and indexed BAM/CRAM/SAM file
pattern: "*.bam"
- index:
type: file
description: BAM index file
pattern: "*.bai"
- fasta:
type: file
description: Reference file used to generate BAM file
pattern: ".{fasta,fa,fna}"
- 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"
- intervals:
type: file
description: Bed file with the genomic regions included in the library (optional)
pattern: "*.intervals"
- contamination:
type: file
description: Tab-separated file containing fraction of contamination in sequencing data (per sample) to aggressively remove
pattern: "*"
- dbsnps:
type: file
description: VCF file containing known sites (optional)
pattern: "*"
- comp:
type: file
description: Comparison VCF file (optional)
pattern: "*"
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"
- vcf:
type: file
description: VCF file containing called variants
pattern: "*.vcf.gz"
authors:
- "@ilight1542"
- "@jfy133"

View file

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

View file

@ -0,0 +1,18 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { GATK_UNIFIEDGENOTYPER } from '../../../../modules/gatk/unifiedgenotyper/main.nf'
workflow test_gatk_unifiedgenotyper {
input = [ [ id:'test' ], // meta map
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),
]
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
fai = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true)
dict = file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true)
GATK_UNIFIEDGENOTYPER ( input, fasta, fai, dict, [], [], [], [])
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -0,0 +1,9 @@
- name: gatk unifiedgenotyper test_gatk_unifiedgenotyper
command: nextflow run ./tests/modules/gatk/unifiedgenotyper -entry test_gatk_unifiedgenotyper -c ./tests/config/nextflow.config -c ./tests/modules/gatk/unifiedgenotyper/nextflow.config
tags:
- gatk
- gatk/unifiedgenotyper
files:
- path: output/gatk/test.vcf.gz
contains:
- "#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT test"