Module Cgr.Tree

module Tree: Cgr_tree
Digital Search Trees based on CGR.

val tree_of_sequence : [ `Big of Cgr_types.big_sequence | `Small of Cgr_types.sequence ] ->
Build a tree from the given sequence.
val stats_of_tree : Cgr_types.tree -> Cgr_types.tree_stats
Compute statistics on the given tree.
val store_tree : Cgr_types.tree -> string -> unit
store_tree tree file stores the given tree in the given file.
val load_tree : string -> Cgr_types.tree
load_file file reads a tree from the given file.
val store_tree_stats : Cgr_types.tree_stats -> string -> unit
store_tree_stats stats file stores the given tree stats in the given file.
val load_tree_stats : string -> Cgr_types.tree_stats
load_tree_stats file reads tree stats from the given file.
val store_tree_stats_channel : Cgr_types.tree_stats -> Pervasives.out_channel -> unit
store_tree_stats_channel stats oc stores the given tree stats in the given out_channel.
val load_tree_stats_channel : Pervasives.in_channel -> Cgr_types.tree_stats
load_tree_stats_channel file reads tree stats from the given channel.
val gen_dot_channel : Pervasives.out_channel -> Cgr_types.tree -> unit
gen_dot_channel oc t generates dot code for the tree t in the given channel.
val gen_dot_file : string -> Cgr_types.tree -> unit
gen_dot_file t generates dot code for the tree t in the given file.
val norm_quad_points_of_tree : Cgr_types.tree -> (float * float) list
norm_quad_points_of_tree tree returns the list of the "normalized quad" from the given tree.
val print_tree_stats : Pervasives.out_channel -> Cgr_types.tree_stats -> unit
print_tree_stats oc stats prints the given tree stats on the given channel.
val tree_stats_cache_file_of_seq_file : string -> int -> string
tree_stats_cache_file_of_seq_file file length returns the cache file for the given sequence file and length.
val x_branch_length : Cgr_types.tree -> Cgr_types.nucleotide -> int


val compute_dists : (Cgr_types.tree_stats -> Cgr_types.tree_stats -> float) ->
string list -> (string, float) Cgr_distances.dist_matrix
Compute distances on the given sequence files. Take the function used to compute distance between two tree_stats.
val stats_diff_L1 : Cgr_types.tree_stats -> Cgr_types.tree_stats -> float
val stats_diff_L1n : Cgr_types.tree_stats -> Cgr_types.tree_stats -> float
val stats_diff_L2 : Cgr_types.tree_stats -> Cgr_types.tree_stats -> float
val stats_diff_L2n : Cgr_types.tree_stats -> Cgr_types.tree_stats -> float
val stats_diff_LP1 : Cgr_types.tree_stats -> Cgr_types.tree_stats -> float
val stats_diff_LP1n : Cgr_types.tree_stats -> Cgr_types.tree_stats -> float
val stats_diff_LP2 : Cgr_types.tree_stats -> Cgr_types.tree_stats -> float
val stats_diff_LP2n : Cgr_types.tree_stats -> Cgr_types.tree_stats -> float
val stats_diff_D3 : Cgr_types.tree_stats -> Cgr_types.tree_stats -> float
val stats_diff_D3n : Cgr_types.tree_stats -> Cgr_types.tree_stats -> float
val stats_diff_D4 : Cgr_types.tree_stats -> Cgr_types.tree_stats -> float
val stats_diff_D4n : Cgr_types.tree_stats -> Cgr_types.tree_stats -> float


val get_saturation_level : Cgr_types.tree -> Cgr_types.tree_stats -> int * Cgr_types.sequence list
Return the first level not filled and the missing sequences, for the given tree and the associated statistics.

Comparing to binomials laws

val compare_binomial : Cgr_types.tree -> Cgr_types.probs
val compute_binomial_dists : int ->
(Cgr_types.probs -> Cgr_types.probs -> float) ->
string list -> (string, float) Cgr_distances.dist_matrix

Probs of sequences

val probs_seqs_n : int -> Cgr_types.tree -> float array

Working on tree

val insertion_levels_of_tree : int -> Cgr_types.tree -> int * int array
insertion_levels_of_tree length t returns (max, an array a) of length length where a.(i) contains the level of insertion if the node with label i. max is the maximum level of insertion.
val min_max_branches_evolution_of_insertion_levels : int * int array -> (int * int) array
min_max_branches_evolution_of_insertion_levels (max,insertion_levels) retuns the array of (shortest, longest) lengths of branches when the each node was inserted in the tree.

Theorical values

val theo_iid_insertion_depth : probs:Cgr_types.probs -> n:int -> float
Insertion depth from the length and the law of the sequence (IID probabilities).
val theo_iid_min_max_branch_lengths : probs:Cgr_types.probs -> n:int -> float * float
Length of the shortest and longest branches of the tree for the given length n and law (IID probabilities) of original sequence.