Bio::Phylo::Parsers::Json - Parser used by Bio::Phylo::IO, no serviceable parts inside


Bio-Phylo documentation Contained in the Bio-Phylo distribution.

Index


Code Index:

NAME

Top

Bio::Phylo::Parsers::Json - Parser used by Bio::Phylo::IO, no serviceable parts inside

DESCRIPTION

Top

This module is used to import NeXML data that was re-formatted as JSON, using the mapping implemented by XML::XML2JSON.

SEE ALSO

Top

Bio::Phylo::IO

The json parser is called by the Bio::Phylo::IO object. Look there to learn how to parse data using Bio::Phylo.

Bio::Phylo::Manual

Also see the manual: Bio::Phylo::Manual and http://rutgervos.blogspot.com

CITATION

Top

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. http://dx.doi.org/10.1186/1471-2105-12-63

REVISION

Top

 $Id: Json.pm 1660 2011-04-02 18:29:40Z rvos $


Bio-Phylo documentation Contained in the Bio-Phylo distribution.
# $Id: Json.pm 1660 2011-04-02 18:29:40Z rvos $
package Bio::Phylo::Parsers::Json;
use strict;
use base 'Bio::Phylo::Parsers::Abstract';
use Bio::Phylo::IO 'parse';
use Bio::Phylo::Util::Exceptions 'throw';
use Bio::Phylo::Util::Dependency 'XML::XML2JSON';

sub _parse {
    my $self = shift;
    my $fh   = $self->_handle;
    my $json = do { local $/; <$fh> };
    my $conf = XML::XML2JSON->new;
    my $xml  = $conf->json2xml($json);
    return @{ parse( '-format' => 'nexml', '-string' => $xml ) };
}

# podinherit_insert_token

1;