Commit de17b6b5 authored by Louis Duchemin's avatar Louis Duchemin
Browse files

Calibration + benchmark merge

parent 84ebb3e3
...@@ -66,8 +66,28 @@ let hist_pval (convergence_table : cpt file) (pvalue_column:string): pdf file = ...@@ -66,8 +66,28 @@ let hist_pval (convergence_table : cpt file) (pvalue_column:string): pdf file =
module Under_mutsel = struct module Under_mutsel = struct
module Pipeline = Codepi.Simulation_pipeline.Mutsel module Pipeline = Codepi.Simulation_pipeline.Mutsel
type detection_method = {
f : Pipeline.query -> cpt file ;
label : string ;
requires_rooted_tree : bool ;
}
let meth ?(requires_rooted_tree = false) f label =
{ f ; label ; requires_rooted_tree }
let methods = Pipeline.[
meth tdg09 "tdg09" ;
meth inhouse_tdg09 "inhouse_tdg09" ;
(* meth pcoc "pcoc" ; *)
(* meth pcoc_v2 ~col:3 "pcoc v2" ; *)
meth (gemma ~lmm_test:`Score ~relatedness_mode:`Standardized) "gemma" ;
meth inhouse_lmm "LMM" ;
meth (lmm_with_gemma_matrix ~relatedness_mode:`Centered) "LMM_Gemma";
meth multinomial_asymptotic_lrt "multinomial" ;
meth topological "topological" ~requires_rooted_tree:true ;
]
let query ?(seed = 42) { tree = t ; ne_s ; branch_scale ; _ } = let query ?(seed = 42) { tree = t ; ne_s ; branch_scale ; _ } =
let branch_scale = branch_scale *. 3. in
Pipeline.query ~seed ~tree:(NHX t) ~branch_scale ~ne_s Pipeline.query ~seed ~tree:(NHX t) ~branch_scale ~ne_s
~profiles:"example/aa_fitness/263SelectedProfiles.tsv" ~profiles:"example/aa_fitness/263SelectedProfiles.tsv"
~n_h0:1000 ~n_ha:0 () ~n_h0:1000 ~n_ha:0 ()
...@@ -91,6 +111,37 @@ module Under_mutsel = struct ...@@ -91,6 +111,37 @@ module Under_mutsel = struct
query dataset query dataset
|> Pipeline.inhouse_tdg09 |> Pipeline.inhouse_tdg09
|> Fn.flip hist_pval "inhouse_tdg09_1mpval" |> Fn.flip hist_pval "inhouse_tdg09_1mpval"
let query_benchmark ?(seed = 42) { tree = t ; ne_s ; branch_scale ; _ } =
Pipeline.query ~seed ~tree:(NHX t) ~branch_scale ~ne_s
~profiles:"example/aa_fitness/263SelectedProfiles.tsv"
~n_h0:9000 ~n_ha:1000 ()
let benchmark dataset =
let q = query_benchmark dataset in
let methods = List.filter_map methods ~f:(fun m ->
if not m.requires_rooted_tree || dataset.rooted then
Some m.f else None
) in
Pipeline.benchmark q methods
|> Pipeline.rds_of_benchmark
let plot_benchmark (rds:rds file) =
let open Bistro.Shell_dsl in
let script = [%script {|
library(tidyverse)
library(grDevices)
rds = readRDS("<<< dep rds >>>")
pdf("<<< dest >>>")
rds$auc_estimates %>%
ggplot(aes(x=method, y=estimate)) +
geom_pointrange(aes(ymin=lower_bound, ymax=upper_bound)) +
theme_bw() +
ggtitle("<<< dep rds >>>")
dev.off()
|}] in
Bistro_utils.R_script.workflow ~descr:"calibration.under_mutsel.plot_benchmark" script
end end
module Under_tdg09 = struct module Under_tdg09 = struct
...@@ -165,4 +216,5 @@ let target () = ...@@ -165,4 +216,5 @@ let target () =
let multinomial_under_mutsel_besnard2009 = Under_mutsel.multinomial besnard2009 in let multinomial_under_mutsel_besnard2009 = Under_mutsel.multinomial besnard2009 in
let tdg09_under_mutsel_besnard2009 = Under_mutsel.tdg09 besnard2009 in let tdg09_under_mutsel_besnard2009 = Under_mutsel.tdg09 besnard2009 in
let inhouse_tdg09_under_mutsel_besnard2009 = Under_mutsel.inhouse_tdg09 besnard2009 in let inhouse_tdg09_under_mutsel_besnard2009 = Under_mutsel.inhouse_tdg09 besnard2009 in
Report.pdflatex [%include_script "notes/calibration.tex"] let benchmark_besnard = Under_mutsel.(benchmark besnard2009 |> plot_benchmark) in
Report.pdflatex [%include_script "notes/calibration.tex"]
...@@ -32,4 +32,11 @@ ...@@ -32,4 +32,11 @@
\includegraphics[width=0.75\textwidth]{<<<Report.pdfdep inhouse_tdg09_under_mutsel_besnard2009>>>} \includegraphics[width=0.75\textwidth]{<<<Report.pdfdep inhouse_tdg09_under_mutsel_besnard2009>>>}
\end{frame} \end{frame}
\begin{frame}{Benchmark Besnard2009 under Mutsel}
\includegraphics[width=0.75\textwidth]{<<<Report.pdfdep benchmark_besnard>>>}
\end{frame}
\end{document} \end{document}
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