#!/usr/bin/perl -w use strict; use Bio::AlignIO; use Bio::Tree::DistanceFactory; use Bio::Align::ProteinStatistics; use Bio::TreeIO; use Bio::Tree::Draw::Cladogram; my $alnfile = shift @ARGV || die "need a file to run"; my $input= Bio::AlignIO->new(-format => 'fasta', -file => $alnfile); if( my $aln = $input->next_aln ) { my $dfactory = Bio::Tree::DistanceFactory->new(-method => 'NJ'); my $stats = Bio::Align::ProteinStatistics->new; my $distmat = $stats->distance(-align => $aln, -method => 'Kimura'); my $treeout = Bio::TreeIO->new(-format => 'newick'); my $tree = $dfactory->make_tree($distmat); $treeout->write_tree($tree); my $obj1 = Bio::Tree::Draw::Cladogram->new(-tree => $tree, -compact => 0); $obj1->print(-file => "tree.eps"); } else { die "could not find any alignments in the file $alnfile"; }