Bio-Phylo
view release on metacpan or search on metacpan
lib/Bio/Phylo/Treedrawer/Abstract.pm view on Meta::CPAN
my $tips = $self->_tree->get_root->get_terminals;
$self->_tree->set_meta_object( 'map:tree_size' => scalar(@$tips) );
}
$logger->debug("going to draw clade label");
$self->_draw_clade_label($node);
}
}
);
$logger->debug("going to draw node pie charts");
$self->_draw_pies;
$logger->debug("going to draw legend");
$self->_draw_legend;
return $self->_finish;
}
sub _draw_pies {
my $self = shift;
$logger->warn( ref($self) . " can't draw pies" );
}
sub _draw_legend {
my $self = shift;
$logger->warn( ref($self) . " can't draw a legend" );
}
sub _finish {
my $self = shift;
throw 'NotImplemented' => ref($self) . " won't complete its drawing";
}
sub _draw_text {
my $self = shift;
throw 'NotImplemented' => ref($self) . " can't draw text";
lib/Bio/Phylo/Treedrawer/Processing.pm view on Meta::CPAN
$$api .=
" drawArc($cx,$cy,$r,0,1,$color,$start,$stop);\n";
$start += $slice;
}
}
}
}
);
}
sub _draw_legend {
my $self = shift;
if (%colors) {
my $api = $self->_api;
my $tree = $self->_tree;
my $draw = $self->_drawer;
my @keys = keys %colors;
my $increment =
( $tree->get_tallest_tip->get_x - $tree->get_root->get_x ) /
scalar @keys;
my $x = sprintf( "%.3f", $tree->get_root->get_x + 5 );
lib/Bio/Phylo/Treedrawer/Processing.pm view on Meta::CPAN
'-y' => int( $draw->get_height - 60 ),
'-text' => $key || ' ',
);
$x += $increment;
}
$self->_draw_text(
'-x' => int(
$tree->get_tallest_tip->get_x + $draw->get_text_horiz_offset
),
'-y' => int( $draw->get_height - 80 ),
'-text' => 'Node value legend',
);
}
}
sub _finish {
my $self = shift;
my $commands = $self->_api;
my $tmpl = do { local $/; <DATA> };
return sprintf( $tmpl,
__PACKAGE__, my $time = localtime(),
lib/Bio/Phylo/Treedrawer/Svg.pm view on Meta::CPAN
}
}
}
}
);
}
=begin comment
Type : Internal method.
Title : _draw_legend
Usage : $svg->_draw_legend();
Function: Draws likelihood pie legend
Returns :
Args : None
=end comment
=cut
sub _draw_legend {
my $self = shift;
if (%colors) {
my $svg = $self->_api;
my $tree = $self->_tree;
my $draw = $self->_drawer;
my @keys = keys %colors;
my $increment =
( $tree->get_tallest_tip->get_x - $tree->get_root->get_x ) /
scalar @keys;
my $x = $tree->get_root->get_x + 5;
foreach my $key (@keys) {
$svg->rectangle(
'x' => $x,
'y' => ( $draw->get_height - 90 ),
'width' => ( $increment - 10 ),
'height' => 10,
'id' => 'legend_' . $key,
'style' => {
'fill' => $colors{$key},
'stroke' => 'black',
'stroke-width' => '1',
},
);
$self->_draw_text(
'-x' => $x,
'-y' => ( $draw->get_height - 60 ),
'-text' => $key || ' ',
'class' => 'legend_label'
);
$x += $increment;
}
$self->_draw_text(
'-x' =>
( $tree->get_tallest_tip->get_x + $draw->get_text_horiz_offset ),
'-y' => ( $draw->get_height - 80 ),
'-text' => 'Node value legend',
'class' => 'legend_text',
);
}
}
=head1 SEE ALSO
There is a mailing list at L<https://groups.google.com/forum/#!forum/bio-phylo>
for any user or developer questions and discussions.
=over
( run in 1.012 second using v1.01-cache-2.11-cpan-49f99fa48dc )