NAME

Bio::Phylo::Parsers::Nexus - A library for parsing Nexus files

SYNOPSIS

my $nexus = new Bio::Phylo::Parsers::Nexus;
$nexus->parse(-file => 'data.nex', -format => 'nexus');

DESCRIPTION

This module parses nexus files. The parser can only handle files with a single tree, taxon, and characters block.

CONSTRUCTOR

new()
Type    : Constructor
Title   : new
Usage   : my $newick = new Bio::Phylo::Parsers::Nexus;
Function: Initializes a Bio::Phylo::Parsers::Nexus object.
Returns : A Bio::Phylo::Parsers::Nexus object.
Args    : none.

PARSER

from_handle(\*FH)
Type    : Wrapper
Title   : from_handle(\*FH)
Usage   : $nexus->from_handle(\*FH);
Function: Does all the parser magic, from a file handle
Returns : L<Phylo>
Args    : \*FH = file handle
parse_handle(%options)

This method needs to be able to handle multiple tree blocks and multiple characters blocks. Also, where matches are performed on patterns that are potentially multiple words (e.g. NTAX = 10 instead of NTAX=10) it is assumed that all words are on the same line. This is not a requirement of the nexus specification, but it seemed easier. This needs to be changed.

Type    : Parsers
Title   : parse_handle(\*FH)
Usage   : $nexus->parse_handle(\*FH);
Function: Creates (file) handle, dispatches parser functions.
Returns : Local arrays.
Args    : \*FH is a reference to a file handle
_parse_taxa(\@taxa)
Type    : Parsers
Title   : _parse_taxa(\@taxa)
Usage   : $nexus->_parse_taxa(\@taxa);
Function: Creates Bio::Phylo::Taxa object from array of taxon names.
Returns : A Bio::Phylo::Taxa object
Args    : A reference to an array holding taxon names.
_parse_char(\@chars)
Type    : Parsers
Title   : _parse_char(\@chars)
Usage   : $nexus->_parse_char(\@chars);
Function: Creates Bio::Phylo::Matrices::Matrix object from a character state
          matrix.
Returns : A Bio::Phylo::Matrices::Matrix object
Args    : A reference to an array holding a character state matrix.
_parse_trees(\@trees)
Type    : Parsers
Title   : _parse_trees(\@trees)
Usage   : $nexus->_parse_trees(\@trees);
Function: Creates Bio::Phylo::Trees object from an array of trees.
Returns : A Bio::Phylo::Trees object
Args    : A reference to an array holding newick trees.
_parse_comm()
Type    : _parse_comm
Title   : _parse_comm()
Usage   : $nexus->_parse_comm();
Function: Parses nexus comments
Returns : Nothing yet.
Args    : none.

AUTHOR

Rutger Vos, <rvosa@sfu.ca>

BUGS

Please report any bugs or feature requests to bug-phylo@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Phylo. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

The author would like to thank Jason Stajich for many ideas borrowed from BioPerl http://www.bioperl.org, and CIPRES http://www.phylo.org and FAB* http://www.sfu.ca/~fabstar for comments and requests.

COPYRIGHT & LICENSE

Copyright 2005 Rutger Vos, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.