Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
VEBER Philippe
codepi
Commits
9be15cf6
Commit
9be15cf6
authored
Dec 20, 2020
by
Philippe Veber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run: command-line choice of methods
parent
45225422
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
24 deletions
+41
-24
lib/run.ml
lib/run.ml
+41
-24
No files found.
lib/run.ml
View file @
9be15cf6
...
...
@@ -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 metho
d"
and
methods
=
flag
"--
methods"
(
optional_with_default
[]
(
Command
.
Arg_type
.
comma_separated
string
))
~
doc
:
"STRING_LIST List of methods to be use
d"
in
main
~
tree_file
~
alignment_dir
~
convergent_species_file
~
outdir
~
np
~
mem
~
use_tdg09
~
methods
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment