[Bioperl-l] How to color leaves of a tree by Bio::Tree::Draw::Cladogram?
longbow leo
longbow0 at gmail.com
Wed Aug 31 15:48:16 UTC 2011
Dear all,
I am using the module Bio::Tree::Draw::Cladogram to create a tree diagram.
But when I tried to color the tree leaves, the diagram was still without any
colors.
How can I color tree leave? Thanks in advance.
Here is my script:
######################################################################
#!/usr/bin/perl
use strict;
use warnings;
use Bio::TreeIO;
use Bio::Tree::Draw::Cladogram;
my $treei = Bio::TreeIO->new(
-fh => \*DATA,
-format => 'newick',
);
my $tree = $treei->next_tree;
# Color node 'B' to red
my ($nodeB) = $tree->find_node( -id => 'B' );
$nodeB->add_tag_value('Rcolor', 1);
$nodeB->add_tag_value('Gcolor', 0);
$nodeB->add_tag_value('Bcolor', 0);
my $cg = Bio::Tree::Draw::Cladogram->new(
-tree => $tree,
);
$cg->print( -file => 'mytree.eps' );
__DATA__
(((A:5,B:5)90:2,C:4)25:3,D:10);
######################################################################
Regards,
Haizhou
More information about the Bioperl-l
mailing list