Bio::DB::EUtilities
esearch
Summary
Bio::DB::EUtilities::esearch - Base interface class for handling web
queries and data retrieval from Entrez Utilities from NCBI.
You shouldn't use this class directly.
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
*** Give standard usage here
Description
*** Describe the object here
Methods
Methods description
Title : parse_response Usage : $db->_parse_response($content) Function: parse out response for cookie Returns : empty Args : none Throws : 'unparseable output exception' |
Title : esearch_count Usage : $count = $db->esearch_count; Function: return count of number of entries retrieved by query Returns : integer Args : none |
Methods code
sub _initialize
{ my ($self, @args ) = @_;
$self->SUPER::_initialize(@args);
my ($term, $field, $reldate, $mindate, $maxdate, $datetype, $rettype, $retstart,
$retmax, $sort, $usehistory) =
$self->_rearrange([qw(TERM FIELD RELDATE MINDATE MAXDATE DATETYPE RETTYPE
RETSTART RETMAX SORT USEHISTORY)],
@args);
$self->_eutil($EUTIL);
$datetype ||= 'mdat';
$self->datetype($datetype) if $datetype;
$term && $self->term($term);
$field && $self->field($field);
$reldate && $self->reldate($reldate);
$mindate && $self->mindate($mindate);
$maxdate && $self->maxdate($maxdate);
$retstart && $self->retstart($retstart);
$retmax && $self->retmax($retmax);
$rettype && $self->rettype($rettype);
$sort && $self->sort_results($sort);
$usehistory && $self->usehistory($usehistory);} |
sub parse_response
{ my $self = shift;
my $response = shift if @_;
if (!$response || !$response->isa("HTTP::Response")) {
$self->throw("Need HTTP::Response object");
}
my $history = $self->usehistory;
my $db = $self->db;
my $xs = XML::Simple->new();
my $simple = $xs->XMLin($response->content);
if ($simple->{ERROR}) {
$self->throw("NCBI esearch nonrecoverable error: ".$simple->{ERROR});
}
if ($simple->{ErrorList} || $simple->{WarningList}) {
my %errorlist = %{ $simple->{ErrorList} };
my %warninglist = %{ $simple->{WarningList} };
my ($err_warn);
for my $key (sort keys %errorlist) {
$err_warn .= "Error : $key = $errorlist{$key}\n";
}
for my $key (sort keys %warninglist) {
$err_warn .= "Warning : $key = $warninglist{$key}\n";
}
chomp($err_warn);
$self->warn("NCBI esearch Errors/Warnings:\n".$err_warn)
}
my $count = $simple->{Count};
$self->esearch_count($count);
my $id_ref = $simple->{IdList}->{Id};
$self->_add_db_ids($id_ref) if ($id_ref);
if ($history && $history eq 'y') {
my $webenv = $simple->{WebEnv};
my $querykey = $simple->{QueryKey};
my $cookie = Bio::DB::EUtilities::Cookie->new(
-term => $self->term,
-webenv => $webenv,
-querykey => $querykey,
-eutil => 'esearch',
-database => $db,
-total => $count
);
$self->add_cookie($cookie);
}} |
sub esearch_count
{ my $self = shift;
return $self->{'_esearch_count'} = shift if @_;
return $self->{'_esearch_count'};} |
General documentation
User feedback is an integral part of the
evolution of this and other Bioperl modules. Send
your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation
is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
Report bugs to the Bioperl bug tracking system to
help us keep track the bugs and their resolution.
Bug reports can be submitted via the web.
http://bugzilla.open-bio.org/
Email cjfields at uiuc dot edu
The rest of the documentation details each of the
object methods. Internal methods are usually
preceded with a _