NAME

Bio::Phylo::PhyloWS::Service::Tolweb - PhyloWS service wrapper for Tree of Life

SYNOPSIS

# inside a CGI script:
use CGI;
use Bio::Phylo::PhyloWS::Service::Tolweb;

my $cgi = CGI->new;
my $service = Bio::Phylo::PhyloWS::Service::Tolweb->new( '-url' => $url );
$service->handle_request($cgi);

DESCRIPTION

This is an example implementation of a PhyloWS service. The service wraps around the Tree of Life XML services described at http://tolweb.org/tree/home.pages/downloadtree.html.

When doing a record lookup this service returns project objects that include the focal node (identified by its PhyloWS ID) and the nearest child and parent nodes that have web pages.

When querying, this service returns a project object with one taxa block containing zero or more taxon objects that matched the query.

When URLs to this service specify format=html in the query string, this service returns redirect URLs to web pages on the Tree of Life web project site at http://tolweb.org. The redirect URLs either point to search result listings or to node pages, depending on whether the redirect is for a record query or a record lookup, respectively.

METHODS

ACCESSORS

get_record()

Gets a tolweb record by its id

Type    : Accessor
Title   : get_record
Usage   : my $record = $obj->get_record( -guid => $guid );
Function: Gets a tolweb record by its id
Returns : Bio::Phylo::Project
Args    : Required: -guid => $guid
Comments: For the $guid argument, this method only cares
          whether the last part of the argument is a series
          of integers, which are understood to be the node
          identifier in the Tree of Life
get_redirect()

Gets a redirect URL if relevant

Type    : Accessor
Title   : get_redirect
Usage   : my $url = $obj->get_redirect;
Function: Gets a redirect URL if relevant
Returns : String
Args    : $cgi
Comments: This method is called by handle_request so that
          services can 303 redirect a record lookup to 
          another URL. By default, this method returns 
          undef (i.e. no redirect), but if this implementation
          is called to handle a request that specifies 
          'format=html' the request is forwarded to the
          appropriate page on the http://tolweb.org website
get_query_result()

Gets a query result and returns it as a project object

Type    : Accessor
Title   : get_query_result
Usage   : my $proj = $obj->get_query_result($query);
Function: Gets a query result
Returns : Bio::Phylo::Project
Args    : A simple query string for a group search
Comments: The $query is a simple CQL level 0 term-only query
get_supported_formats()

Gets an array ref of supported formats

Type    : Accessor
Title   : get_supported_formats
Usage   : my @formats = @{ $obj->get_supported_formats };
Function: Gets an array ref of supported formats
Returns : [ qw(nexml nexus newick html json phyloxml rss1) ]
Args    : NONE
get_authority()

Gets the authority prefix (e.g. TB2) for the implementing service

Type    : Abstract Accessor
Title   : get_authority
Usage   : my $auth = $obj->get_authority;
Function: Gets authority prefix
Returns : 'ToL'
Args    : None

SEE ALSO

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

CITATION

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

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