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
 
partialcascade(cont_attr, item_attr, doc='')
Returns a getter property with a cascading setter.
source code
 
fullcascade(attr, doc='')
Returns a getter property with a cascading setter.
source code
 
optionalcascade(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
Function Details [hide private]

get_processor(format, mapping)

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

Arguments:
format -- Lower case string denoting one of the supported formats.
mapping -- Dictionary of format and object name mapping.

partialcascade(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. These items have their own private attributes that stores query
and/or hit ID and description. 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 as well.

fullcascade(attr, doc='')

source code 
Returns a getter property with a cascading setter.

This is similar to `partialcascade`, but for SearchIO containers that have
at least one item (Hit and 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(attr, doc='')

source code 
Returns a getter property with a cascading setter.

This is similar to `fullcascade`, but for SearchIO containers that have
at zero or more items. The getter always tries to retrieve the attribute
value from the first item, but falls back to the value in the container.
If the items have more than one attribute values, an error will be raised.
The setter behaves like `partialcascade`.

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.