-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdragen.nf
55 lines (48 loc) · 1.91 KB
/
dragen.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
process DRAGEN {
tag "$meta.id"
label 'dragen'
secret 'DRAGEN_USERNAME'
secret 'DRAGEN_PASSWORD'
input:
tuple val(meta), path(files_in)
path index
output:
tuple val(meta), path('*.bam') , emit: bam , optional:true
tuple val(meta), path('*fastq.gz') , emit: fastq , optional:true
tuple val(meta), path("${prefix}.vcf.gz") , emit: vcf , optional:true
tuple val(meta), path("${prefix}.vcf.gz.tbi") , emit: tbi , optional:true
tuple val(meta), path("${prefix}.hard-filtered.vcf.gz") , emit: vcf_filtered, optional:true
tuple val(meta), path("${prefix}.hard-filtered.vcf.gz.tbi"), emit: tbi_filtered, optional:true
path "versions.yml" , emit: versions
script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
def ref = index ? "-r $index" : ''
// Generate appropriate parameter for input files
def input = ''
def rgid = ''
def rgdm = ''
def file_list = files_in.collect { it.toString() }
if (file_list[0].endsWith('.bam')) {
input = "-b ${files_in}"
} else {
input = meta.single_end ? "-1 ${files_in}" : "-1 ${files_in[0]} -2 ${files_in[1]}"
rgid = meta.rgid ? "--RGID ${meta.rgid}" : "--RGID ${meta.id}"
rgsm = meta.rgsm ? "--RGSM ${meta.rgsm}" : "--RGSM ${meta.id}"
}
"""
/opt/edico/bin/dragen \\
$ref \\
--output-directory ./ \\
--output-file-prefix $prefix \\
--lic-server=\$DRAGEN_USERNAME:\[email protected] \\
$input \\
$rgid \\
$rgsm \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
dragen: \$(echo \$(/opt/edico/bin/dragen --version 2>&1) | sed -e "s/dragen Version //g")
END_VERSIONS
"""
}