[Bioperl-l] How to color leaves of a tree by Bio::Tree::Draw::Cladogram?
Roy Chaudhuri
roy.chaudhuri at gmail.com
Wed Aug 31 16:02:30 UTC 2011
Hi Haizhou,
I think you need to specify -colors=>1 in your
Bio::Tree::Draw::Cladogram constructor:
my $cg = Bio::Tree::Draw::Cladogram->new(
-tree => $tree,
-colors => 1
);
Not sure why this isn't on by default.
Roy.
On 31/08/2011 16:48, longbow leo wrote:
> 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
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
More information about the Bioperl-l
mailing list