Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
VEBER Philippe
codepi
Commits
bcc0415c
Commit
bcc0415c
authored
Oct 25, 2020
by
Philippe Veber
Browse files
added signature for simulation_dataset
parent
e336f30c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
22 deletions
+71
-22
app/diffseldsparse_benchmark.ml
app/diffseldsparse_benchmark.ml
+4
-8
lib/simulation_dataset.ml
lib/simulation_dataset.ml
+15
-14
lib/simulation_dataset.mli
lib/simulation_dataset.mli
+52
-0
No files found.
app/diffseldsparse_benchmark.ml
View file @
bcc0415c
...
...
@@ -4,14 +4,10 @@ open Reviewphiltrans
let
main
~
n_h0
~
n_ha
~
seed
:
i
()
=
let
open
Simulation_dataset
in
let
sim
=
Bppseqgen_mixed
{
tree
=
`NHX
"example/trees_analyses/cyp_coding.Chrysithr_root.nhx"
;
profiles
=
"example/aa_fitness/263SelectedProfiles.tsv"
;
n_h0
;
n_ha
;
ne_s
=
4
.
;
seed
=
i
;
}
bppseqgen_mixed_simulation
~
tree
:
(
NHX
"example/trees_analyses/cyp_coding.Chrysithr_root.nhx"
)
~
profiles
:
"example/aa_fitness/263SelectedProfiles.tsv"
~
n_h0
~
n_ha
~
ne_s
:
4
.
~
seed
:
i
()
in
let
w
=
benchmark
sim
in
Bistro_engine
.
Scheduler
.
simple_eval_exn
~
np
:
4
~
mem
:
(
`GB
4
)
(
Bistro
.
Workflow
.
path
w
)
...
...
lib/simulation_dataset.ml
View file @
bcc0415c
...
...
@@ -6,7 +6,13 @@ let calc_fixed_seed ~(str:string) (seed:int) : int =
let
str_hash
=
Hashtbl
.
hash
str
in
Hashtbl
.
hash
(
str_hash
+
seed
)
type
tree
=
[
`NHX
of
string
|
`Pair_tree
of
float
*
float
*
int
]
type
tree
=
|
NHX
of
string
|
Pair_tree
of
{
npairs
:
int
;
branch_length1
:
float
;
branch_length2
:
float
;
}
type
t
=
|
Bppseqgen_simulation
of
{
...
...
@@ -67,10 +73,10 @@ let convdet_simulation ?(branch_factor = 1.) ?(ne_s = 1., 1.) ?(gBGC = 0., 0.) ?
}
let
prefix_of_tree
=
function
|
`
NHX
path
->
|
NHX
path
->
Caml
.
Filename
.
chop_extension
path
|
`
Pair_tree
(
bl1
,
bl2
,
np
)
->
sprintf
"pair_tree(bl1=%g,bl2=%g,np=%d)"
b
l1
bl2
np
|
Pair_tree
{
branch_length1
;
branch_length2
;
npairs
}
->
sprintf
"pair_tree(bl1=%g,bl2=%g,np=%d)"
b
ranch_length1
branch_length2
npairs
let
tree_prefix
=
function
|
Bppseqgen_simulation
{
tree
;
_
}
...
...
@@ -83,18 +89,13 @@ let tree ~branch_length_unit:_ = function
|
Bppseqgen_mixed
{
tree
;
_
}
|
Convdet_simulation
{
tree
;
_
}
->
match
tree
with
|
`
NHX
path
->
|
NHX
path
->
Workflow
.
input
path
|
`
Pair_tree
(
branch_length1
,
branch_length2
,
npairs
)
->
|
Pair_tree
{
branch_length1
;
branch_length2
;
npairs
}
->
Simulator
.
pair_tree
~
branch_length1
~
branch_length2
~
npairs
let
tree_dataset
sim
=
Tree_dataset
.
prepare
~
descr
:
(
"simulated_data."
^
(
tree_prefix
sim
))
(
tree
~
branch_length_unit
:
`Nucleotide
sim
)
let
seed
=
function
|
Bppseqgen_mixed
s
->
s
.
seed
|
Bppseqgen_simulation
s
->
s
.
seed
...
...
@@ -227,7 +228,7 @@ let explore_params ~(f: param_t -> _) =
let
simu_of_param
?
n_h0
:
(
n_h0
=
50
)
(
p
:
param_t
)
=
let
bf
,
gbgc
=
p
in
convdet_simulation
~
tree
:
(
`
NHX
"example/trees_analyses/C4AmaranthaceaePolyroot.nhx"
)
~
tree
:
(
NHX
"example/trees_analyses/C4AmaranthaceaePolyroot.nhx"
)
~
profiles
:
"example/aa_fitness/263SelectedProfiles.tsv"
~
branch_factor
:
bf
~
gBGC
:
(
match
gbgc
with
...
...
lib/simulation_dataset.mli
0 → 100644
View file @
bcc0415c
open
Bistro
type
tree
=
|
NHX
of
string
|
Pair_tree
of
{
npairs
:
int
;
branch_length1
:
float
;
branch_length2
:
float
;
}
type
t
val
bppseqgen_mixed_simulation
:
?
ne_s
:
float
->
?
seed
:
int
->
tree
:
tree
->
profiles
:
string
->
n_h0
:
int
->
n_ha
:
int
->
unit
->
t
val
bppseqgen_simulation
:
hyp
:
Convergence_hypothesis
.
t
->
tree
:
tree
->
profiles
:
string
->
nb_sites
:
int
->
seed
:
int
->
t
val
convdet_simulation
:
?
branch_factor
:
float
->
?
ne_s
:
float
*
float
->
?
gBGC
:
float
*
float
->
?
seed
:
int
->
tree
:
tree
->
profiles
:
string
->
n_h0
:
int
->
n_ha
:
int
->
unit
->
t
include
Detection_pipeline
.
Query
with
type
t
:=
t
include
Detection_pipeline
.
S
with
type
query
:=
t
val
alignment_plot
:
t
->
svg
file
val
multinomial_benchmark
:
t
->
pdf
file
val
benchmark
:
?
mode
:
[
`fast
|
`full
]
->
t
->
svg
file
val
benchmark2
:
t
->
pdf
file
(** stuff for gbgc SBME paper *)
type
gBGC_t
=
Global
of
float
|
Convergent
of
float
*
float
type
param_t
val
explore_params
:
f
:
(
param_t
->
'
a
)
->
((
float
*
gBGC_t
)
*
'
a
)
list
val
simu_of_param
:
?
n_h0
:
int
->
param_t
->
t
val
filter_results
:
f
:
(
'
a
->
bool
)
->
(
param_t
*
'
a
)
list
->
(
param_t
*
'
a
)
list
type
record_t
val
record_of_simu
:
t
->
record_t
workflow
val
realistic_result
:
record_t
->
bool
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