NAME
Bio::Tools::EUtilities::EUtilParameters - Manipulation of NCBI eutil-based parameters for remote database requests.
VERSION
version 1.77
SYNOPSIS
# Bio::Tools::EUtilities::EUtilParameters implements Bio::ParameterBaseImy @params = (-eutil => 'efetch',db => 'nucleotide',id => \@ids,api_key => 'mYApiKeyFrOMNCBI',email => '[email protected]',retmode => 'xml');my $p = Bio::Tools::EUtilities::EUtilParameters->new(@params);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)
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 set_parameters() or reset_parameters():
eutil - the eutil to be used. The default is 'efetch' if not set.correspondence - Flag for how IDs are treated. Default is undef (none).history - a Bio::Tools::EUtilities::HistoryI object. Default is undef (none).
At this point minimal checking is done for potential errors in parameter passing, though these should be easily added in the future when necessary.
Bio::ParameterBaseI implemented methods
set_parameters
Title : set_parametersUsage : $pobj->set_parameters(@params);Function: sets the NCBI parameters listed in the hash or arrayReturns : NoneArgs : [optional] hash or array of parameter/values.Note : This sets any parameter passed but leaves previously set data alone.In addition to regular eutil-specific parameters, you can set thefollowing:-eutil - the eUtil to be used (default 'efetch')-history - pass a HistoryI-implementing object, whichsets the WebEnv, query_key, and possibly db and linkname(the latter two only for LinkSets)-correspondence - Boolean flag, set to TRUE or FALSE; indicates howIDs are to be added together for elink request whereID correspondence might be needed(default 0)
reset_parameters
Title : reset_parametersUsage : resets valuesFunction: resets parameters to either undef or value in passed hashReturns : noneArgs : [optional] hash of parameter-value pairsNote : This sets any parameter passed, but resets all others (deletes them).In addition to regular eutil-specific parameters, you can set thefollowing:-eutil - the eUtil to be used (default 'efetch')-history - pass a HistoryI-implementing object, whichsets the WebEnv, query_key, and possibly db and linkname(the latter two only for LinkSets)-correspondence - Boolean flag, set to TRUE or FALSE; indicates howIDs are to be added together for elink request whereID correspondence might be needed(default 0)
carryover
Title : carryoverUsage : $obj->carryover(qw(email api_key tool db))Function : Carries over the designated parameters when using reset_parameters()Returns : a list of carried-over parametersArgs : An array reference of parameters to carry over, followed optionallyby the mode ('add' or 'delete', indicating whether to append to orremove the specified values passed in). To clear all values, pass inan empty array reference (the mode in this case doesn't matter).In addition to the normal eUtil-specific parameters, the followingadditional parameters are allowed:-eutil - the eUtil to be used (default 'efetch')-history - pass a HistoryI-implementing object, whichsets the WebEnv, query_key, and possibly db and linkname(the latter two only for LinkSets)-correspondence - Boolean flag, set to TRUE or FALSE; indicates howIDs are to be added together for elink request whereID correspondence might be needed(default 0)Default : None (no carried over parameters)Status : NYI (dev in progress, carry on, nothing to see here)
request_mode
Title : request_modeUsage : $obj->request_modeFunction : get/set the mode for the user agent to use for generating a requestReturns : either a preset mode (checked against the eutil) or a best-possibleoption based upon the currently-set parametersArgs :Status :
parameters_changed
Title : parameters_changedUsage : if ($pobj->parameters_changed) {...}Function: Returns TRUE if parameters have changedReturns : Boolean (0 or 1)Args : [optional] Boolean
available_parameters
Title : available_parametersUsage : @params = $pobj->available_parameters()Function: Returns a list of the available parametersReturns : Array of available parameters (no values)Args : [optional] A string with the eutil name (for returning eutil-specificparameters)
get_parameters
Title : get_parametersUsage : @params = $pobj->get_parameters;%params = $pobj->get_parameters;Function: Returns list of key/value pairs, parameter => valueReturns : Flattened list of key-value pairs. All key-value pairs returned,though subsets can be returned based on the '-type' parameter. Dataoriginally set as an array ref are returned based on whether the'-join_id' flag is set (default is the same array ref).Args : -type : the eutil name (Default: returns all). Use of '-list'supersedes this-list : array ref of specific parameters-join_ids : Boolean; join IDs based on correspondence (Default: no join)
Implementation-specific to_* methods
to_string
Title : to_stringUsage : $string = $pobj->to_string;Function: Returns string (URL only in this case)Returns : String (URL only for now)Args : [optional] 'all'; build URI::https using all parametersDefault : Builds based on allowed parameters (presence of history dataor eutil type in %MODE).Note : Changes state of object. Absolute string
to_request
Title : to_requestUsage : $uri = $pobj->to_request;Function: Returns HTTP::Request objectReturns : HTTP::RequestArgs : [optional] 'all'; builds request using all parametersDefault : Builds based on allowed parameters (presence of history dataor eutil type in %MODE).Note : Changes state of object (to boolean FALSE). Used for CGI-based GET/POSTTODO : esearch, esummary, elink now accept POST for batch submission(something NCBI apparently allowed but didn't advertise). Should weswitch most of these to utilize POST instead, or make it dep on thenumber of submitted IDs?
Implementation specific-methods
eutil
Title : eutilUsage : $p->eutil('efetch')Function: gets/sets the eutil for this set of parametersReturns : string (eutil)Args : [optional] string (eutil)Throws : '$eutil not supported' if eutil not presentNote : This does not reset retmode to the default if called directly.
history
Title : historyUsage : $p->history($history);Function: gets/sets the history object to be used for these parametersReturns : Bio::Tools::EUtilities::HistoryI (if set)Args : [optional] Bio::Tools::EUtilities::HistoryIThrows : Passed something other than a Bio::Tools::EUtilities::HistoryINote : This overrides WebEnv() and query_key() settings when set. Thiscaches the last history object passed and returns like a Get/Set
correspondence
Title : correspondenceUsage : $p->correspondence(1);Function: Sets flag for posting IDs for one-to-one correspondenceReturns : BooleanArgs : [optional] boolean value
id_file
Title : id_fileUsage : $p->id_file('<foo');Function: convenience method; passes in file containing a list of IDs forsearches (one per line), sets id() to listReturns : noneArgs : either string indicating file to use, a file handle, or an IO::HandleobjectNote : use of this overrides concurrent use of the '-id' parameter when bothare passed. The filename is not retained, merely parsed for IDs.
url_base_address
Title : url_base_addressUsage : $address = $p->url_base_address();Function: Get URL base addressReturns : StringArgs : None in this implementation; the URL is fixed
set_default_retmode
Title : set_default_retmodeUsage : $p->set_default_retmode();Function: sets retmode to default value specified by the eutil() and the valuein %NCBI_DATABASE (for efetch only) if calledReturns : noneArgs : none
FEEDBACK
Mailing lists
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.
[email protected] - General discussionhttps://bioperl.org/Support.html - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list: [email protected] rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.
Reporting bugs
Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web:
https://github.com/bioperl/bio-eutilities/issues
AUTHOR
Chris Fields <[email protected]>
COPYRIGHT
This software is copyright (c) 2006-2013 by Chris Fields.
This software is available under the same terms as the perl 5 programming language system itself.