Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use lib '/home/egstation/applications/bioperl-live'; #we check out the latest SVN code
- use Bio::TreeIO;
- use Bio::Tree::Tree;
- use Data::Dumper;
- use Bio::Tree::Draw::Cladogram;
- my $treeio = Bio::TreeIO->new(-file => "HSF.phyloxml",
- -format => "phyloxml");
- my $tree = $treeio->next_tree;
- my @nodes = $tree->get_nodes;
- my $nodeid;
- for (my $i=0; $i<=$#nodes;$i++){
- if($nodes[$i]->id eq 'LOC_Os08g43334.2'){
- $nodeid=$i;
- }
- }
- my $ance = $nodes[$nodeid]->ancestor;
- my $count=0;
- for my $child($ance->get_all_Descendents){
- if($child->id){
- $count++;
- }
- }
- my $copy = $ance;
- while($count<5){
- $count=0;
- my $new_anc = $copy->ancestor;
- for my $child($new_anc->get_all_Descendents){
- if($child->id){
- $count++;
- }
- }
- $copy = $new_anc;
- }
- my @children;
- for my $child($copy->get_all_Descendents){
- push(@children,$child);
- }
- my $new_root = $tree->get_lca( -nodes => \@children);
- my $subtree = Bio::Tree::Tree->new(-root => $new_root, -nodelete => 1);
- my $image_output = "test.eps";
- my $obj1 = Bio::Tree::Draw::Cladogram->new(-tree => $subtree,
- -top => 10,
- -bottom => 10,);
- $obj1->print(-file => $image_output);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement