-
Notifications
You must be signed in to change notification settings - Fork 644
/
main.nf
50 lines (41 loc) · 1.41 KB
/
main.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
process SAMTOOLS_FAIDX {
tag "$fasta"
label 'process_single'
conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/samtools:1.20--h50ea8bc_0' :
'biocontainers/samtools:1.20--h50ea8bc_0' }"
input:
tuple val(meta), path(fasta)
tuple val(meta2), path(fai)
output:
tuple val(meta), path ("*.{fa,fasta}") , emit: fa , optional: true
tuple val(meta), path ("*.fai") , emit: fai, optional: true
tuple val(meta), path ("*.gzi") , emit: gzi, optional: true
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
"""
samtools \\
faidx \\
$fasta \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
stub:
def match = (task.ext.args =~ /-o(?:utput)?\s(.*)\s?/).findAll()
def fastacmd = match[0] ? "touch ${match[0][1]}" : ''
"""
${fastacmd}
touch ${fasta}.fai
cat <<-END_VERSIONS > versions.yml
"${task.process}":
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
}