Bio::Phylo::Unparsers::Phylip - Serializer used by Bio::Phylo::IO, no serviceable parts inside


This module unparses a Bio::Phylo data structure into an input file for PHYLIP and RAxML. The file format (as it is interpreted here) consists of:

first line

the number of species, a space, the number of characters

subsequent lines

ten-character species name, sequence

Here is an example of what the output might look like:

 4 2
 Species_1 AC
 Species_2 AG
 Species_3 GT
 Species_4 GG

To the unparse() function pass a matrix object or a project (whose first matrix will be serialized) as value of the '-phylo' argument. After serialization, any shortened phylip-specific names (which need to be 10 characters long) will have been assigned to the 'phylip_name' slot of set_generic. Example:

 my $phylip_string = unparse(
        -format => 'phylip',
        -phylo  => $matrix,
 for my $seq ( @{ $matrix->get_entities } ) {
    # this returns the shortened name, which is unique to the matrix
        my $phylip_name = $seq->get_generic('phylip_name');

This default behavior enforces strict compliance with the phylip rule for 10-character row names. It is possible to turn this off by passing in the optional -relaxed flag with a true value, e.g.:

 my $phylip_string = unparse(
        -format  => 'phylip',
        -phylo   => $matrix,
        -relaxed => 1,

The phylip module is called by the Bio::Phylo::IO object, so look there to learn about parsing and serializing in general.


There is a mailing list at!forum/bio-phylo for any user or developer questions and discussions.


The phylip unparser is called by the Bio::Phylo::IO object. Look there to learn how to create phylip formatted files.


Also see the manual: Bio::Phylo::Manual and


If you use Bio::Phylo in published research, please cite it:

Rutger A Vos, Jason Caravas, Klaas Hartmann, Mark A Jensen and Chase Miller, 2011. Bio::Phylo - phyloinformatic analysis using Perl. BMC Bioinformatics 12:63.