Skip to content

Commit c75072b

Browse files
Updated analyses
1 parent d7d9d1a commit c75072b

File tree

21 files changed

+914
-245
lines changed

21 files changed

+914
-245
lines changed

01_simple_example/nextflow.config

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
fastqueue = 'common,dedicated'
22
fastqos= '--qos=fast'
33

4+
longqueue = 'cnrvir'
5+
longqos= '-A cnrvir'
6+
7+
normalqueue= ''
8+
normalqos=''
9+
410
// Preform work directory cleanup after a successful run
511
//cleanup = true
612

@@ -12,21 +18,25 @@ executor {
1218
report {
1319
enabled = true
1420
file = 'reports/report.html'
21+
overwrite=true
1522
}
1623

1724
trace {
1825
enabled = true
1926
file = 'reports/trace.txt'
27+
overwrite=true
2028
}
2129

2230
timeline {
2331
enabled = true
2432
file = 'reports/timeline.html'
33+
overwrite=true
2534
}
2635

2736
dag {
2837
enabled = true
2938
file = 'reports/dag.dot'
39+
overwrite=true
3040
}
3141

3242
singularity {
@@ -37,30 +47,38 @@ singularity {
3747
}
3848

3949
process {
40-
//executor='slurm'
41-
executor='local'
42-
queue = "$fastqueue"
43-
clusterOptions = "$fastqos"
50+
executor='slurm'
51+
//executor='local'
52+
queue = "$longqueue"
53+
clusterOptions = "$longqos"
54+
//queue = "$fastqueue"
55+
//clusterOptions = "$fastqos"
4456
scratch=false
4557
maxRetries=30
4658
errorStrategy='retry'
4759

4860
withLabel: phyml {
4961
container='evolbioinfo/phyml:v3.3.20200621'
5062
cpus=1
51-
memory='1G'
63+
memory='10G'
5264
}
5365

5466
withLabel: raxml {
67+
container='evolbioinfo/raxml-ng:v1.1.0'
68+
cpus=15
69+
memory='10G'
70+
}
71+
72+
withLabel: raxmlshort {
5573
container='evolbioinfo/raxml-ng:v1.1.0'
5674
cpus=1
57-
memory='1G'
75+
memory='10G'
5876
}
5977

6078
withLabel: iqtree {
6179
container='evolbioinfo/iqtree:v2.2.2.5'
62-
cpus=1
63-
memory='1G'
80+
cpus=15
81+
memory='10G'
6482
}
6583

6684
withLabel: gotree {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
library(concom)
2+
3+
args = commandArgs(trailingOnly=TRUE)
4+
5+
infile=args[1]
6+
outfile=args[2]
7+
8+
# Read distance matrix
9+
dist=read.table(infile,skip=1,header=F,row.names = 1)
10+
colnames(dist)=row.names(dist)
11+
12+
# Convert distances in adjacency matrix
13+
# distances of 0 converted to 1 (link: identical)
14+
# distances >0 converted to 0 (no link: not identical)
15+
adjMat=dist
16+
adjMat[adjMat==0]=-1
17+
adjMat[adjMat>0]=0
18+
adjMat[adjMat==-1]=1
19+
20+
# Compute connected components
21+
comp=concomFromMatAdj(as.matrix(adjMat))
22+
23+
# We keep the first sequences of each component
24+
tokeep=unlist(lapply(1:length(comp$components),function(c){unlist(comp$components[[c]][[1]])}))
25+
namestokeep=row.names(adjMat)[tokeep]
26+
27+
# We write the list of sequence names to keep in the end
28+
write.table(namestokeep,file=outfile, col.names = F, row.names = F, quote = FALSE)

01b_near_zero_branches/main.nf

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
nextflow.enable.dsl=2
2+
3+
params.results="results"
4+
params.align="../09_ebola/results_001/aln.ids_subsamp.phylip"
5+
params.nboot=200
6+
7+
results=file(params.results)
8+
9+
process Unique {
10+
publishDir "$results/", mode: 'link'
11+
12+
label 'goalign'
13+
14+
input:
15+
file msa
16+
17+
output:
18+
path "*_unique.phy"
19+
stdout
20+
21+
script:
22+
"""
23+
goalign dedup -i $msa -p | goalign clean sites --char GAP --cutoff 1.0 -p > ${msa.baseName}_unique.phy
24+
goalign stats length -p -i ${msa.baseName}_unique.phy > len.txt
25+
printf \$(cat len.txt)
26+
"""
27+
}
28+
29+
process InferRefTreeRAxML {
30+
publishDir "$results/", mode: 'link'
31+
32+
label 'raxml'
33+
34+
input:
35+
file msa
36+
val nboot
37+
38+
output:
39+
path "reftree_collapsed_raxml.nw"
40+
path "reftree_original_raxml.nw"
41+
42+
script:
43+
"""
44+
raxml-ng --all --msa ${msa} --model GTR+G4 --threads ${task.cpus} --seed 123456 --bs-trees $nboot --bs-metric fbp
45+
mv ${msa}.raxml.bestTreeCollapsed reftree_collapsed_raxml.nw
46+
mv ${msa}.raxml.support reftree_original_raxml.nw
47+
"""
48+
}
49+
50+
process InferRefTreeIQTreeCollapse {
51+
publishDir "$results/", mode: 'link'
52+
53+
label 'iqtree'
54+
55+
input:
56+
file msa
57+
val nboot
58+
59+
output:
60+
path "reftree_collapsed_iqtree.nw"
61+
62+
script:
63+
"""
64+
iqtree -s ${msa} -m GTR+G4 --seed 123456789 -T ${task.cpus} -b $nboot -czb
65+
mv ${msa}.treefile reftree_collapsed_iqtree.nw
66+
"""
67+
}
68+
69+
process InferRefTreeIQTreeNoCollapse {
70+
publishDir "$results/", mode: 'link'
71+
72+
label 'iqtree'
73+
74+
input:
75+
file msa
76+
val nboot
77+
78+
output:
79+
path "reftree_original_iqtree.nw"
80+
81+
script:
82+
"""
83+
iqtree -s ${msa} -m GTR+G4 --seed 123456789 -T ${task.cpus} -b $nboot
84+
mv ${msa}.treefile reftree_original_iqtree.nw
85+
"""
86+
}
87+
88+
process InferRefTreePhyML {
89+
publishDir "$results/", mode: 'link'
90+
91+
label 'phyml'
92+
93+
input:
94+
path msa
95+
96+
output:
97+
path "reftree_phyml.nw"
98+
99+
script:
100+
"""
101+
phyml -i ${msa} -m GTR -c 4 -a e -f e -d nt -o tlr -b 0 --r_seed 123456
102+
mv ${msa}_phyml_tree.txt reftree_phyml.nw
103+
"""
104+
}
105+
106+
process SeqBootPhyML {
107+
publishDir "$results/seqboot/", mode: 'link'
108+
109+
label 'goalign'
110+
111+
input:
112+
file msa
113+
val nboot
114+
115+
output:
116+
file "bootphy_*"
117+
118+
script:
119+
"""
120+
goalign build seqboot -S -p -n $nboot -i ${msa} -o bootphy_ --seed 123456789
121+
"""
122+
}
123+
124+
process SeqBootTreesPhyML {
125+
label 'phyml'
126+
127+
input:
128+
path msa
129+
130+
output:
131+
path "${msa}_boottree_phyml.nw"
132+
133+
script:
134+
"""
135+
phyml -i ${msa} -m GTR -c 4 -a e -f e -d nt -o tlr -b 0 --r_seed 123456
136+
mv ${msa}_phyml_tree.txt ${msa}_boottree_phyml.nw
137+
"""
138+
}
139+
140+
process SeqBootSupportsPhyML {
141+
publishDir "$results/", mode: 'link'
142+
143+
label 'gotree'
144+
145+
input:
146+
file ref
147+
file boot
148+
val length
149+
150+
output:
151+
file "reftree_phyml_bootsupport.nw"
152+
file "reftree_phyml_bootsupport_collapse.nw"
153+
file boot
154+
155+
script:
156+
"""
157+
gotree compute support fbp -i ${ref} -b ${boot} -o reftree_phyml_bootsupport.nw
158+
gotree collapse length -i ${boot} -l ${0.1/length} | gotree compute support fbp -i ${ref} -b - -o reftree_phyml_bootsupport_collapse.nw
159+
"""
160+
}
161+
162+
process SeqBootRAxML {
163+
publishDir "$results/seqboot/", mode: 'link'
164+
165+
label 'goalign'
166+
167+
input:
168+
file msa
169+
val nboot
170+
171+
output:
172+
file "bootrax_*"
173+
174+
script:
175+
"""
176+
goalign build seqboot -S -p -n $nboot -i ${msa} -o bootrax_ --seed 987654321
177+
"""
178+
}
179+
180+
process SeqBootTreesRAxML {
181+
label 'raxmlshort'
182+
183+
input:
184+
path msa
185+
186+
output:
187+
path "${msa}_boottree_raxml.nw"
188+
189+
script:
190+
"""
191+
raxml-ng --msa ${msa} --model GTR+G4 --threads ${task.cpus} --seed 123456
192+
mv ${msa}.raxml.bestTree ${msa}_boottree_raxml.nw
193+
"""
194+
}
195+
196+
process SeqBootSupportsRAxML {
197+
publishDir "$results/", mode: 'link'
198+
199+
label 'gotree'
200+
201+
input:
202+
file ref
203+
file boot
204+
val length
205+
206+
output:
207+
file "reftree_raxml_bootsupport.nw"
208+
file "reftree_raxml_bootsupport_collapse.nw"
209+
file boot
210+
211+
script:
212+
"""
213+
gotree compute support fbp -i ${ref} -b ${boot} -o reftree_raxml_bootsupport.nw
214+
gotree collapse length -i ${boot} -l ${0.1/length} | gotree compute support fbp -i ${ref} -b - -o reftree_raxml_bootsupport_collapse.nw
215+
"""
216+
}
217+
218+
workflow{
219+
msa = Channel.fromPath(params.align)
220+
nboot=params.nboot
221+
uniqueout = Unique(msa)
222+
dedup=uniqueout[0]
223+
length=uniqueout[1].map{it -> Integer.parseInt(it.trim()) }
224+
225+
refrax = InferRefTreeRAxML(dedup,nboot)
226+
refiqtc = InferRefTreeIQTreeCollapse(dedup,nboot)
227+
refiqtnc = InferRefTreeIQTreeNoCollapse(dedup,nboot)
228+
229+
phybootmsa = SeqBootPhyML(dedup,nboot)
230+
raxbootmsa = SeqBootRAxML(dedup,nboot)
231+
232+
refraxnocoll = refrax[1]
233+
raxboottrees = SeqBootTreesRAxML(raxbootmsa.flatten())
234+
SeqBootSupportsRAxML(refraxnocoll, raxboottrees.collectFile(name: 'boot_rax.nw'),length)
235+
236+
refphy = InferRefTreePhyML(dedup)
237+
phyboottrees = SeqBootTreesPhyML(phybootmsa.flatten())
238+
SeqBootSupportsPhyML(refphy, phyboottrees.collectFile(name: 'boot_phy.nw'),length)
239+
}

0 commit comments

Comments
 (0)