Merge pull request #1655 from nvnieuwk/new-module-gatk4/splitintervals

new module: gatk4/splitintervals
This commit is contained in:
nvnieuwk 2022-05-13 14:43:15 +02:00 committed by GitHub
commit 919275103a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 170 additions and 0 deletions

View file

@ -0,0 +1,48 @@
process GATK4_SPLITINTERVALS {
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(intervals)
path(fasta)
path(fasta_fai)
path(dict)
output:
tuple val(meta), path("**.interval_list"), emit: split_intervals
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 reference = fasta ? "--reference $fasta" : ""
def avail_mem = 3
if (!task.memory) {
log.info '[GATK SplitIntervals] 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" SplitIntervals \\
--output ${prefix} \\
--intervals $intervals \\
$reference \\
--tmp-dir . \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -0,0 +1,53 @@
name: gatk4_splitintervals
keywords:
- interval
- bed
tools:
- gatk4:
description: Genome Analysis Toolkit (GATK4)
homepage: https://gatk.broadinstitute.org/hc/en-us
documentation: https://gatk.broadinstitute.org/hc/en-us/categories/360002369672s
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' ]
- interval:
type: file
description: Interval list or BED
pattern: "*.{interval,interval_list,bed}"
- fasta:
type: file
description: Reference FASTA
pattern: "*.{fa,fasta}"
- fasta_fai:
type: file
description: Reference FASTA index
pattern: "*.fai"
- dict:
type: file
description: Reference sequence dictionary
pattern: "*.dict"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test' ]
- bed:
type: file
description: A list of scattered interval lists
pattern: "*.interval_list"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@nvnieuwk"

View file

@ -819,6 +819,10 @@ gatk4/selectvariants:
- modules/gatk4/selectvariants/**
- tests/modules/gatk4/selectvariants/**
gatk4/splitintervals:
- modules/gatk4/splitintervals/**
- tests/modules/gatk4/splitintervals/**
gatk4/splitncigarreads:
- modules/gatk4/splitncigarreads/**
- tests/modules/gatk4/splitncigarreads/**

View file

@ -0,0 +1,33 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { GATK4_SPLITINTERVALS } from '../../../../modules/gatk4/splitintervals/main.nf'
workflow test_gatk4_splitintervals_bed {
input = [
[ id:'test' ], // meta map
file(params.test_data['homo_sapiens']['genome']['genome_multi_interval_bed'], checkIfExists: true)
]
fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)
fasta_fai = file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)
fasta_dict = file(params.test_data['homo_sapiens']['genome']['genome_dict'], checkIfExists: true)
GATK4_SPLITINTERVALS ( input, fasta, fasta_fai, fasta_dict)
}
workflow test_gatk4_splitintervals_intervals {
input = [
[ id:'test' ], // meta map
file(params.test_data['homo_sapiens']['genome']['genome_interval_list'], checkIfExists: true)
]
fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)
fasta_fai = file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)
fasta_dict = file(params.test_data['homo_sapiens']['genome']['genome_dict'], checkIfExists: true)
GATK4_SPLITINTERVALS ( input, fasta, fasta_fai, fasta_dict)
}

View file

@ -0,0 +1,9 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName: GATK4_SPLITINTERVALS {
ext.args = "--scatter-count 2"
}
}

View file

@ -0,0 +1,23 @@
- name: gatk4 splitintervals test_gatk4_splitintervals_bed
command: nextflow run tests/modules/gatk4/splitintervals -entry test_gatk4_splitintervals_bed -c tests/config/nextflow.config
tags:
- gatk4/splitintervals
- gatk4
files:
- path: output/gatk4/test/0000-scattered.interval_list
md5sum: c8d6b19e7a92535b6ce9608eae558faa
- path: output/gatk4/test/0001-scattered.interval_list
md5sum: b1877ad96aec308906594c50ebbe3ded
- path: output/gatk4/versions.yml
- name: gatk4 splitintervals test_gatk4_splitintervals_intervals
command: nextflow run tests/modules/gatk4/splitintervals -entry test_gatk4_splitintervals_intervals -c tests/config/nextflow.config
tags:
- gatk4/splitintervals
- gatk4
files:
- path: output/gatk4/test/0000-scattered.interval_list
md5sum: ebd6b34a335efc6732ff541936c6d2d5
- path: output/gatk4/test/0001-scattered.interval_list
md5sum: 9459b0e124fa84ec1e64ac4615bc9af7
- path: output/gatk4/versions.yml