Commit 3ab3e40f authored by Carine Rey's avatar Carine Rey
Browse files

correction tmp bug reprise automatique diffsel

parent b3bc08a5
......@@ -17,9 +17,11 @@ let bash_script args code =
seq ~sep:"\n" [ prelude ; string code ]
let diffsel_add_iterations_script ~chainname =
let diffsel_add_iterations_script ~chainname ~ali ~tree =
let vars = [
"CHAIN", chainname ;
"ALI", ali ;
"TREE", tree ;
]
in
bash_script vars {|
......@@ -30,12 +32,13 @@ set -e
continue=true
i=0
while $continue
do
#while $continue
#do
i=$((i+1))
echo i=$i
ls
# check convergence
Rscript -e "rmarkdown::render(\"DiffselMCMCConvergenceAnalysis.Rmd\", params=list(set_trace1=\"../dest/myrun.trace\"),output_file=\"../dest/output_"$i".html\")"
Rscript -e "rmarkdown::render(\"DiffselMCMCConvergenceAnalysis.Rmd\", params=list(set_trace1=\"../tmp/myrun_tmp.trace\"),output_file=\"../dest/output_"$i".html\")"
new_max=`tail -n 1 new_iterations.txt | cut -f 1`
continue=`tail -n 1 new_iterations.txt | cut -f 2`
end_it=`tail -n 1 new_iterations.txt | cut -f 3`
......@@ -44,15 +47,17 @@ echo new_max=$new_max
echo continue=$continue
echo end_it=$end_it
if $continue
then
echo "diffsel $CHAIN $new_max"
/diffsel/_build/diffsel $CHAIN $new_max
fi
#if $continue
#then
# echo "diffsel $CHAIN $new_max"
# /diffsel/_build/diffsel $CHAIN $new_max
#fi
#
#done
#
#cat new_iterations.txt > $CHAIN.iterations
done
cat new_iterations.txt > $CHAIN.iterations
/diffsel/_build/diffsel -t $TREE -d $ALI -ncond 2 -x 1 $end_it $CHAIN
|}
......@@ -63,8 +68,9 @@ let diffsel ~(phy_n:nucleotide_phylip workflow) ~(tree: _ workflow) ~(w_every:in
let tmp_ali = tmp // "myrun.ali" in
let dest_tree = dest // "myrun.tree" in
let dest_ali = dest // "myrun.ali" in
let chainname_tmp = tmp // "myrun_tmp" in
let chainname = dest // "myrun" in
let n_cycles = if (n_cycles > 200) then 200 else n_cycles in
let n_cycles = if (n_cycles > 200) then 20 else n_cycles in
let script_r = tmp // "DiffselMCMCConvergenceAnalysis.Rmd" in
(*_build/diffsel -t data/samhd1.tree -d data/samhd1.ali -ncond 3 -x 1 10000 myrun*)
workflow ~descr:("convergence_detection.run_diffsel." ^ tag ^ "." ^(string_of_int id)) [
......@@ -83,9 +89,9 @@ let diffsel ~(phy_n:nucleotide_phylip workflow) ~(tree: _ workflow) ~(w_every:in
opt "-d" ident tmp_ali ;
opt "-ncond" int 2 ;
opt "-x" seq [ int w_every; string " "; int n_cycles];
ident chainname ;
ident chainname_tmp ;
];
cmd "bash" [(file_dump (diffsel_add_iterations_script ~chainname ))];
cmd "bash" [(file_dump (diffsel_add_iterations_script ~chainname ~ali:tmp_ali ~tree:tmp_tree ))];
]
)
]
......
......@@ -3,7 +3,7 @@ title: "Diffsel MCMC convergence study"
author: "Reviewphiltrans (Bastien Boussau)"
output: html_document
params:
set_trace1: "myrun.trace"
set_trace1: "myrun_tmp.trace"
---
```{r setup, include=FALSE}
......@@ -24,6 +24,7 @@ trace1 = gsub(" ", "",params$set_trace1)
```{r, echo = T}
library(coda)
d1<-read.table(trace1, h=T, comment.char="&")[,1:7]
print(d1)
```
## Summary
......@@ -78,7 +79,8 @@ new_iterations = required_it - run_it
new_iterations_bool = if (required_it > run_it) {T} else {F}
new_iterations_bool_str = if (required_it > run_it) {"true"} else {"false"}
new_iterations_str=paste(as.character(next_step_its), new_iterations_bool_str, required_it, sep="\t")
new_iterations_bool_str = if (required_it > run_it) {"true"} else {"false"}
new_iterations_str=paste(as.character(next_step_its), new_iterations_bool_str, floor(required_it * 1.2), sep="\t")
if (new_iterations_bool_str) {
write(new_iterations_str, "new_iterations.txt", append=T)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment