NAME
Bio::Tools::EUtilities::Summary::Item - Simple layered object for DocSum item data.
VERSION
version 1.77
SYNOPSIS
# Items can be nested up to three levels at this time. These levels can be# accessed via Item, ListItem, or StructureItem methods:while (my $item = $docsum->next_Item) {print "Name: ",$item->get_name,"\n";print "Data: ",$item->get_content,"\n";print "Type: ",$item->get_type,"\n";while (my $ls = $item->next_ListItem) {# do same herewhile (my $struct = $ls->next_StructureItem) {# do more stuff here}}}
DESCRIPTION
DocSum data, as returned from esummary, normally is a simple list of item-content-content_type groups. However, items can also contain nested data to represent more complex data (such as structural data). Up to three nested layers may appear in any document summary.
This class contains methods to access data that can appear in a docsum for any individual item as well as describes methods to traverse the hierarchy of items present in a document summary.
The unique name for items are accessed via get_name(), the content by get_content() (if present), and the data type by get_type(). Items can have ListItems (Item objects with a datatype() 'list'), which in turn can have StructureItems (Item objects with a datatype of 'structure'). Items are initially traversed via a DocSum object using next_Item() or obtained all at once with get_Items(). Similarly, nested Items can be accessed by using next_ListItem/get_ListItems and next_StructureItem/get_StructureItem. A flattened list of items can be accessed with get_all_Items().
new
Title : newUsage :Function :Returns :Args :
get_ids
Title : get_idsUsage : my ($id) = $item->get_ids;Function : returns array or array ref with idReturns : array or array refArgs : noneNote : the behavior of this method is to remain consistent with otherimplementations of get_ids(). To retrieve the single DocSum ID useget_id()
get_id
Title : get_idUsage : my ($id) = $item->get_id;Function : returns UID of recordReturns : integerArgs : none
next_ListItem
Title : next_ListItemUsage : while (my $ls = $item->next_ListItem) {...}Function : iterates through ListItems (nested layer of Item)Returns : single ListItemArgs : none
get_ListItems
Title : get_ListItemsUsage : my @ls = $item->get_ListItemsFunction : returns list of, well, List ItemsReturns : array of List ItemsArgs : none
next_StructureItem
Title : next_StructureItemUsage : while (my $struc = $ls->next_StructureItem) {...}Function : iterates through StructureItems (nested layer of ListItem)Returns : single StructureItemsArgs : none
get_StructureItems
Title : get_StructureItemsUsage : my @structs = $ls->get_StructureItemsFunction : returns list of Structure ItemsReturns : array of StructureItemsArgs : none
next_subItem
Title : next_subItemUsage : while (my $it = $ls->next_subItem) {...}Function : iterates through the next layer of ItemsReturns : single ItemArgs : noneNotes : unlike next_ListItem and next_StructureItem, this genericallyaccesses any sub Items (useful for recursive calls, for example)
get_subItems
Title : get_subItemsUsage : my @items = $ls->get_subItemsFunction : returns list of sub ItemsReturns : array of ItemsArgs : noneNotes : unlike get_ListItems and get_StructureItems, this genericallyaccesses any sub Items (useful for recursive calls, for example)
get_name
Title : get_nameUsage : my $nm = $ls->get_nameFunction : retrieves Item/ListItem/StructureItem name for this ItemReturns : stringArgs : none
get_type
Title : get_typeUsage : my $type = $ls->get_typeFunction : retrieves Item/ListItem/StructureItem typeReturns : stringArgs : noneNote : this is not the same as the datatype(), which describes thegroup this Item object belongs to
get_content
Title : get_contentUsage : my $data = $ls->get_contentFunction : retrieves Item/ListItem/StructureItem content (if any)Returns : stringArgs : none
rewind
Title : rewindUsage : $item->rewind()Function : rewinds iteratorsReturns : noneArgs : [optional] No arg - only rewinds current layer'all' - rewind all DocSum object layers(Items, ListItems, StructureItems)
ItemContainerI methods
next_Item
Title : next_ItemUsage : while (my $item = $docsum->next_Item) {...}Function : iterates through Items (nested layer of Item)Returns : single ItemArgs : [optional] single arg (string)'flatten' - iterates through a flattened list alaget_all_DocSum_Items()
get_Items
Title : get_ItemsUsage : my @items = $docsum->get_ItemsFunction : returns list of, well, ItemsReturns : array of ItemsArgs : none
get_all_Items
Title : get_all_ItemsUsage : my @items = $docsum->get_all_ItemsFunction : returns flattened list of all Item objects (Items, ListItems,StructureItems)Returns : array of ItemsArgs : noneNote : items are added top-down (similar order to using nested calls)in original list order.1 2 7 8Item - Item - Item - Item ...|| 3 6ListItem - ListItem|| 4 5Structure - Structure
get_all_names
Title : get_all_namesUsage : my @names = get_all_names()Function : Returns an array of names for all Item(s) in DocSum.Returns : array of unique stringsArgs : none
get_Items_by_name
Title : get_Items_by_nameUsage : my @items = get_Items_by_name('CreateDate')Function : Returns named Item(s) in DocSum (indicated by passed argument)Returns : array of Item objectsArgs : string (Item name)
get_contents_by_name
Title : get_contents_by_nameUsage : my ($data) = get_contents_by_name('CreateDate')Function : Returns content for named Item(s) in DocSum (indicated bypassed argument)Returns : array of values (type varies per Item)Args : string (Item name)
get_type_by_name
Title : get_type_by_nameUsage : my $data = get_type_by_name('CreateDate')Function : Returns data type for named Item in DocSum (indicated bypassed argument)Returns : scalar value (string) if presentArgs : string (Item name)
to_string
Title : to_stringUsage : $foo->to_string()Function : converts current object to stringReturns : noneArgs : (optional) simple data for text formatting. This implementationpasses an argument for layering Items/subItemsNote : Used generically for debugging and print_DocSums methods
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 the Bioperl mailing list. Your participation is much appreciated.
[email protected] - General discussionhttps://bioperl.org/Support.html - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list: [email protected] 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 of the bugs and their resolution. Bug reports can be submitted via the web:
https://github.com/bioperl/bio-eutilities/issues
AUTHOR
Chris Fields <[email protected]>
COPYRIGHT
This software is copyright (c) 2006-2013 by Chris Fields.
This software is available under the same terms as the perl 5 programming language system itself.