pub fn newick2tree(
    arbre: String,
    tree: &mut ArenaTree<String>,
    index: usize,
    num: &mut usize
)
Expand description

Fill an ArenaTree structure with the contents of a parentheses tree.

Examples found in repository?
examples/lca.rs (line 13)
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
fn main() {
    let mut tree: ArenaTree<String> = ArenaTree::default();
    let mut options: Options = Options::new();
    let config: Config = Config::new();
    println!("Reading newick file examples/newick.A4.txt...");
    let contents = fs::read_to_string("examples/newick.A4.txt")
                .expect("Something went wrong reading the newick file");
                println!("Create a first node which will be the root...");
                let root = tree.new_node("Root".to_string());
                println!("Build the tree from the file contents...");
                newick2tree(contents, &mut tree, root, &mut 0);
                let j = tree.get_index("J".to_string()).expect("Error : unable to find J");
                println!("Index of leaf J is {}",j);
                let l = tree.get_index("L".to_string()).expect("Error : unable to find L");
                println!("Index of leaf L is {}",l);
                let n = tree.get_index("N".to_string()).expect("Error : unable to find N");
                println!("Index of leaf N is {}",n);
                let lca_jl = lca(&mut tree,j,l);
                println!("Index of lca betwen J and L is {}",lca_jl);
                tree.arena[lca_jl].name = "LCA of J and L".to_string();
                let lca_jn = lca(&mut tree,j,n);
                println!("Index of lca betwen J and N is {}",lca_jn);
                tree.arena[lca_jn].name = "LCA of J and N".to_string();
                // Display internal nodes
                options.gene_internal = true ;
                phyloxml_processing(&mut tree, &options, &config,"lca.svg".to_string());

                println!("Please open output file 'lca.svg' with your browser");
                println!("OK.");
}