-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.nf
79 lines (68 loc) · 2.51 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
process squirrel {
container "${params.wf.container}:${params.wf.container_version}"
publishDir "${params.out_dir}", mode: 'copy', saveAs: { fn -> fn.replace("squirrel_output/", "")}
input:
path fasta
path "refs.fa"
path "bg.fa"
path additional_mask
output:
path "squirrel_output/${fasta.baseName}.aln.fasta"
path "squirrel_output/**"
script:
extra = ""
if ( params.output_intermediates )
extra += " --no-temp"
if ( params.seq_qc )
extra += " --seq-qc"
if ( params.assembly_refs )
extra += " --assembly-refs refs.fa"
if ( params.no_mask )
extra += " --no-mask"
if ( params.no_itr_mask )
extra += " --no-itr-mask"
if ( params.additional_mask )
extra += " --additional-mask ${additional_mask}"
if ( params.extract_cds )
extra += " --extract-cds"
if ( params.concatenate )
extra += " --concatenate"
if ( params.clade )
extra += " --clade ${params.clade}"
if ( params.run_phylo )
extra += " --run-phylo"
if ( params.run_apobec3_phylo )
extra += " --run-apobec3-phylo"
if ( params.include_background )
extra += " --include-background"
if ( params.additional_background )
extra += " -bf bg.fa"
if ( params.outgroups )
extra += " --outgroups ${params.outgroups}"
if ( params.extra_flags )
extra += " ${params.extra_flags}"
"""
export XDG_CACHE_HOME=\$PWD/.cache
squirrel --version 2>&1 | sed 's/: /,/' > squirrel.version
squirrel ${fasta} -o squirrel_output --outfile ${fasta.baseName}.aln.fasta --tempdir squirrel_tmp -t ${task.cpus} ${extra}
"""
}
workflow {
if ( params.assembly_refs ) {
refs_ch = channel.fromPath("${params.assembly_refs}", checkIfExists:true)
} else {
refs_ch = channel.fromPath("${projectDir}/${params.default_assembly_refs}", checkIfExists:true)
}
if ( params.additional_background ) {
bg_ch = channel.fromPath("${params.additional_background}", checkIfExists:true)
} else {
bg_ch = channel.fromPath("${projectDir}/${params.default_additional_background}", checkIfExists:true)
}
if ( params.additional_mask ) {
mask_ch = channel.fromPath("${params.additional_mask}", checkIfExists:true)
} else {
mask_ch = channel.fromPath("${projectDir}/${params.default_additional_mask}", checkIfExists:true)
}
fasta_ch = Channel.of(file("${params.fasta}", type: "file", checkIfExists:true))
squirrel(fasta_ch, refs_ch, bg_ch, mask_ch)
}