nf-core_modules/modules/gatk4/genomicsdbimport/main.nf
GCJMackenzie 7afb962f0b
New module genomicsdbimport (#857)
* saving changes to checkout

* saving to sort out other branch

* removed yml tracking of files that cant be tracked due to directory name changing between runs

* test data added, ready for pr

* fix eol linting error

* Update modules/gatk4/genomicsdbimport/main.nf

Co-authored-by: Francesco L <53608000+lescai@users.noreply.github.com>

* merging with master

* update push to show progress

* tests now working untar able to pass data to genomicsdbimport

* commit to checkout

* tests updated, module reworked to simplify and emit updated gendb

* Apply suggestions from code review

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* update meta.yml 

Priority of input options changed, updated to reflect this

* Update test.yml

name prefix changed in main script, test.yml updated to reflect this

* fix tests due to review changes

Co-authored-by: GCJMackenzie <gavin.mackenzie@nibsc.org>
Co-authored-by: Francesco L <53608000+lescai@users.noreply.github.com>
Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
2021-10-29 17:21:34 +01:00

67 lines
2.6 KiB
Text

// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process GATK4_GENOMICSDBIMPORT {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
}
input:
tuple val(meta), path(vcf), path(tbi), path(intervalfile), val(intervalval), path(wspace)
val run_intlist
val run_updatewspace
val input_map
output:
tuple val(meta), path("*_genomicsdb") , optional:true, emit: genomicsdb
tuple val(meta), path("$updated_db") , optional:true, emit: updatedb
tuple val(meta), path("*.interval_list"), optional:true, emit: intervallist
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
// settings for running default create gendb mode
def inputs_command = input_map ? "--sample-name-map ${vcf[0]}" : "${'-V ' + vcf.join(' -V')}"
def dir_command = "--genomicsdb-workspace-path ${prefix}"
def intervals_command = intervalfile ? " -L ${intervalfile} " : " -L ${intervalval} "
// settings changed for running get intervals list mode if run_intlist is true
if (run_intlist) {
inputs_command = ''
dir_command = "--genomicsdb-update-workspace-path ${wspace}"
intervals_command = "--output-interval-list-to-file ${prefix}.interval_list"
}
// settings changed for running update gendb mode. inputs_command same as default, update_db forces module to emit the updated gendb
if (run_updatewspace) {
dir_command = "--genomicsdb-update-workspace-path ${wspace}"
intervals_command = ''
updated_db = wspace.toString()
}
"""
gatk GenomicsDBImport \\
$inputs_command \\
$dir_command \\
$intervals_command \\
$options.args
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
}