Bio.GenBank.utils module

Useful utilities for helping in parsing GenBank files.

class Bio.GenBank.utils.FeatureValueCleaner(to_process=keys_to_process)

Bases: object

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 otherwise end up with white space in it.

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).

>>> cleaner = FeatureValueCleaner(["translation"])
>>> cleaner
FeatureValueCleaner(['translation'])
>>> cleaner.clean_value("translation", "MED\nYDPWNLRFQSKYKSRDA")
'MEDYDPWNLRFQSKYKSRDA'
keys_to_process = ['translation']
__init__(self, to_process=keys_to_process)

Initialize with the keys we should deal with.

__repr__(self)

Return a string representation of the class.

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.