Commit 9be15cf6 authored by Philippe Veber's avatar Philippe Veber

Run: command-line choice of methods

parent 45225422
......@@ -120,15 +120,9 @@ type t = {
tree_file : string ;
alignment_dir : string ;
convergent_species_file : string ;
use_tdg09 : bool ;
detection_methods : detection_method list ;
}
let detection_methods run =
List.filter_opt [
Some multinomial_method ;
if run.use_tdg09 then Some tdg09_method else None ;
]
let convergent_species_workflow run =
[%workflow
In_channel.read_lines
......@@ -148,7 +142,6 @@ let dataset run =
Dataset.make ~tree ~nucleotide_alignments ~convergent_species
let repo run =
let detection_methods = detection_methods run in
let d = dataset run in
let foreach_detection_method (Detection_method meth as dm) =
let report = candidate_site_report d dm in
......@@ -160,25 +153,49 @@ let repo run =
(Pipeline.alignment_plot q)
in
List.concat [
List.map detection_methods ~f:foreach_detection_method ;
List.map run.detection_methods ~f:foreach_detection_method ;
List.map (Dataset.queries d) ~f:foreach_query ;
]
let known_methods = [
"multinomial", multinomial_method ;
"tdg09", tdg09_method ;
]
let parse_methods methods =
List.map methods ~f:(fun m ->
match List.Assoc.find known_methods ~equal:String.equal m with
| Some dm -> Ok dm
| None ->
Rresult.R.error_msgf "Unknown method %s, known methods are %s"
m (List.map known_methods ~f:fst |> String.concat ~sep:",")
)
|> Result.all
let main
~tree_file ~alignment_dir ~convergent_species_file
~outdir ~np ~mem
~use_tdg09 () =
let loggers = [
Console_logger.create () ;
] in
let mem = Option.map mem ~f:(fun i -> `GB i) in
let run = {
tree_file ; alignment_dir ; convergent_species_file ;
use_tdg09
} in
let repo = repo run in
Bistro_utils.Repo.build_main ~outdir ~loggers ?np ?mem repo
~methods () =
try
let loggers = [
Console_logger.create () ;
] in
let mem = Option.map mem ~f:(fun i -> `GB i) in
let detection_methods =
parse_methods methods
|> Rresult.R.failwith_error_msg
in
let run = {
tree_file ; alignment_dir ; convergent_species_file ;
detection_methods ;
} in
let repo = repo run in
Bistro_utils.Repo.build_main ~outdir ~loggers ?np ?mem repo
with
| Failure msg -> (
Stdlib.prerr_endline msg ;
exit 1
)
let command =
let open Command.Let_syntax in
......@@ -197,10 +214,10 @@ let command =
flag "--np" (optional int) ~doc:"INT Number of available processors"
and mem =
flag "--mem" (optional int) ~doc:"INT Available memory (in GB)"
and use_tdg09 =
flag "--tdg09" no_arg ~doc:" Use TDG09 method"
and methods =
flag "--methods" (optional_with_default [] (Command.Arg_type.comma_separated string)) ~doc:"STRING_LIST List of methods to be used"
in
main
~tree_file ~alignment_dir ~convergent_species_file ~outdir ~np ~mem
~use_tdg09
~methods
]
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