3 # BioPerl module for Bio::DB::EUtilities::DocSum
5 # Cared for by Chris Fields
7 # Copyright Chris Fields
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
13 # Part of the EUtilities BioPerl package
17 Bio::DB::EUtilities::Summary
21 #### should not create instance directly; Bio::Tools::EUtilities does this ####
23 my $esum = Bio::Tools::EUtilities->new(-eutil => 'esummary',
24 -file => 'summary.xml');
25 # can also use '-response' (for HTTP::Response objects) or '-fh' (for filehandles)
27 while (my $docsum = $esum->next_DocSum) {
28 my $id = $docsum->get_ids; # EUtilDataI compliant method, returns docsum ID
29 my @names = $docsum->get_item_names;
34 This class handles data output (XML) from esummary.
36 esummary retrieves information in the form of document summaries (docsums) when
37 passed a list of primary IDs or if using a previous search history.
39 This module breaks down the returned data from esummary into individual document
40 summaries per ID (using a DocSum object). As the data in a docsum can be nested,
41 subclasses of DocSums (Item, ListItem, Structure) are also present.
43 Further documentation for Link and Field subclass methods is included below.
49 User feedback is an integral part of the
50 evolution of this and other Bioperl modules. Send
51 your comments and suggestions preferably to one
52 of the Bioperl mailing lists. Your participation
55 bioperl-l@lists.open-bio.org - General discussion
56 http://www.bioperl.org/wiki/Mailing_lists - About the mailing lists
60 Report bugs to the Bioperl bug tracking system to
61 help us keep track the bugs and their resolution.
62 Bug reports can be submitted via the web.
64 http://bugzilla.open-bio.org/
68 Email cjfields at uiuc dot edu
72 The rest of the documentation details each of the
73 object methods. Internal methods are usually
78 # Let the code begin...
80 package Bio
::Tools
::EUtilities
::Summary
;
84 use base
qw(Bio::Tools::EUtilities Bio::Tools::EUtilities::EUtilDataI);
86 use Bio
::Tools
::EUtilities
::Summary
::DocSum
;
88 # private EUtilDataI method
91 my ($self, $data) = @_;
92 if (!exists $data->{DocSum
}) {
93 $self->warn('No returned docsums.');
98 for my $docsum (@
{ $data->{DocSum
} }) {
99 my $ds = Bio
::Tools
::EUtilities
::Summary
::DocSum
->new(-datatype
=> 'docsum',
100 -verbose
=> $self->verbose);
101 $ds->_add_data($docsum);
102 push @
{ $self->{'_docsums'} }, $ds;
109 Usage : $foo->to_string()
110 Function : converts current object to string
112 Args : (optional) simple data for text formatting
113 Note : Used generally for debugging and for the print_* methods
120 'DB' => [1, join(', ',$self->get_databases) || ''],
122 my $string = $self->SUPER::to_string
."\n";
123 for my $k (sort {$data{$a}->[0] <=> $data{$b}->[0]} keys %data) {
124 $string .= sprintf("%-20s:%s\n\n",$k, $self->_text_wrap('',' 'x
20 .':', $data{$k}->[1]));
126 while (my $ds = $self->next_DocSum) {
127 $string .= $ds->to_string."\n";