Bio::DB::Query::GenBank(3pm) | User Contributed Perl Documentation | Bio::DB::Query::GenBank(3pm) |
Bio::DB::Query::GenBank - Build a GenBank Entrez Query
use Bio::DB::Query::GenBank; use Bio::DB::GenBank; my $query_string = 'Oryza[Organism] AND EST[Keyword]'; my $query = Bio::DB::Query::GenBank->new(-db => 'nucleotide', -query => $query_string, -mindate => '2001', -maxdate => '2002'); print $query->count,"\n"; # get a Genbank database handle my $gb = Bio::DB::GenBank->new(); my $stream = $gb->get_Stream_by_query($query); while (my $seq = $stream->next_seq) { # do something with the sequence object } # initialize the list yourself my $query = Bio::DB::Query::GenBank->new(-ids=>[195052,2981014,11127914]);
This class encapsulates NCBI Entrez queries. It can be used to store a list of GI numbers, to translate an Entrez query expression into a list of GI numbers, or to count the number of terms that would be returned by a query. Once created, the query object can be passed to a Bio::DB::GenBank object in order to retrieve the entries corresponding to the query.
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
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
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.
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:
https://github.com/bioperl/bioperl-live/issues
Email lstein@cshl.org
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
Title : new Usage : $db = Bio::DB::Query::GenBank->new(@args) Function: create new query object Returns : new query object Args : -db database (see below for allowable values) -query query string -mindate minimum date to retrieve from (YYYY/MM/DD) -maxdate maximum date to retrieve from (YYYY/MM/DD) -reldate relative date to retrieve from (days) -datetype date field to use ('edat' or 'mdat') -ids array ref of gids (overrides query) -maxids the maximum number of IDs you wish to collect (defaults to 100) -email Email address; required if you want to decrease delay time between queries -delay Delay time (in seconds). Note NCBI policy requires 4 seconds between requests unless an email is provided
This method creates a new query object. Typically you will specify a -db and a -query argument, possibly modified by -mindate, -maxdate, or -reldate. -mindate and -maxdate specify minimum and maximum dates for entries you are interested in retrieving, expressed in the form YYYY/MM/DD. -reldate is used to fetch entries that are more recent than the indicated number of days.
If you provide an array reference of IDs in -ids, the query will be ignored and the list of IDs will be used when the query is passed to a Bio::DB::GenBank object's get_Stream_by_query() method. A variety of IDs are automatically recognized, including GI numbers, Accession numbers, Accession.version numbers and locus names.
By default, the query will collect only the first 100 IDs and will generate an exception if you call the ids() method and the query returned more than that number. To increase this maximum, set -maxids to a number larger than the number of IDs you expect to obtain. This only affects the list of IDs you obtain when you call the ids() method, and does not affect in any way the number of entries you receive when you generate a SeqIO stream from the query.
-db option values:
The most commonly used databases are: protein nucleotide nuccore nucgss nucest unigene An up to date list of database names supported by NCBI eUtils is always available at: https://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi? However, note that not all of these databases return datatypes that are parsable by Bio::DB::GenBank
Title : cookie Usage : ($cookie,$querynum) = $db->cookie Function: return the NCBI query cookie Returns : list of (cookie,querynum) Args : none
NOTE: this information is used by Bio::DB::GenBank in conjunction with efetch.
Title : _request_parameters Usage : ($method,$base,@params = $db->_request_parameters Function: return information needed to construct the request Returns : list of method, url base and key=>value pairs Args : none
Title : count Usage : $count = $db->count; Function: return count of number of entries retrieved by query Returns : integer Args : none
Returns the number of entries that are matched by the query.
Title : ids Usage : @ids = $db->ids([@ids]) Function: get/set matching ids Returns : array of sequence ids Args : (optional) array ref with new set of ids
Title : query Usage : $query = $db->query([$query]) Function: get/set query string Returns : string Args : (optional) new query string
Title : _parse_response Usage : $db->_parse_response($content) Function: parse out response Returns : empty Args : none Throws : 'unparseable output exception'
Title : _generate_id_string Usage : $string = $db->_generate_id_string Function: joins IDs together in string (possibly implementation-dependent) Returns : string of concatenated IDs Args : array ref of ids (normally passed into the constructor)
Title : delay_policy Usage : $secs = $self->delay_policy Function: NCBI requests a delay of 4 seconds between requests unless email is provided. This method implements a 4 second delay; use 'delay()' to override, though understand if no email is provided we are not responsible for users being IP-blocked by NCBI Returns : number of seconds to delay Args : none
2022-02-24 | perl v5.34.0 |