[Bioperl-l] How to show branch length value in tree

Shachi Gahoi shachigahoimbi at gmail.com
Wed Aug 3 06:00:44 UTC 2011


Dear All

I am using Bio::Tree modules for constructing and drawing tree. *I am unable
to show branch length value in tree.
*
Please tell me How can I do this, if anybody knows.

Here is my script which i am using...and i also attached generated tree.

Thanks in advance

################################################################################################

use Bio::AlignIO;
use Bio::Align::ProteinStatistics;
use Bio::Tree::DistanceFactory;
use Bio::TreeIO;
use Bio::Tree::Draw::Cladogram;

# for a dna alignment
# can also use ProteinStatistics

my $alnio = Bio::AlignIO->new(-file => 'ADP.aln', -format=>'clustalw');

my $dfactory = Bio::Tree::DistanceFactory->new(-method => 'UPGMA');

my $stats = Bio::Align::ProteinStatistics->new;

my $treeout = Bio::TreeIO->new(-format => 'newick', -file =>'>ADP1.dnd');

while( my $aln = $alnio->next_aln )
{
 my $mat = $stats->distance(-method => 'Kimura', -align  => $aln);

 my $tree = $dfactory->make_tree($mat);
 $treeout->write_tree($tree);
}

my $dir = shift || '.';

opendir(DIR, $dir) || die $!;
for my $file ( readdir(DIR) )
{
    next unless $file =~ /(\S+)\.dnd$/;
    my $stem = $1;
    my $treeio = Bio::TreeIO->new('-format' => 'newick',
                                  '-file'   => "$dir/$file");

    if( my $t1 = $treeio->next_tree )
{
        my $obj1 = Bio::Tree::Draw::Cladogram->new(-bootstrap => 1,
                                                   -tree    => $t1,
                                                   -compact => 0);
        $obj1->print(-file => "$dir/$stem.eps");
    }
}

########################################################################################################

-- 
Regards,
Shachi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ADP1.dnd
Type: application/octet-stream
Size: 1369 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/bioperl-l/attachments/20110803/1da10110/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ADP1.eps
Type: application/postscript
Size: 17718 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/bioperl-l/attachments/20110803/1da10110/attachment-0004.eps>


More information about the Bioperl-l mailing list