Bio :: GenBank :: _FeatureConsumer :: Class _FeatureConsumer
[hide private]
[frames] | no frames]

Class _FeatureConsumer

source code

ParserSupport.AbstractConsumer --+    
                                 |    
              _BaseGenBankConsumer --+
                                     |
                                    _FeatureConsumer

Create a SeqRecord object with Features to return.

Attributes: o use_fuzziness - specify whether or not to parse with fuzziness in feature locations. o feature_cleaner - a class that will be used to provide specialized cleaning-up of feature values.

Instance Methods [hide private]
 
__init__(self, use_fuzziness, feature_cleaner=None) source code
 
locus(self, locus_name)
Set the locus name is set as the name of the Sequence.
source code
 
size(self, content) source code
 
residue_type(self, type)
Record the sequence type so we can choose an appropriate alphabet.
source code
 
data_file_division(self, division) source code
 
date(self, submit_date) source code
 
definition(self, definition)
Set the definition as the description of the sequence.
source code
 
accession(self, acc_num)
Set the accession number as the id of the sequence.
source code
 
nid(self, content) source code
 
pid(self, content) source code
 
version(self, version_id) source code
 
version_suffix(self, version)
Set the version to overwrite the id.
source code
 
db_source(self, content) source code
 
gi(self, content) source code
 
keywords(self, content) source code
 
segment(self, content) source code
 
source(self, content) source code
 
organism(self, content) source code
 
taxonomy(self, content)
Records (another line of) the taxonomy lineage.
source code
 
reference_num(self, content)
Signal the beginning of a new reference object.
source code
 
reference_bases(self, content)
Attempt to determine the sequence region the reference entails.
source code
 
_split_reference_locations(self, location_string)
Get reference locations out of a string of reference information
source code
 
authors(self, content) source code
 
consrtm(self, content) source code
 
title(self, content) source code
 
journal(self, content) source code
 
medline_id(self, content) source code
 
pubmed_id(self, content) source code
 
remark(self, content) source code
 
comment(self, content) source code
 
features_line(self, content)
Get ready for the feature table when we reach the FEATURE line.
source code
 
start_feature_table(self)
Indicate we've got to the start of the feature table.
source code
 
_add_feature(self)
Utility function to add a feature to the SeqRecord.
source code
 
feature_key(self, content) source code
 
location(self, content)
Parse out location information from the location string.
source code
 
_set_function(self, function, cur_feature)
Set the location information based on a function.
source code
 
_set_ordering_info(self, function, cur_feature)
Parse a join or order and all of the information in it.
source code
 
_set_location_info(self, parse_info, cur_feature)
Set the location information for a feature from the parse info.
source code
 
_set_location(self, location, cur_feature)
Set the location information for a feature.
source code
 
_get_location(self, range_info)
Return a (possibly fuzzy) location from a Range object.
source code
 
_get_position(self, position)
Return a (possibly fuzzy) position for a single coordinate.
source code
 
_add_qualifier(self)
Add a qualifier to the current feature without loss of info.
source code
 
feature_qualifier_name(self, content_list)
When we get a qualifier key, use it as a dictionary key.
source code
 
feature_qualifier_description(self, content) source code
 
contig_location(self, content)
Deal with a location of CONTIG information.
source code
 
origin_name(self, content) source code
 
base_count(self, content) source code
 
base_number(self, content) source code
 
sequence(self, content)
Add up sequence information as we get it.
source code
 
record_end(self, content)
Clean up when we've finished the record.
source code

Inherited from ParserSupport.AbstractConsumer: __getattr__

Class Variables [hide private]

Inherited from _BaseGenBankConsumer: remove_space_keys

Method Details [hide private]

__init__(self, use_fuzziness, feature_cleaner=None)
(Constructor)

source code 
Overrides: _BaseGenBankConsumer.__init__

accession(self, acc_num)

source code 

Set the accession number as the id of the sequence.

If we have multiple accession numbers, the first one passed is used.

version_suffix(self, version)

source code 

Set the version to overwrite the id.

Since the verison provides the same information as the accession number, plus some extra info, we set this as the id if we have a version.

reference_bases(self, content)

source code 

Attempt to determine the sequence region the reference entails.

Possible types of information we may have to deal with:

(bases 1 to 86436) (sites) (bases 1 to 105654; 110423 to 111122) 1 (residues 1 to 182)

_split_reference_locations(self, location_string)

source code 
Get reference locations out of a string of reference information

The passed string should be of the form:

    1 to 20; 20 to 100

This splits the information out and returns a list of location objects
based on the reference locations.

_add_feature(self)

source code 

Utility function to add a feature to the SeqRecord.

This does all of the appropriate checking to make sure we haven't left any info behind, and that we are only adding info if it exists.

location(self, content)

source code 

Parse out location information from the location string.

This uses Andrew's nice spark based parser to do the parsing for us, and translates the results of the parse into appropriate Location objects.

_set_function(self, function, cur_feature)

source code 

Set the location information based on a function.

This handles all of the location functions like 'join', 'complement' and 'order'.

Arguments: o function - A LocationParser.Function object specifying the function we are acting on. o cur_feature - The feature to add information to.

_set_ordering_info(self, function, cur_feature)

source code 

Parse a join or order and all of the information in it.

This deals with functions that order a bunch of locations, specifically 'join' and 'order'. The inner locations are added as subfeatures of the top level feature

_set_location_info(self, parse_info, cur_feature)

source code 

Set the location information for a feature from the parse info.

Arguments: o parse_info - The classes generated by the LocationParser. o cur_feature - The feature to add the information to.

_set_location(self, location, cur_feature)

source code 

Set the location information for a feature.

Arguments: o location - An AbsoluteLocation object specifying the info about the location. o cur_feature - The feature to add the information to.

_get_location(self, range_info)

source code 

Return a (possibly fuzzy) location from a Range object.

Arguments: o range_info - A location range (ie. something like 67..100). This may also be a single position (ie 27).

This returns a FeatureLocation object. If parser.use_fuzziness is set at one, the positions for the end points will possibly be fuzzy.

_get_position(self, position)

source code 

Return a (possibly fuzzy) position for a single coordinate.

Arguments: o position - This is a LocationParser.* object that specifies a single coordinate. We will examine the object to determine the fuzziness of the position.

This is used with _get_location to parse out a location of any end_point of arbitrary fuzziness.

_add_qualifier(self)

source code 

Add a qualifier to the current feature without loss of info.

If there are multiple qualifier keys with the same name we would lose some info in the dictionary, so we append a unique number to the end of the name in case of conflicts.

feature_qualifier_name(self, content_list)

source code 

When we get a qualifier key, use it as a dictionary key.

We receive a list of keys, since you can have valueless keys such as /pseudo which would be passed in with the next key (since no other tags separate them in the file)

sequence(self, content)

source code 

Add up sequence information as we get it.

To try and make things speedier, this puts all of the strings into a list of strings, and then uses string.join later to put them together. Supposedly, this is a big time savings