Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 2e8d5ff5 authored by Philippe Veber's avatar Philippe Veber
Browse files

toolbox/Candidate_site: more general type

parent b46d403c
......@@ -12,6 +12,6 @@ let () =
)
|> Top.eval
|> Core.(Fn.flip List.take 10)
|> List.iter Reviewphiltrans_toolbox.Candidate_site.(fun x -> print_endline x.alignment_id)
|> List.iter Reviewphiltrans_toolbox.Candidate_site.(fun x -> Option.iter print_endline x.alignment_id)
with
| Failure _ -> ()
......@@ -509,7 +509,7 @@ let%workflow ranking_of_results ~alignment_ids ~convergent_species (alignments :
)
)
in
{ Candidate_site.alignment_id = id ; contents ; pos = s.pos ; score = s.score }
{ Candidate_site.alignment_id = Some id ; contents ; pos = Some s.pos ; score = Some s.score }
in
List.map top_sites ~f:annotate_site
......
......@@ -4,12 +4,32 @@ open Phylogenetics
type tree = (unit, string * char * bool, float) Tree.t
type t = {
alignment_id : string ;
pos : int ;
alignment_id : string option ;
pos : int option ;
contents : tree ;
score : float ;
score : float option ;
}
let make ?alignment_id ?score ~condition tree alignment pos =
let open Phylogenetics in
let leaf_values = List.map alignment ~f:(fun (it : Biotk.Fasta.item) ->
it.description, it.sequence.[pos]
)
in
let contents =
Newick.with_inner_tree tree ~f:(fun t ->
Tree.map t
~node:(fun _ -> ())
~branch:(fun bi -> Option.value_exn bi.length)
~leaf:(fun ni ->
let name = Option.value_exn ni.name in
let aa = List.Assoc.find_exn leaf_values name ~equal:String.equal in
name, aa, condition name
)
)
in
{ alignment_id ; score ; pos = Some pos ; contents }
module Leaf_data = struct
let aa_counts leaf_data =
let leaves =
......@@ -50,10 +70,19 @@ let profiles s =
let k1, k2 = aa_counts s in
profile_of_counts k1, profile_of_counts k2
module Maybe_string = struct
module Base = struct
type t = string option
[@@deriving compare, sexp, hash]
end
include Base
module Table = Hashtbl.Make(Base)
end
let group_by_gene xs =
List.mapi xs ~f:(fun i s -> s.alignment_id, (i, s))
|> String.Table.of_alist_multi
|> String.Table.to_alist
|> Maybe_string.Table.of_alist_multi
|> Maybe_string.Table.to_alist
let tree_add_cond_at_leaves (t : _ Tree.t) =
let open Tree in
......
......@@ -3,17 +3,26 @@ open Phylogenetics
type tree = (unit, string * char * bool, float) Tree.t
type t = {
alignment_id : string ;
pos : int ;
alignment_id : string option ;
pos : int option ;
contents : tree ;
score : float ;
score : float option ;
}
val make :
?alignment_id:string ->
?score:float ->
condition:(string -> bool) ->
Newick_ast.t ->
Biotk.Fasta.item list ->
int ->
t
val aa_counts : t -> int array * int array
val mean_profile : t -> float array
val profiles : t -> float array * float array
val group_by_gene : t list -> (string * (int * t) list) list
val group_by_gene : t list -> (string option * (int * t) list) list
val collapsed_tree :
f:((string * char * bool) list -> 'a) ->
......
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