Back to index

python-biopython  1.60
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
Bio.GenBank.utils.FeatureValueCleaner Class Reference

List of all members.

Public Member Functions

def __init__
def clean_value

Static Public Attributes

list keys_to_process = ["translation"]

Private Member Functions

def _clean_translation

Private Attributes

 _to_process

Detailed Description

Provide specialized capabilities for cleaning up values in features.

This class is designed to provide a mechanism to clean up and process
values in the key/value pairs of GenBank features. This is useful 
because in cases like:
    
     /translation="MED
     YDPWNLRFQSKYKSRDA"

you'll end up with a value with \012s and spaces in it like:
    "MED\012 YDPWEL..."

which you probably don't want. 

This cleaning needs to be done on a case by case basis since it is
impossible to interpret whether you should be concatenating everything
(as in translations), or combining things with spaces (as might be
the case with /notes).

Definition at line 3 of file utils.py.


Constructor & Destructor Documentation

Initialize with the keys we should deal with.

Definition at line 24 of file utils.py.

00024 
00025     def __init__(self, to_process = keys_to_process):
00026         """Initialize with the keys we should deal with.
00027         """
00028         self._to_process = to_process

Here is the caller graph for this function:


Member Function Documentation

def Bio.GenBank.utils.FeatureValueCleaner._clean_translation (   self,
  value 
) [private]
Concatenate a translation value to one long protein string.

Definition at line 44 of file utils.py.

00044 
00045     def _clean_translation(self, value):
00046         """Concatenate a translation value to one long protein string.
00047         """
00048         translation_parts = value.split()
00049         return "".join(translation_parts)
def Bio.GenBank.utils.FeatureValueCleaner.clean_value (   self,
  key_name,
  value 
)
Clean the specified value and return it.

If the value is not specified to be dealt with, the original value
will be returned.

Definition at line 29 of file utils.py.

00029 
00030     def clean_value(self, key_name, value):
00031         """Clean the specified value and return it.
00032 
00033         If the value is not specified to be dealt with, the original value
00034         will be returned.
00035         """
00036         if key_name in self._to_process:
00037             try:
00038                 cleaner = getattr(self, "_clean_%s" % key_name)
00039                 value = cleaner(value)
00040             except AttributeError:
00041                 raise AssertionError("No function to clean key: %s" 
00042                                      % key_name)
00043         return value


Member Data Documentation

Definition at line 27 of file utils.py.

Definition at line 23 of file utils.py.


The documentation for this class was generated from the following file: