NAME
Bio::DB::NCBIHelper - A collection of routines useful for queries to NCBI databases.
SYNOPSIS
# Do not use this module directly.# get a Bio::DB::NCBIHelper object somehowmy $seqio = $db->get_Stream_by_acc(['J00522']);foreach my $seq ( $seqio->next_seq ) {# process seq}
DESCRIPTION
Provides a single place to setup some common methods for querying NCBI web databases. This module just centralizes the methods for constructing a URL for querying NCBI GenBank and NCBI GenPept and the common HTML stripping done in postprocess_data().
The base NCBI query URL used is: https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi
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 one of the Bioperl mailing lists. Your participation is much appreciated.
[email protected] - General discussionhttp://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
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 the bugs and their resolution. Bug reports can be submitted via the web.
https://github.com/bioperl/bioperl-live/issues
AUTHOR - Jason Stajich
Email [email protected]
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
new
Title : newUsage :Function: the new way to make modules a little more lightweightReturns :Args :
get_params
Title : get_paramsUsage : my %params = $self->get_params($mode)Function: returns key,value pairs to be passed to NCBI databasefor either 'batch' or 'single' sequence retrieval methodReturns : a key,value pair hashArgs : 'single' or 'batch' mode for retrieval
default_format
Title : default_formatUsage : my $format = $self->default_formatFunction: returns default sequence format for this moduleReturns : stringArgs : none
get_request
Title : get_requestUsage : my $url = $self->get_requestFunction: HTTP::RequestReturns :Args : %qualifiers = a hash of qualifiers (ids, format, etc)
get_seq_stream
Title : get_seq_streamUsage : my $seqio = $self->get_seq_stream(%qualifiers)Function: builds a url and queries a web dbReturns : a Bio::SeqIO stream capable of producing sequenceArgs : %qualifiers = a hash qualifiers that the implementing classwill process to make a url suitable for web querying
get_Stream_by_batch
Title : get_Stream_by_batchUsage : $seq = $db->get_Stream_by_batch($ref);Function: Retrieves Seq objects from Entrez 'en masse', rather than oneat a time. For large numbers of sequences, this is far superiorthan get_Stream_by_id or get_Stream_by_acc.Example :Returns : a Bio::SeqIO stream objectArgs : $ref : either an array reference, a filename, or a filehandlefrom which to get the list of unique ids/accession numbers.NOTE: deprecated API. Use get_Stream_by_id() instead.
get_Stream_by_query
Title : get_Stream_by_queryUsage : $seq = $db->get_Stream_by_query($query);Function: Retrieves Seq objects from Entrez 'en masse', rather than oneat a time. For large numbers of sequences, this is far superiorto get_Stream_by_id and get_Stream_by_acc.Example :Returns : a Bio::SeqIO stream objectArgs : An Entrez query string or a Bio::DB::Query::GenBank object.It is suggested that you create a Bio::DB::Query::GenBank object and getthe entry count before you fetch a potentially large stream.
postprocess_data
Title : postprocess_dataUsage : $self->postprocess_data ( 'type' => 'string','location' => \$datastr );Function: Process downloaded data before loading into a Bio::SeqIO. Thisworks for Genbank and Genpept, other classes should overrideit with their own method.Returns : voidArgs : hash with two keys:'type' can be 'string' or 'file''location' either file location or string reference containing data
request_format
Title : request_formatUsage : my ($req_format, $ioformat) = $self->request_format;$self->request_format("genbank");$self->request_format("fasta");Function: Get/Set sequence format retrieval. The get-form will normally notbe used outside of this and derived modules.Returns : Array of two strings, the first representing the format forretrieval, and the second specifying the corresponding SeqIO format.Args : $format = sequence format
redirect_refseq
Title : redirect_refseqUsage : $db->redirect_refseq(1)Function: simple getter/setter which redirects RefSeqs to use Bio::DB::RefSeqReturns : Boolean valueArgs : Boolean value (optional)Throws : 'unparseable output exception'Note : This replaces 'no_redirect' as a more straightforward flag toredirect possible RefSeqs to use Bio::DB::RefSeq (EBI interface)instead of retrieving the NCBI records
complexity
Title : complexityUsage : $db->complexity(3)Function: get/set complexity valueReturns : value from 0-4 indicating level of complexityArgs : value from 0-4 (optional); if unset server assumes 1Throws : if arg is not an integer or falls outside of noted range aboveNote : From efetch docs, the complexity regulates the display:0 - get the whole blob1 - get the bioseq for gi of interest (default in Entrez)2 - get the minimal bioseq-set containing the gi of interest3 - get the minimal nuc-prot containing the gi of interest4 - get the minimal pub-set containing the gi of interest
strand
Title : strandUsage : $db->strand(1)Function: get/set strand valueReturns : strand value if setArgs : value of 1 (plus) or 2 (minus); if unset server assumes 1Throws : if arg is not an integer or is not 1 or 2Note : This differs from BioPerl's use of strand: 1 = plus, -1 = minus 0 = not relevant.We should probably add in some functionality to convert over in the future.
seq_start
Title : seq_startUsage : $db->seq_start(123)Function: get/set sequence start locationReturns : sequence start value if setArgs : integer; if unset server assumes 1Throws : if arg is not an integer
seq_stop
Title : seq_stopUsage : $db->seq_stop(456)Function: get/set sequence stop (end) locationReturns : sequence stop (end) value if setArgs : integer; if unset server assumes 1Throws : if arg is not an integer
Title : emailUsage : $db->email('[email protected]')Function: get/set email valueReturns : email (string) or undefArgs : string with a valid email address; note we do not vallidate thiscurrently!Throws : if arg is not an integer or falls outside of noted range aboveNote : This is required if you wish to speed up mulltiple requests fasterthan 4s per request.
Bio::DB::WebDBSeqI methods
Overriding WebDBSeqI method to help newbies to retrieve sequences
get_Stream_by_acc
Title : get_Stream_by_accUsage : $seq = $db->get_Stream_by_acc([$acc1, $acc2]);Function: gets a series of Seq objects by accession numbersReturns : a Bio::SeqIO stream objectArgs : $ref : a reference to an array of accession numbers forthe desired sequence entriesNote : For GenBank, this just calls the same code for get_Stream_by_id()
delay_policy
Title : delay_policyUsage : $secs = $self->delay_policyFunction: NCBI requests a delay of 4 seconds between requests unless email isprovided. This method implements a 4 second delay; use 'delay()' tooverride, though understand if no email is provided we are notresponsible for users being IP-blocked by NCBIReturns : number of seconds to delayArgs : none
cookie
Title : cookieUsage : ($cookie,$querynum) = $db->cookieFunction: return the NCBI query cookie, this information is used byBio::DB::GenBank in conjunction with efetch, ripped fromBio::DB::Query::GenBankReturns : list of (cookie,querynum)Args : none
_parse_response
Title : _parse_responseUsage : $db->_parse_response($content)Function: parse out response for cookie, this is a trimmed-down versionof _parse_response from Bio::DB::Query::GenBankReturns : emptyArgs : noneThrows : 'unparseable output exception'
no_redirect
Title : no_redirectUsage : $db->no_redirect($content)Function: DEPRECATED - Used to indicate that Bio::DB::GenBank instance retrievespossible RefSeqs from EBI instead; default behavior is now toretrieve directly from NCBIReturns : NoneArgs : NoneThrows : Method is deprecated in favor of positive flag method 'redirect_refseq'