Table of Contents

Class: _FeatureConsumer Bio/GenBank/__init__.py

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.

Base Classes   
_BaseGenBankConsumer
    AbstractConsumer
Methods   
__init__
_add_feature
_add_qualifier
_get_location
_get_position
_set_function
_set_location
_set_location_info
_set_ordering_info
_split_reference_locations
accession
authors
base_count
base_number
comment
contig_location
data_file_division
date
db_source
definition
feature_key
features_line
gi
journal
keywords
location
locus
medline_id
nid
organism
origin_name
pid
pubmed_id
qualifier_key
qualifier_value
record_end
reference_bases
reference_num
remark
residue_type
segment
sequence
size
source
start_feature_table
taxonomy
title
version
  __init__ 
__init__ (
        self,
        use_fuzziness,
        feature_cleaner=None,
        )

  _add_feature 
_add_feature ( self )

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.

  _add_qualifier 
_add_qualifier ( self )

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.

  _get_location 
_get_location ( self,  range_info )

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 
_get_position ( self,  position )

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.

Exceptions   
ValueError( "Unexpected LocationParser object %r" % position )
  _set_function 
_set_function (
        self,
        function,
        cur_feature,
        )

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.

Exceptions   
ValueError( "Unexpected function name: %s" % function.name )
  _set_location 
_set_location (
        self,
        location,
        cur_feature,
        )

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.

  _set_location_info 
_set_location_info (
        self,
        parse_info,
        cur_feature,
        )

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.

Exceptions   
ValueError( "Could not parse location info: %s" % parse_info )
  _set_ordering_info 
_set_ordering_info (
        self,
        function,
        cur_feature,
        )

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

  _split_reference_locations 
_split_reference_locations ( self,  location_string )

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.

  accession 
accession ( self,  acc_num )

Set the accession number as the id of the sequence.

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

  authors 
authors ( self,  content )

  base_count 
base_count ( self,  content )

  base_number 
base_number ( self,  content )

  comment 
comment ( self,  content )

  contig_location 
contig_location ( self,  content )

Deal with a location of CONTIG information.

  data_file_division 
data_file_division ( self,  division )

  date 
date ( self,  submit_date )

  db_source 
db_source ( self,  content )

  definition 
definition ( self,  definition )

Set the definition as the description of the sequence.

  feature_key 
feature_key ( self,  content )

  features_line 
features_line ( self,  content )

Get ready for the feature table when we reach the FEATURE line.

  gi 
gi ( self,  content )

  journal 
journal ( self,  content )

  keywords 
keywords ( self,  content )

  location 
location ( self,  content )

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.

Exceptions   
LocationParserError( location_line )
  locus 
locus ( self,  locus_name )

Set the locus name is set as the name of the Sequence.

  medline_id 
medline_id ( self,  content )

  nid 
nid ( self,  content )

  organism 
organism ( self,  content )

  origin_name 
origin_name ( self,  content )

  pid 
pid ( self,  content )

  pubmed_id 
pubmed_id ( self,  content )

  qualifier_key 
qualifier_key ( self,  content )

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

  qualifier_value 
qualifier_value ( self,  content )

  record_end 
record_end ( self,  content )

Clean up when we've finished the record.

Exceptions   
ValueError( "Could not determine alphabet for seq_type %s" % self._seq_type )
  reference_bases 
reference_bases ( self,  content )

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)

Exceptions   
ValueError("Could not parse base info %s in record %s" %( ref_base_info, self.data.id ) )
  reference_num 
reference_num ( self,  content )

Signal the beginning of a new reference object.

  remark 
remark ( self,  content )

  residue_type 
residue_type ( self,  type )

Record the sequence type so we can choose an appropriate alphabet.

  segment 
segment ( self,  content )

  sequence 
sequence ( self,  content )

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

  size 
size ( self,  content )

  source 
source ( self,  content )

  start_feature_table 
start_feature_table ( self )

Indicate we've got to the start of the feature table.

  taxonomy 
taxonomy ( self,  content )

  title 
title ( self,  content )

  version 
version ( self,  version_id )

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.


Table of Contents

This document was automatically generated on Mon Jul 1 12:02:49 2002 by HappyDoc version 2.0.1