Commit 02b0d86b authored by Carine Rey's avatar Carine Rey
Browse files

add option --dnds (calc dn ds dn/ds trees; add option --gt (calc gene trees)

parent ca2ce705
......@@ -16,6 +16,8 @@ let realdata_main ~use_diffsel
~use_topological
~use_identical
~no_use_multinomial
~calc_dnds
~calc_gene_trees
~indir ~outdir ~np ~mem () =
let loggers = [
Console_logger.create () ;
......@@ -37,9 +39,14 @@ let realdata_main ~use_diffsel
sw use_multinomial `Multinomial ;
]
in
let pal = List.filter_opt [
sw calc_dnds `DnDs;
sw calc_gene_trees `GeneTree;
]
in
List.concat [
Repo.shift "Merged_results" (Real_dataset.repo meths rd) ;
Repo.shift "PreParsed_Dataset" (Real_dataset.repo_parsed_rd rd);
Repo.shift "PreParsed_Dataset" (Real_dataset.repo_parsed_rd pal rd);
]
|> Bistro_utils.Repo.build_main ~outdir ~loggers ?np ?mem
......@@ -66,10 +73,10 @@ let realdata_command =
flag "--identical" no_arg ~doc:" use the identical method (fast)."
and no_use_multinomial =
flag "--no-multinomial" no_arg ~doc:" not use the multinomial method (very fast so by default)."
(* and preview =
* flag "--preview-mode" no_arg ~doc:" Preview mode"
* and calc_dnds =
* flag "--dnds" no_arg ~doc:" calculate dn ds dnds trees (slow)."*)
and calc_dnds =
flag "--dnds" no_arg ~doc:" calculate dn ds dnds trees (slow)."
and calc_gene_trees =
flag "--gt" no_arg ~doc:" calculate gene trees (slow)."
and np =
flag "--np" (optional int) ~doc:"INT Number of available processors"
and mem =
......@@ -82,6 +89,8 @@ let realdata_command =
~use_topological
~use_identical
~no_use_multinomial
~calc_dnds
~calc_gene_trees
~indir ~outdir ~np ~mem
]
......
......@@ -17,6 +17,9 @@ module Make(D : Dataset) = struct
let phylip_nucleotide_alignment d =
Bppsuite.fna2phy ~fna:(nucleotide_alignment d)
let gene_tree d =
Tree_dataset.raxmlng_fna ~fna:(nucleotide_alignment d) ()
let identical d =
let tree_sc = Tree_dataset.prepare_sc_tree (tree d) in
let tree_id = Tree_dataset.prepare_tree_with_node_id (tree d) in
......@@ -90,4 +93,12 @@ module Make(D : Dataset) = struct
let tree = tree d in
Pcoc.pcoc ~catx_est:ncat ~plot_complete:false ~gamma ~faa ~tree ()
|> Pcoc.results
let dn_ds_dnds_trees d =
Testnh.dn_ds_trees_real_data ~fna:(nucleotide_alignment d) ~tree:(tree d) ()
let dn_tree d = (dn_ds_dnds_trees d).dn_tsv
let ds_tree d = (dn_ds_dnds_trees d).ds_tsv
let dnds_tree d = (dn_ds_dnds_trees d).dnds_tsv
end
......@@ -17,6 +17,10 @@ type meth =
`Identical |
`Diffsel]
type pa =
[`DnDs |
`GeneTree]
module Family : sig
type dataset = t
type t
......@@ -92,6 +96,12 @@ let maybe_apply_method meths f m =
Some (implementation f m)
else None
let maybe_apply_parralel_analyses pal p =
if List.mem pal p ~equal:Poly.equal then
true
else
false
let result_table meths rd =
let families = families rd in
List.map families ~f:(fun f ->
......@@ -113,13 +123,32 @@ let repo meths rd =
Bistro_utils.Repo.item [name ^ ".tsv"] table
)
let repo_parsed_rd rd =
let repo_parsed_rd pal rd =
let families = families rd in
List.map families ~f:(fun f ->
[
Bistro_utils.Repo.item [(Family.name f) ^ ".faa"] (DP.amino_acid_alignment f);
Bistro_utils.Repo.item [(Family.name f) ^ ".species_tree.nhx"] (Family.tree f);
Bistro_utils.Repo.item [(Family.name f) ^ ".fna"] (Family.nucleotide_alignment f);
Bistro_utils.Repo.item [(Family.name f) ^ ".nw"] (DP.gene_tree f);
] |> Repo.shift (Family.name f );
[
Bistro_utils.Repo.item [(Family.name f) ^ ".faa"] (DP.amino_acid_alignment f);
Bistro_utils.Repo.item [(Family.name f) ^ ".species_tree.nhx"] (Family.tree f);
Bistro_utils.Repo.item [(Family.name f) ^ ".fna"] (Family.nucleotide_alignment f);
];
if (maybe_apply_parralel_analyses pal `GeneTree)
then
[
Bistro_utils.Repo.item [(Family.name f) ^ ".nw"] (DP.gene_tree f);
]
else
[];
if (maybe_apply_parralel_analyses pal `DnDs)
then
[
[ Bistro_utils.Repo.item [(Family.name f) ^ ".dn.tsv"] (DP.dn_tree f);
Bistro_utils.Repo.item [(Family.name f) ^ ".ds.tsv"] (DP.ds_tree f);
Bistro_utils.Repo.item [(Family.name f) ^ ".dnds.tsv"] (DP.dnds_tree f);
] |> Repo.shift "DnDs"
] |> List.concat
else
[];
] |> List.concat
|> Repo.shift (Family.name f )
) |> List.concat
......@@ -13,6 +13,10 @@ type meth =
`Identical |
`Diffsel]
type pa =
[`DnDs |
`GeneTree]
val make :
tree_path:string ->
alignment_dir_path:string ->
......@@ -28,6 +32,7 @@ val repo :
t -> Bistro_utils.Repo.t
val repo_parsed_rd :
pa list ->
t -> Bistro_utils.Repo.t
module Family : sig
......
......@@ -236,7 +236,7 @@ let format_dn_ds ~ali_prefix ~(dn_tree:_ workflow) ~(ds_tree:_ workflow): direct
]
]
let dn_ds_trees_real_data ~ali_prefix ~tree ~fna () : dnds_real=
let dn_ds_trees_real_data ?(ali_prefix="gene") ~tree ~fna () : dnds_real=
let run_bppml = bppml_mapnh ~descr:("."^ali_prefix) ~tree ~fna in
let dn_tree = Workflow.select run_bppml ["mapping_counts_per_type_dN.dnd"] in
let ds_tree = Workflow.select run_bppml ["mapping_counts_per_type_dS.dnd"] in
......
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