Function light_phylogeny::phyloxml_processing
source ยท pub fn phyloxml_processing(
tree: &mut ArenaTree<String>,
options: &Options,
config: &Config,
outfile: String,
)
Expand description
Create a svg of the tree in phyloxml context.
Examples found in repository?
More examples
examples/lca.rs (line 28)
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.");
}
examples/read_phyloxml_stroke_thickness.rs (line 10)
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 33 34 35 36 37 38 39 40 41 42 43
fn main() {
let mut tree: ArenaTree<String> = ArenaTree::default();
let mut options: Options = Options::new();
options.rotate = false;
let config: Config = Config::new();
read_phyloxml("examples/FAM036542_gene.xml".to_string(), &mut tree);
phyloxml_processing(&mut tree, &options, &config,"read_phyloxml_stroke_thickness_1.svg".to_string());
println!("Please open output file 'read_phyloxml_stroke_thickness_1.svg' with your browser");
let mut tree: ArenaTree<String> = ArenaTree::default();
let mut options: Options = Options::new();
options.rotate = false;
options.gthickness = 1;
let config: Config = Config::new();
read_phyloxml("examples/FAM036542_gene.xml".to_string(), &mut tree);
phyloxml_processing(&mut tree, &options, &config,"read_phyloxml_stroke_thickness_2.svg".to_string());
println!("Please open output file 'read_phyloxml_stroke_thickness_2.svg' with your browser");
let mut tree: ArenaTree<String> = ArenaTree::default();
let mut options: Options = Options::new();
options.rotate = false;
options.gthickness = 6;
let config: Config = Config::new();
read_phyloxml("examples/FAM036542_gene.xml".to_string(), &mut tree);
phyloxml_processing(&mut tree, &options, &config,"read_phyloxml_stroke_thickness_3.svg".to_string());
println!("Please open output file 'read_phyloxml_stroke_thickness_3.svg' with your browser");
let mut tree: ArenaTree<String> = ArenaTree::default();
let mut options: Options = Options::new();
options.rotate = false;
options.gthickness = 2;
options.squaresize = 15.0;
let config: Config = Config::new();
read_phyloxml("examples/FAM036542_gene.xml".to_string(), &mut tree);
phyloxml_processing(&mut tree, &options, &config,"read_phyloxml_stroke_thickness_4.svg".to_string());
println!("Please open output file 'read_phyloxml_stroke_thickness_4.svg' with your browser");
}
examples/build_tree.rs (line 56)
2 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
fn main() {
let mut tree: ArenaTree<String> = ArenaTree::default();
let mut options: Options = Options::new();
let config: Config = Config::new();
// Create a new node root
let root = tree.new_node("root".to_string());
// Create new nodes
let a1 = tree.new_node("a1".to_string());
let a2 = tree.new_node("a2".to_string());
let a = tree.new_node("a".to_string());
let b = tree.new_node("b".to_string());
let c = tree.new_node("c".to_string());
let d = tree.new_node("d".to_string());
println!("Initial tree :");
summary(&mut tree);
// Set names
tree.arena[root].name = "MyRoot".to_string();
tree.arena[a].name = "Gene A".to_string();
tree.arena[a1].name = "Gene A1".to_string();
tree.arena[a2].name = "Gene A2".to_string();
tree.arena[b].name = "Gene B".to_string();
tree.arena[c].name = "Gene C".to_string();
tree.arena[d].name = "Gene D".to_string();
println!("");
println!("Tree after name attribution:");
summary(&mut tree);
// Set hierarchy
// a1 and a2 are children of a
tree.arena[a1].parent = Some(a);
tree.arena[a2].parent = Some(a);
tree.arena[a].children.push(a1);
tree.arena[a].children.push(a2);
// a and b are children of c
tree.arena[a].parent = Some(c);
tree.arena[b].parent = Some(c);
tree.arena[c].children.push(a);
tree.arena[c].children.push(b);
// c and d are children of root
tree.arena[c].parent = Some(root);
tree.arena[d].parent = Some(root);
tree.arena[root].children.push(c);
tree.arena[root].children.push(d);
println!("");
println!("Tree after hierarchy attribution:");
summary(&mut tree);
// set duplication
tree.arena[a].e = Event::Duplication;
println!("");
println!("Event associated to gene {} ({}) : {:?}",a,tree.arena[a].name,tree.arena[a].e);
// Display internal nodes
options.gene_internal = true ;
phyloxml_processing(&mut tree, &options, &config,"build_tree.svg".to_string());
println!("Please open output file 'build_tree.svg' with your browser");
println!("OK.");
}
examples/read_phyloxml_tidy.rs (line 15)
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
fn main() {
// landscape
let mut tree: ArenaTree<String> = ArenaTree::default();
let mut options: Options = Options::new();
options.real_length_flag = true;
options.scale = 4.0;
options.support = true;
options.gene_internal = true;
options.rotate = false;
// options.branch = true;
let config: Config = Config::new();
read_phyloxml("examples/apaf_name.xml".to_string(), &mut tree);
phyloxml_processing(&mut tree, &options, &config,"read_phyloxml_dist_real.svg".to_string());
println!("Please open output file 'read_phyloxml_dist_real.svg' with your browser");
// landscape + tidy
let mut tree: ArenaTree<String> = ArenaTree::default();
let mut options: Options = Options::new();
options.real_length_flag = true;
options.scale = 4.0;
options.support = true;
options.gene_internal = true;
options.rotate = false;
options.tidy = true;
// options.branch = true;
let config: Config = Config::new();
read_phyloxml("examples/apaf_name.xml".to_string(), &mut tree);
phyloxml_processing(&mut tree, &options, &config,"read_phyloxml_dist_real_tidy.svg".to_string());
println!("Please open output file 'read_phyloxml_dist_real_tidy.svg' with your browser");
// portrait
let mut tree: ArenaTree<String> = ArenaTree::default();
let mut options: Options = Options::new();
options.real_length_flag = true;
options.scale = 4.0;
options.support = true;
options.gene_internal = true;
// options.rotate = false;
// options.branch = true;
let config: Config = Config::new();
read_phyloxml("examples/apaf_name.xml".to_string(), &mut tree);
phyloxml_processing(&mut tree, &options, &config,"read_phyloxml_dist_real_portrait.svg".to_string());
println!("Please open output file 'read_phyloxml_dist_real_portrait.svg' with your browser");
// portrait + tidy
let mut tree: ArenaTree<String> = ArenaTree::default();
let mut options: Options = Options::new();
options.real_length_flag = true;
options.scale = 4.0;
options.support = true;
options.gene_internal = true;
// options.rotate = false;
options.tidy = true;
// options.branch = true;
let config: Config = Config::new();
read_phyloxml("examples/apaf_name.xml".to_string(), &mut tree);
phyloxml_processing(&mut tree, &options, &config,"read_phyloxml_dist_real_tidy_portrait.svg".to_string());
println!("Please open output file 'read_phyloxml_dist_real_tidy_portrait.svg' with your browser");
}
Additional examples can be found in:
- examples/modify_tree.rs
- examples/read_recphyloxml_width_height.rs
- examples/read_recphyloxml_2.rs
- examples/read_phyloxml_tidy_virus.rs
- examples/read_newick.rs
- examples/read_phyloxml.rs
- examples/read_recphyloxml_3.rs
- examples/read_recphyloxml_multi.rs
- examples/read_recphyloxml_thirdlevel_5.rs
- examples/read_recphyloxml_thirdlevel_6.rs
- examples/read_recphyloxml_thirdlevel_bug.rs
- examples/read_recphyloxml_thirdlevel_1.rs
- examples/read_recphyloxml_thirdlevel_3.rs
- examples/read_recphyloxml_thirdlevel_1_midist.rs
- examples/read_recphyloxml_thirdlevel_2.rs
- examples/read_recphyloxml_thirdlevel_stroke.rs
- examples/read_recphyloxml_thirdlevel_fl.rs
- examples/read_recphyloxml_thirdlevel_alex.rs
- examples/read_recphyloxml_thirdlevel_4.rs
- examples/read_recphyloxml_thirdlevel_4_landscape.rs
- examples/read_recphyloxml.rs