Webservice::InterMine::Query::Roles::Runnable - Composable behaviour for runnable queries
This module provides composable behaviour for running a query against a webservice and getting the results.
Returns a results iterator for use with a query.
The following options are available:
as => $format
Possible values: (string|tsv|csv|arrayrefs|hashrefs|jsonobjects|jsonrows|count)
The format to request results in. The default is arrayrefs
arrayrefs
size => $size
The number of results to return. Leave undefined for "all" (default).
start => $start
The first result to return (starting at 0). The default is 0.
columnheaders => 0/1/friendly/path
Whether to return the column headers at the top of TSV/CSV results. The default is false. There are two styles - friendly: "Gene > pathways > name" and path: "Gene.pathways.name". The default style is friendly if a true value is entered and it is not "path".
json => $json_processor
Possible values: (inflate|instantiate|raw|perl)
What to do with JSON results. The results can be returned as inflated objects, full instantiated Moose objects, a raw json string, or as a perl data structure. (default is perl).
perl
summaryPath => $path
The path of the query to summarise (see summarise).
If a value for this is supplied, then (as => 'jsonrows') is implied. Also, unlike the " summarise " method, this option will return a list of item/count pairs, as below:
(as => 'jsonrows')
[ { item => "the-best", count => 100 }, { item => "the-runner-up", count => 99 }, { item => "the-wooden-spoon", count => 98 }, ]
This is best when you care more about the top of the summary list, or which value is at the top than what the value of particular item is. If you are using this method with a big result set it is best to use size as well.
size
Get a column summary for a path in the query. For numerical values this returns a hash reference with four keys: average , stdev , min , and max . These may be accessed as so:
average
stdev
min
max
my $average = $query->summarise("length")->{average};
For non-numerical paths, the summary provides a hash from item => count, so the number of occurrences of an item may be accessed as so:
my $no_on_chr2 = $query->summarise("chromosome.primaryIdentifier")->{2};
Obviously you can sort the hash yourself, but if you want this information in order, or just a particular subset (the top 100 perhaps), then you should use results() instead.
results()
Any further options will be passed along to the result-iterator as is, although the one that makes the most sense is size, when you don't want all the results from a very large result set.
returns the results from a query in the result format specified.
Possible values: (tsv|csv|arrayrefs|hashrefs|jsonobjects|jsonrows|count)
addheaders => 0/1/friendly/path
Possible values: (inflate|instantiate|perl)
Return all rows of results. This method takes the same options as results, but any start and size arguments given are ignored. Note that the server code limits result-sets to 10,000,000 rows in size, no matter what.
results
Return the first result (row or object). This method takes the same options as results, but any size arguments given are ignored. May return undef if there are no results.
undef
Return one result (row or result object), throwing an error if more than one is received.
A convenience method that returns the number of result rows a query returns.
Alias for get_count
Get the url for a webservice resource.
get the url to use to upload queries to the webservice.
Save this query in the user's history in the connected webservice. For queries this will be saved into query history, and templates will be saved into your personal collection of private templates.
Webservice::InterMine::Cookbook for guide on how to use these modules.
Webservice::InterMine::Query
Webservice::InterMine::Service
Webservice::InterMine::Query::Template
Alex Kalderimis <dev@intermine.org>
<dev@intermine.org>
Please report any bugs or feature requests to dev@intermine.org.
dev@intermine.org
You can find documentation for this module with the perldoc command.
perldoc Webservice::InterMine::Query::Roles::Runnable
You can also look for information at:
Webservice::InterMine
http://www.intermine.org
Documentation
http://www.intermine.org/perlapi
Copyright 2006 - 2011 FlyMine, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
L<> starts or ends with whitespace
To install Webservice::InterMine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Webservice::InterMine
CPAN shell
perl -MCPAN -e shell install Webservice::InterMine
For more information on module installation, please visit the detailed CPAN module installation guide.