rvosa has asked for the wisdom of the Perl Monks concerning the following question:
The Bio::Phylo::Parsers package functions as a facade, that require's the appropriate parser submodule based on the format switch.use Bio::Phylo::Parsers; my $parser = new Bio::Phylo::Parsers; # the newick format contains one or more trees. my $trees = $parser->parse( -format => 'newick', -file => $newickfile +); # the 'taxlist' format is simply a list of names, from # which a taxa object is created my $taxa = $parser->parse( -format => 'taxlist', -file => $taxonfile ) +; # the nexus format is a mixed format, that can contain # trees, taxa, matrices, etc. my $arrayref = $parser->parse( -format => 'nexus', -file => $nexusfile + );
So, based on the "-I_want => " switch, the parser only ever returns what the user wants (if present).my $trees = $parser->parse(-format => 'nexus', -I_want => 'trees', -fi +le => $nexusfile);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parser object to return different objects
by Roger (Parson) on Sep 02, 2005 at 00:48 UTC |