Subject: | Large time discrepency between the clado and phylo mode in Treedrawer |
Hi Rutger,
I noticed that drawing trees using the clado mode instead of the phylo
mode took much longer. This is not very noticeable for small tree, but
the difference grows exponentially with larger trees.
Attached is a test tree file and a script to time its drawing. At first
I got results such as:
Drawing the tree in PHYLO mode 1 times took 9 wallclock secs ( 9.21 usr
+ 0.00 sys = 9.21 CPU)
Drawing the tree in CLADO mode 1 times took 168 wallclock secs (162.56
usr + 0.19 sys = 162.75 CPU)
After modifying some code in Treedrawer.pm (attached), the time for
drawing cladograms is much reduced:
Drawing the tree in PHYLO mode 10 times took 47 wallclock secs (46.08
usr + 0.02 sys = 46.10 CPU)
Drawing the tree in CLADO mode 10 times took 53 wallclock secs (51.84
usr + 0.06 sys = 51.90 CPU)
Could you include these updates in your module Rutger? Thanks!
Subject: | itol_newick.tre |
Message body not shown because it is not plain text.
Subject: | Treedrawer_updated.pm |
Message body is not shown because it is too large.
Subject: | phylo_clado_time.pl |
use warnings;
use strict;
use Benchmark qw(:all);
use Bio::Phylo::IO 'parse';
use Bio::Phylo::Treedrawer;
# Read tree data
my $file = 'itol_newick.tre';
my $tree = parse( -format => 'newick', -file => $file )->first;
# Create SVG tree string
my $treedrawer = Bio::Phylo::Treedrawer->new(
-width => 800,
-height => 600,
-shape => 'CURVY',
-format => 'SVG'
);
my $nof_reps = 10;
for my $mode ('PHYLO', 'CLADO') {
$treedrawer->set_mode($mode);
$treedrawer->set_tree($tree);
my $start = new Benchmark;
for my $i (0..$nof_reps-1) {
my $svg_tree = $treedrawer->draw;
}
my $end = new Benchmark;
my $time = timestr(timediff($end, $start));
print "Drawing the tree in $mode mode $nof_reps times took $time\n";
}