Bio-EUtilities
view release on metacpan or search on metacpan
lib/Bio/Tools/EUtilities.pm view on Meta::CPAN
Notes : only applicable for einfo. If -file or -fh are not defined,
prints to STDOUT
=head2 get_linked_databases
Title : get_linked_databases
Usage : my @dbs = $eutil->get_linked_databases
Function : returns list of databases linked to in linksets
Returns : array of databases
Args : none
Notes : only applicable for elink. Now defers to get_databases.
=head1 Iterator- and callback-related methods
=head2 rewind
Title : rewind
Usage : $esum->rewind()
$esum->rewind('recursive')
Function : retrieve a list of DocSum instances
Returns : array of Bio::Tools::EUtilities::Summary::DocSum
Args : [optional] Scalar; string ('all') to reset all iterators, or string
describing the specific main object iterator to reset. The following
are recognized (case-insensitive):
'all' - rewind all objects and also recursively resets nested object
iterators (such as LinkSets and DocSums).
'globalqueries' - GlobalQuery objects
'fieldinfo' or 'fieldinfos' - FieldInfo objects
'linkinfo' or 'linkinfos' - LinkInfo objects in this layer
'linksets' - LinkSet objects
'docsums' - DocSum objects
'histories' - HistoryI objects (Cookies, LinkSets)
=head2 generate_iterator
Title : generate_iterator
Usage : my $coderef = $esum->generate_iterator('linkinfo')
Function : generates an iterator (code reference) which iterates through
the relevant object indicated by the args
Returns : code reference
Args : [REQUIRED] Scalar; string describing the specific object to iterate.
The following are currently recognized (case-insensitive):
'globalqueries'
'fieldinfo' or 'fieldinfos' (the latter sounds clumsy, but I alias it JIC)
'linkinfo' or 'linkinfos' (the latter sounds clumsy, but I alias it JIC)
'linksets'
'docsums'
'histories'
Note : This function generates a simple coderef that one can use
independently of the various next_* functions (in fact, the next_*
functions use lazily created iterators generated via this method,
while rewind() merely deletes them so they can be regenerated on the
next call).
A callback specified using callback() will be used to filter objects
for any generated iterator. This behaviour is implemented for both
normal and lazy iterator types and is the default. If you don't want
this, make sure to reset any previously set callbacks via
reset_callback() (which just deletes the code ref). Note that setting
callback() also changes the behavior of the next_* functions as the
iterators are generated here (as described above); this is a feature
and not a bug.
'Lazy' iterators are considered an experimental feature and may be
modified in the future. A 'lazy' iterator, which loops through and
returns objects as they are created (instead of creating all data
instances up front, then iterating through) is returned if the
parser is set to 'lazy' mode. This mode is only present for elink
and esummary output as they are the two formats parsed which can
generate potentially thousands of individual objects (note efetch
isn't parsed, so isn't counted). Use of rewind() with these
iterators is not supported for the time being as we can't guarantee
you can rewind(), as this depends on whether the data source is
seek()able and thus 'rewindable'. We will add rewind() support at a
later time which will work for 'seekable' data or possibly cached
objects via Storable or BDB.
=head2 callback
Title : callback
Usage : $parser->callback(sub {$_[0]->get_database eq 'protein'});
Function : Get/set callback code ref used to filter returned data objects
Returns : code ref if previously set
Args : single argument:
code ref - evaluates a passed object and returns true or false value
(used in iterators)
'reset' - string, resets the iterator.
returns upon any other args
=head1 FEEDBACK
=head2 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.
bioperl-l@bioperl.org - General discussion
https://bioperl.org/Support.html - About the mailing lists
=head2 Support
Please direct usage questions or support issues to the mailing list:
I<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.
=head2 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
=head1 AUTHOR
( run in 0.889 second using v1.01-cache-2.11-cpan-39bf76dae61 )