forked from UPHL-BioNGS/Cecret
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iqtree2.nf
52 lines (43 loc) · 1.45 KB
/
iqtree2.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
process iqtree2 {
tag "Creating phylogenetic tree with iqtree"
label "maxcpus"
publishDir "${params.outdir}", mode: 'copy'
container 'staphb/iqtree2:2.2.2.6'
//#UPHLICA maxForks 10
//#UPHLICA errorStrategy { task.attempt < 2 ? 'retry' : 'ignore'}
//#UPHLICA pod annotation: 'scheduler.illumina.com/presetSize', value: 'standard-xlarge'
//#UPHLICA memory 60.GB
//#UPHLICA cpus 14
//#UPHLICA time '45m'
when:
params.iqtree2
input:
file(msa)
output:
path "iqtree2/iqtree2.{iqtree,treefile*,mldist,log}", emit: tree
path "logs/${task.process}/${task.process}.${workflow.sessionId}.log"
shell:
'''
mkdir -p iqtree2 logs/!{task.process}
log=logs/!{task.process}/!{task.process}.!{workflow.sessionId}.log
date > $log
iqtree2 --version >> $log
if [ -n "!{params.iqtree2_outgroup}" ] && [ "!{params.iqtree2_outgroup}" != "null" ] && [ "!{params.msa}" != "nextclade" ]
then
outgroup="-o !{params.iqtree2_outgroup}"
cat !{msa} | sed 's/!{params.iqtree2_outgroup}.*/!{params.iqtree2_outgroup}/g' > !{msa}.renamed
else
outgroup=""
mv !{msa} !{msa}.renamed
fi
# creating a tree
iqtree2 !{params.iqtree2_options} \
-nt AUTO \
-ntmax !{task.cpus} \
-s !{msa}.renamed \
-pre iqtree2/iqtree2 \
$outgroup \
| tee -a $log
if [ -f "iqtree2/iqtree2.treefile" ] ; then cp iqtree2/iqtree2.treefile iqtree2/iqtree2.treefile.nwk ; fi
'''
}