Skip to content

Commit

Permalink
Enable GTR benchmarking in treeflow
Browse files Browse the repository at this point in the history
- add parse-trace.py
- use -with-trace in nextflow
  • Loading branch information
4ment committed Jul 22, 2022
1 parent 2ec3e46 commit 26efc8b
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 2 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ RUN cd /phylojax && /opt/conda/envs/bito/bin/pip install jax==0.2.24 jaxlib . &&
RUN ln -s /phylojax/benchmarks/benchmark.py /usr/local/bin/phylojax-benchmark \
&& chmod +x /usr/local/bin/phylojax-benchmark

RUN git clone --depth 1 https://github.com/4ment/phylostan /phylostan
RUN cd /phylostan && pip install . && phylostan --help
RUN pip install phylostan==1.0.5 && phylostan --help

RUN git clone --depth 1 https://github.com/christiaanjs/treeflow.git /treeflow
RUN cd /treeflow && /opt/conda/envs/bito/bin/pip install .
Expand Down
1 change: 1 addition & 0 deletions configs/uts.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ process{
time = '5m'
}
withName: RUN_TREEFLOW{
clusterOptions = '-l select=1:ncpus=3'
time = '20h'
}
}
Expand Down
1 change: 1 addition & 0 deletions flu_H3N2/physher-JC69.template
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ RATE_PRIOR_TEMPLATE
"tol": TOL_TEMPLATE,
"eta": LR_TEMPLATE,
"model": "&varnormal",
"update": "adam",
"checkpoint": "CHECKPOINT_TEMPLATE",
"parameters": ["%mu", "%sigma", "&mu.rate", "&sigma.rate","&mu.theta", "&sigma.theta"],
"max": TEMPLATE_ITER
Expand Down
2 changes: 2 additions & 0 deletions modules/micro.nf
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ process RUN_TREEFLOW_BENCHMARK {
-t $lsd_newick \
-r ${params.replicates} \
-s 0.001 \
--gtr \
-p false \
-o out.csv
awk 'NR==1{print "program,size,rep,precision,"\$0}; \
NR>1{print "treeflow,$size,$rep,64,"\$0}' out.csv \
Expand Down
1 change: 1 addition & 0 deletions run_rhino.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export PATH=$SINGULARITYROOT/bin/:$PATH
-profile rhino \
-with-report ./r_output/nextflow_report.html \
-work-dir ./r_output/work/ \
-with-trace \
-resume
39 changes: 39 additions & 0 deletions scripts/parse-trace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import sys
from os import walk

if len(sys.argv) == 1:
print(f"Usage: python {sys.argv[0]} work/ trace.txt")
exit(2)

dic = {}
for (dirpath, dirnames, filenames) in walk(sys.argv[1]):
if len(filenames) > 0:
dic[dirpath.lstrip("work/")[:9]] = filenames

with open(sys.argv[2], "r") as fp:
for line in fp:
a = line.split("\t")
if "task_id" == a[0]:
print("program\tsize\treplicate\t" + line, end="")
elif "macro_flu:RUN_" in a[3]:
for f in dic[a[1]]:
if ".txt" in f:
b = f.split(".")[:-1]
mem = a[10].split(" ")
if mem[1] == "GB":
a[10] = str(float(mem[0]) * 1024)
else:
a[10] = mem[0]
mem = a[11].split(" ")
if mem[1] == "GB":
a[11] = str(float(mem[0]) * 1024)
else:
a[11] = mem[0]

if len(b) == 4:
b[0] = "bitorch" if b[1] == "true" else "torchtree"
del b[1]
print("\t".join(b) + "\t" + "\t".join(a), end="")
else:
print("\t".join(b) + "\t" + "\t".join(a), end="")
break

0 comments on commit 26efc8b

Please sign in to comment.