Bio-EUtilities
view release on metacpan or search on metacpan
"Bio::ParameterBaseI" : "0",
"Bio::Root::IO" : "0",
"Bio::Root::Root" : "0",
"Bio::Root::RootI" : "0",
"Bio::Root::Version" : "0",
"Bio::SeqIO" : "0",
"Cwd" : "0",
"Data::Dumper" : "0",
"File::Spec" : "0",
"Getopt::Long" : "0",
"HTTP::Request" : "0",
"LWP::UserAgent" : "0",
"Text::CSV" : "0",
"Text::Wrap" : "0",
"URI" : "0",
"XML::Simple" : "0",
"base" : "0",
"perl" : "5.010",
"strict" : "0",
"utf8" : "0",
"warnings" : "0"
Bio::ParameterBaseI: '0'
Bio::Root::IO: '0'
Bio::Root::Root: '0'
Bio::Root::RootI: '0'
Bio::Root::Version: '0'
Bio::SeqIO: '0'
Cwd: '0'
Data::Dumper: '0'
File::Spec: '0'
Getopt::Long: '0'
HTTP::Request: '0'
LWP::UserAgent: '0'
Text::CSV: '0'
Text::Wrap: '0'
URI: '0'
XML::Simple: '0'
base: '0'
perl: '5.010'
strict: '0'
utf8: '0'
warnings: '0'
Makefile.PL view on Meta::CPAN
"Bio::ParameterBaseI" => 0,
"Bio::Root::IO" => 0,
"Bio::Root::Root" => 0,
"Bio::Root::RootI" => 0,
"Bio::Root::Version" => 0,
"Bio::SeqIO" => 0,
"Cwd" => 0,
"Data::Dumper" => 0,
"File::Spec" => 0,
"Getopt::Long" => 0,
"HTTP::Request" => 0,
"LWP::UserAgent" => 0,
"Text::CSV" => 0,
"Text::Wrap" => 0,
"URI" => 0,
"XML::Simple" => 0,
"base" => 0,
"strict" => 0,
"utf8" => 0,
"warnings" => 0
},
Makefile.PL view on Meta::CPAN
"Bio::ParameterBaseI" => 0,
"Bio::Root::IO" => 0,
"Bio::Root::Root" => 0,
"Bio::Root::RootI" => 0,
"Bio::Root::Version" => 0,
"Bio::SeqIO" => 0,
"Cwd" => 0,
"Data::Dumper" => 0,
"File::Spec" => 0,
"Getopt::Long" => 0,
"HTTP::Request" => 0,
"IO::Handle" => 0,
"IPC::Open3" => 0,
"LWP::UserAgent" => 0,
"Test::More" => 0,
"Text::CSV" => 0,
"Text::Wrap" => 0,
"URI" => 0,
"XML::Simple" => 0,
"base" => 0,
"strict" => 0,
lib/Bio/DB/EUtilities.pm view on Meta::CPAN
Title : ua
Usage : $dbi->ua;
Function: Get/Set LWP::UserAgent.
Returns : LWP::UserAgent
Args : LWP::UserAgent
=head2 get_Response
Title : get_Response
Usage : $agent->get_Response;
Function: Get the HTTP::Response object by passing it an HTTP::Request (generated from
Bio::ParameterBaseI implementation).
Returns : HTTP::Response object or data if callback is used
Args : (optional)
-cache_response - flag to cache HTTP::Response object;
Default is 1 (TRUE, caching ON)
These are passed on to LWP::UserAgent::request() if stipulated
-cb - use a LWP::UserAgent-compliant callback
lib/Bio/Tools/EUtilities/EUtilParameters.pm view on Meta::CPAN
package Bio::Tools::EUtilities::EUtilParameters;
$Bio::Tools::EUtilities::EUtilParameters::VERSION = '1.77';
use utf8;
use strict;
use warnings;
use base qw(Bio::Root::Root Bio::ParameterBaseI);
use URI;
use HTTP::Request;
use Bio::Root::IO;
# ABSTRACT: Manipulation of NCBI eutil-based parameters for remote database requests.
# AUTHOR: Chris Fields <cjfields@bioperl.org>
# OWNER: 2006-2013 Chris Fields
# LICENSE: Perl_5
# eutils only has one hostbase URL
# mode : GET or POST (HTTP::Request)
# location : CGI location
# params : allowed parameters for that eutil
my %MODE = (
'einfo' => {
'mode' => ['GET'],
'location' => 'einfo.fcgi',
'params' => [qw(db tool email api_key)],
},
'epost' => {
'mode' => ['POST','GET'],
lib/Bio/Tools/EUtilities/EUtilParameters.pm view on Meta::CPAN
if ($self->parameters_changed || !defined $self->{'_request_cache'}) {
my $eutil = $self->eutil;
$self->throw("No eutil set") if !$eutil;
#set default retmode
$type ||= $eutil;
my ($location, $mode) = ($MODE{$eutil}->{location}, $self->request_mode);
my $request;
my $uri = URI->new($self->url_base_address . $location);
if ($mode eq 'GET') {
$uri->query_form($self->get_parameters(-type => $type, -join_ids => 1) );
$request = HTTP::Request->new($mode => $uri);
$self->{'_request_cache'} = $request;
} elsif ($mode eq 'POST') {
$request = HTTP::Request->new($mode => $uri->as_string);
$uri->query_form($self->get_parameters(-type => $type, -join_ids => 1) );
$request->content_type('application/x-www-form-urlencoded');
$request->content($uri->query);
$self->{'_request_cache'} = $request;
} else {
$self->throw("Unrecognized request mode: $mode");
}
$self->{'_statechange'} = 0;
$self->{'_request_cache'} = $request;
}
lib/Bio/Tools/EUtilities/EUtilParameters.pm view on Meta::CPAN
if ($p->parameters_changed) {
# ...
} # state information
$p->set_parameters(@extra_params); # set new NCBI parameters, leaves others preset
$p->reset_parameters(@new_params); # reset NCBI parameters to original state
$p->to_string(); # get a URI-encoded string representation of the URL address
$p->to_request(); # get an HTTP::Request object (to pass on to LWP::UserAgent)
=head1 DESCRIPTION
Bio::Tools::EUtilities::EUtilParameters is-a Bio::ParameterBaseI implementation
that allows simple manipulation of NCBI eutil parameters for CGI-based queries.
SOAP-based methods may be added in the future.
For simplicity parameters do not require dashes when passed and do not need URI
encoding (spaces are converted to '+', symbols encoded, etc). Also, the
following extra parameters can be passed to the new() constructor or via
lib/Bio/Tools/EUtilities/EUtilParameters.pm view on Meta::CPAN
Returns : String (URL only for now)
Args : [optional] 'all'; build URI::https using all parameters
Default : Builds based on allowed parameters (presence of history data
or eutil type in %MODE).
Note : Changes state of object. Absolute string
=head2 to_request
Title : to_request
Usage : $uri = $pobj->to_request;
Function: Returns HTTP::Request object
Returns : HTTP::Request
Args : [optional] 'all'; builds request using all parameters
Default : Builds based on allowed parameters (presence of history data
or eutil type in %MODE).
Note : Changes state of object (to boolean FALSE). Used for CGI-based GET/POST
TODO : esearch, esummary, elink now accept POST for batch submission
(something NCBI apparently allowed but didn't advertise). Should we
switch most of these to utilize POST instead, or make it dep on the
number of submitted IDs?
=head1 Implementation specific-methods
t/EUtilParameters.t view on Meta::CPAN
-id => \@ids,
-email => 'me@foo.bar',
-retmode => 'xml');
my $pobj = Bio::Tools::EUtilities::EUtilParameters->new(%params);
# initial 'primed' state
is($pobj->parameters_changed, 1);
my $request = $pobj->to_request; # 'exhaust' state
isa_ok($request, 'HTTP::Request');
is($request->url, 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?'.
'db=nucleotide&retmode=xml&id=6679096%2C31543332%2C134288853%2C483581%2C'.
'20805941%2C187951953%2C169158074%2C123228044%2C148676374%2C114326469%2C'.
'148707003%2C187952787%2C123233807%2C148694865%2C148694864%2C148694863%2C'.
'148694861%2C148694862%2C8705244%2C8568086&tool=BioPerl&email=me%40foo.bar');
is($pobj->to_string(), 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/'.
'efetch.fcgi?db=nucleotide&retmode=xml&id=6679096%2C31543332%2C134288853%2C'.
'483581%2C20805941%2C187951953%2C169158074%2C123228044%2C148676374%2C'.
'114326469%2C148707003%2C187952787%2C123233807%2C148694865%2C148694864%2C'.
'148694863%2C148694861%2C148694862%2C8705244%2C8568086'.
( run in 0.319 second using v1.01-cache-2.11-cpan-de7293f3b23 )