Package Bio :: Package SearchIO :: Module _utils
[hide private]
[frames] | no frames]

Module _utils

source code

Common SearchIO utility functions.

Functions [hide private]
 
get_processor(format, mapping)
Returns the object to process the given format according to the mapping.
source code
 
singleitem(attr=None, doc='')
Returns a property that fetches the given attribute from the first item in a SearchIO container object.
source code
 
allitems(attr=None, doc='')
Returns a property that fetches the given attributes from all items in a SearchIO container object.
source code
 
fullcascade(attr, doc='')
Returns a getter property with a cascading setter.
source code
 
optionalcascade(cont_attr, item_attr, doc='')
Returns a getter property with a cascading setter.
source code
 
fragcascade(attr, seq_type, doc='')
Returns a getter property with cascading setter, for HSPFragment objects.
source code
Variables [hide private]
  __package__ = 'Bio.SearchIO'
Function Details [hide private]

get_processor(format, mapping)

source code 
Returns the object to process the given format according to the mapping.

:param format: format name
:type format: string, lower case
:param mapping: mapping of format name and its processor object
:type mapping: dictionary {string: object}

fullcascade(attr, doc='')

source code 
Returns a getter property with a cascading setter.

This is similar to ``optionalcascade``, but for SearchIO containers that have
at least one item (HSP). The getter always retrieves the attribute
value from the first item. If the items have more than one attribute values,
an error will be raised. The setter behaves like ``partialcascade``, except
that it only sets attributes to items in the object, not the object itself.

optionalcascade(cont_attr, item_attr, doc='')

source code 
Returns a getter property with a cascading setter.

This is used for the ``id`` and ``description`` properties of the container
objects with zero or more items. These items have their own private
attributes that stores query and/or hit ID and description. When the
container has zero items, attribute values are always retrieved from the
container's attribute. Otherwise, the first item's attribute is used.

To keep the container items' query and/or hit ID and description in-sync,
the setter cascades any new value given to the items' values.

fragcascade(attr, seq_type, doc='')

source code 
Returns a getter property with cascading setter, for HSPFragment objects.

Similar to ``partialcascade``, but for HSPFragment objects and acts on ``query``
or ``hit`` properties of the object if they are not None.