Back to index

python-biopython  1.60
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes
Bio.GenBank._RecordConsumer Class Reference
Inheritance diagram for Bio.GenBank._RecordConsumer:
Inheritance graph
[legend]
Collaboration diagram for Bio.GenBank._RecordConsumer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def wgs
def add_wgs_scafld
def locus
def size
def residue_type
def data_file_division
def date
def definition
def accession
def nid
def pid
def version
def db_source
def gi
def keywords
def project
def dblink
def segment
def source
def organism
def taxonomy
def reference_num
def reference_bases
def authors
def consrtm
def title
def journal
def medline_id
def pubmed_id
def remark
def comment
def primary_ref_line
def primary
def features_line
def start_feature_table
def feature_key
def location
def feature_qualifier
def feature_qualifier_name
def feature_qualifier_description
def base_count
def origin_name
def contig_location
def sequence
def record_end
def __getattr__

Public Attributes

 data

Static Public Attributes

list remove_space_keys = ["translation"]

Private Member Functions

def _add_feature

Private Attributes

 _seq_data
 _cur_reference
 _cur_feature
 _cur_qualifier

Detailed Description

Create a GenBank Record object from scanner generated information (PRIVATE).

Definition at line 1191 of file __init__.py.


Constructor & Destructor Documentation

Reimplemented from Bio.GenBank._BaseGenBankConsumer.

Definition at line 1194 of file __init__.py.

01194 
01195     def __init__(self):
01196         _BaseGenBankConsumer.__init__(self)
01197         import Record
01198         self.data = Record.Record()
01199 
01200         self._seq_data = []
01201         self._cur_reference = None
01202         self._cur_feature = None
01203         self._cur_qualifier = None
        

Here is the caller graph for this function:


Member Function Documentation

def Bio.GenBank._BaseGenBankConsumer.__getattr__ (   self,
  attr 
) [inherited]

Definition at line 479 of file __init__.py.

00479 
00480     def __getattr__(self, attr):
00481         return self._unhandled

Here is the call graph for this function:

def Bio.GenBank._RecordConsumer._add_feature (   self) [private]
Utility function to add a feature to the Record.

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.

Definition at line 1342 of file __init__.py.

01342 
01343     def _add_feature(self):
01344         """Utility function to add a feature to the Record.
01345 
01346         This does all of the appropriate checking to make sure we haven't
01347         left any info behind, and that we are only adding info if it
01348         exists.
01349         """
01350         if self._cur_feature is not None:
01351             # if we have a left over qualifier, add it to the qualifiers
01352             # on the current feature
01353             if self._cur_qualifier is not None:
01354                 self._cur_feature.qualifiers.append(self._cur_qualifier)
01355 
01356             self._cur_qualifier = None
01357             self.data.features.append(self._cur_feature)

Here is the caller graph for this function:

def Bio.GenBank._RecordConsumer.accession (   self,
  content 
)

Definition at line 1228 of file __init__.py.

01228 
01229     def accession(self, content):
01230         for acc in self._split_accessions(content):
01231             if acc not in self.data.accession:
01232                 self.data.accession.append(acc)

Here is the call graph for this function:

def Bio.GenBank._RecordConsumer.add_wgs_scafld (   self,
  content 
)

Definition at line 1207 of file __init__.py.

01207 
01208     def add_wgs_scafld(self, content):
01209         self.data.wgs_scafld.append(content.split('-'))

def Bio.GenBank._RecordConsumer.authors (   self,
  content 
)

Definition at line 1283 of file __init__.py.

01283 
01284     def authors(self, content):
01285         self._cur_reference.authors = content

def Bio.GenBank._RecordConsumer.base_count (   self,
  content 
)

Definition at line 1397 of file __init__.py.

01397 
01398     def base_count(self, content):
01399         self.data.base_counts = content

def Bio.GenBank._RecordConsumer.comment (   self,
  content 
)

Definition at line 1310 of file __init__.py.

01310 
01311     def comment(self, content):
01312         self.data.comment += "\n".join(content)

def Bio.GenBank._RecordConsumer.consrtm (   self,
  content 
)

Definition at line 1286 of file __init__.py.

01286 
01287     def consrtm(self, content):
01288         self._cur_reference.consrtm = content

def Bio.GenBank._RecordConsumer.contig_location (   self,
  content 
)
Signal that we have contig information to add to the record.

Definition at line 1403 of file __init__.py.

01403 
01404     def contig_location(self, content):
01405         """Signal that we have contig information to add to the record.
01406         """
01407         self.data.contig = self._clean_location(content) 

Here is the call graph for this function:

def Bio.GenBank._RecordConsumer.data_file_division (   self,
  content 
)

Definition at line 1219 of file __init__.py.

01219 
01220     def data_file_division(self, content):
01221         self.data.data_file_division = content

def Bio.GenBank._RecordConsumer.date (   self,
  content 
)

Definition at line 1222 of file __init__.py.

01222 
01223     def date(self, content):
01224         self.data.date = content

def Bio.GenBank._RecordConsumer.db_source (   self,
  content 
)

Definition at line 1242 of file __init__.py.

01242 
01243     def db_source(self, content):
01244         self.data.db_source = content.rstrip()

def Bio.GenBank._RecordConsumer.dblink (   self,
  content 
)

Definition at line 1254 of file __init__.py.

01254 
01255     def dblink(self, content):
01256         self.data.dblinks.append(content)

def Bio.GenBank._RecordConsumer.definition (   self,
  content 
)

Definition at line 1225 of file __init__.py.

01225 
01226     def definition(self, content):
01227         self.data.definition = content

def Bio.GenBank._RecordConsumer.feature_key (   self,
  content 
)
Grab the key of the feature and signal the start of a new feature.

Definition at line 1332 of file __init__.py.

01332 
01333     def feature_key(self, content):
01334         """Grab the key of the feature and signal the start of a new feature.
01335         """
01336         # first add on feature information if we've got any
01337         self._add_feature()
01338 
01339         import Record
01340         self._cur_feature = Record.Feature()
01341         self._cur_feature.key = content

Here is the call graph for this function:

def Bio.GenBank._RecordConsumer.feature_qualifier (   self,
  key,
  value 
)

Definition at line 1361 of file __init__.py.

01361 
01362     def feature_qualifier(self, key, value):
01363         self.feature_qualifier_name([key])
01364         if value is not None:
01365             self.feature_qualifier_description(value)

Here is the call graph for this function:

Definition at line 1385 of file __init__.py.

01385 
01386     def feature_qualifier_description(self, content):
01387         # if we have info then the qualifier key should have a ='s
01388         if self._cur_qualifier.key.find("=") == -1:
01389             self._cur_qualifier.key = "%s=" % self._cur_qualifier.key
01390         cur_content = self._remove_newlines(content)
01391         # remove all spaces from the value if it is a type where spaces
01392         # are not important
01393         for remove_space_key in self.__class__.remove_space_keys:
01394             if self._cur_qualifier.key.find(remove_space_key) >= 0:
01395                 cur_content = self._remove_spaces(cur_content)
01396         self._cur_qualifier.value = self._normalize_spaces(cur_content)

Here is the call graph for this function:

Here is the caller graph for this function:

def Bio.GenBank._RecordConsumer.feature_qualifier_name (   self,
  content_list 
)
Deal with qualifier names

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)

Definition at line 1366 of file __init__.py.

01366 
01367     def feature_qualifier_name(self, content_list):
01368         """Deal with qualifier names
01369         
01370         We receive a list of keys, since you can have valueless keys such as
01371         /pseudo which would be passed in with the next key (since no other
01372         tags separate them in the file)
01373         """
01374         import Record
01375         for content in content_list:
01376             # the record parser keeps the /s -- add them if we don't have 'em
01377             if content.find("/") != 0:
01378                 content = "/%s" % content
01379             # add on a qualifier if we've got one
01380             if self._cur_qualifier is not None:
01381                 self._cur_feature.qualifiers.append(self._cur_qualifier)
01382 
01383             self._cur_qualifier = Record.Qualifier()
01384             self._cur_qualifier.key = content

Here is the caller graph for this function:

def Bio.GenBank._RecordConsumer.features_line (   self,
  content 
)
Get ready for the feature table when we reach the FEATURE line.

Definition at line 1320 of file __init__.py.

01320 
01321     def features_line(self, content):
01322         """Get ready for the feature table when we reach the FEATURE line.
01323         """
01324         self.start_feature_table()

Here is the call graph for this function:

def Bio.GenBank._RecordConsumer.gi (   self,
  content 
)

Definition at line 1245 of file __init__.py.

01245 
01246     def gi(self, content):
01247         self.data.gi = content

def Bio.GenBank._RecordConsumer.journal (   self,
  content 
)

Definition at line 1298 of file __init__.py.

01298 
01299     def journal(self, content):
01300         self._cur_reference.journal = content

def Bio.GenBank._RecordConsumer.keywords (   self,
  content 
)

Definition at line 1248 of file __init__.py.

01248 
01249     def keywords(self, content):
01250         self.data.keywords = self._split_keywords(content)

Here is the call graph for this function:

def Bio.GenBank._RecordConsumer.location (   self,
  content 
)

Definition at line 1358 of file __init__.py.

01358 
01359     def location(self, content):
01360         self._cur_feature.location = self._clean_location(content)

Here is the call graph for this function:

def Bio.GenBank._RecordConsumer.locus (   self,
  content 
)

Definition at line 1210 of file __init__.py.

01210 
01211     def locus(self, content):
01212         self.data.locus = content

def Bio.GenBank._RecordConsumer.medline_id (   self,
  content 
)

Definition at line 1301 of file __init__.py.

01301 
01302     def medline_id(self, content):
01303         self._cur_reference.medline_id = content
        
def Bio.GenBank._RecordConsumer.nid (   self,
  content 
)

Definition at line 1233 of file __init__.py.

01233 
01234     def nid(self, content):
01235         self.data.nid = content

def Bio.GenBank._RecordConsumer.organism (   self,
  content 
)

Definition at line 1263 of file __init__.py.

01263 
01264     def organism(self, content):
01265         self.data.organism = content

Here is the caller graph for this function:

def Bio.GenBank._RecordConsumer.origin_name (   self,
  content 
)

Definition at line 1400 of file __init__.py.

01400 
01401     def origin_name(self, content):
01402         self.data.origin = content

def Bio.GenBank._RecordConsumer.pid (   self,
  content 
)

Definition at line 1236 of file __init__.py.

01236 
01237     def pid(self, content):
01238         self.data.pid = content

def Bio.GenBank._RecordConsumer.primary (   self,
  content 
)

Definition at line 1317 of file __init__.py.

01317 
01318     def primary(self,content):
01319         pass
    
def Bio.GenBank._RecordConsumer.primary_ref_line (   self,
  content 
)
Data for the PRIMARY line

Definition at line 1313 of file __init__.py.

01313 
01314     def primary_ref_line(self,content):
01315         """Data for the PRIMARY line"""
01316         self.data.primary.append(content)

def Bio.GenBank._RecordConsumer.project (   self,
  content 
)

Definition at line 1251 of file __init__.py.

01251 
01252     def project(self, content):
01253         self.data.projects.extend([p for p in content.split() if p])

def Bio.GenBank._RecordConsumer.pubmed_id (   self,
  content 
)

Definition at line 1304 of file __init__.py.

01304 
01305     def pubmed_id(self, content):
01306         self._cur_reference.pubmed_id = content

def Bio.GenBank._RecordConsumer.record_end (   self,
  content 
)
Signal the end of the record and do any necessary clean-up.

Definition at line 1419 of file __init__.py.

01419 
01420     def record_end(self, content):
01421         """Signal the end of the record and do any necessary clean-up.
01422         """
01423         # add together all of the sequence parts to create the
01424         # final sequence string
01425         self.data.sequence = "".join(self._seq_data)
01426         # add on the last feature
01427         self._add_feature()
01428 

Here is the call graph for this function:

def Bio.GenBank._RecordConsumer.reference_bases (   self,
  content 
)

Definition at line 1280 of file __init__.py.

01280 
01281     def reference_bases(self, content):
01282         self._cur_reference.bases = content

def Bio.GenBank._RecordConsumer.reference_num (   self,
  content 
)
Grab the reference number and signal the start of a new reference.

Definition at line 1269 of file __init__.py.

01269 
01270     def reference_num(self, content):
01271         """Grab the reference number and signal the start of a new reference.
01272         """
01273         # check if we have a reference to add
01274         if self._cur_reference is not None:
01275             self.data.references.append(self._cur_reference)
01276 
01277         import Record
01278         self._cur_reference = Record.Reference()
01279         self._cur_reference.number = content

def Bio.GenBank._RecordConsumer.remark (   self,
  content 
)

Definition at line 1307 of file __init__.py.

01307 
01308     def remark(self, content):
01309         self._cur_reference.remark = content
        
def Bio.GenBank._RecordConsumer.residue_type (   self,
  content 
)

Definition at line 1216 of file __init__.py.

01216 
01217     def residue_type(self, content):
01218         self.data.residue_type = content

def Bio.GenBank._RecordConsumer.segment (   self,
  content 
)

Definition at line 1257 of file __init__.py.

01257 
01258     def segment(self, content):
01259         self.data.segment = content

def Bio.GenBank._RecordConsumer.sequence (   self,
  content 
)
Add sequence information to a list of sequence strings.

This removes spaces in the data and uppercases the sequence, and
then adds it to a list of sequences. Later on we'll join this
list together to make the final sequence. This is faster than
adding on the new string every time.

Definition at line 1408 of file __init__.py.

01408 
01409     def sequence(self, content):
01410         """Add sequence information to a list of sequence strings.
01411 
01412         This removes spaces in the data and uppercases the sequence, and
01413         then adds it to a list of sequences. Later on we'll join this
01414         list together to make the final sequence. This is faster than
01415         adding on the new string every time.
01416         """
01417         assert ' ' not in content
01418         self._seq_data.append(content.upper())

Here is the caller graph for this function:

def Bio.GenBank._RecordConsumer.size (   self,
  content 
)

Definition at line 1213 of file __init__.py.

01213 
01214     def size(self, content):
01215         self.data.size = content

Here is the caller graph for this function:

def Bio.GenBank._RecordConsumer.source (   self,
  content 
)

Definition at line 1260 of file __init__.py.

01260 
01261     def source(self, content):
01262         self.data.source = content

Signal the start of the feature table.

Definition at line 1325 of file __init__.py.

01325 
01326     def start_feature_table(self):
01327         """Signal the start of the feature table.
01328         """
01329         # we need to add on the last reference
01330         if self._cur_reference is not None:
01331             self.data.references.append(self._cur_reference)

Here is the caller graph for this function:

def Bio.GenBank._RecordConsumer.taxonomy (   self,
  content 
)

Definition at line 1266 of file __init__.py.

01266 
01267     def taxonomy(self, content):
01268         self.data.taxonomy = self._split_taxonomy(content)

Here is the call graph for this function:

def Bio.GenBank._RecordConsumer.title (   self,
  content 
)

Definition at line 1289 of file __init__.py.

01289 
01290     def title(self, content):
01291         if self._cur_reference is None:
01292             import warnings
01293             from Bio import BiopythonParserWarning
01294             warnings.warn("GenBank TITLE line without REFERENCE line.",
01295                           BiopythonParserWarning)
01296             return
01297         self._cur_reference.title = content

def Bio.GenBank._RecordConsumer.version (   self,
  content 
)

Definition at line 1239 of file __init__.py.

01239 
01240     def version(self, content):
01241         self.data.version = content

def Bio.GenBank._RecordConsumer.wgs (   self,
  content 
)

Definition at line 1204 of file __init__.py.

01204 
01205     def wgs(self, content):
01206         self.data.wgs = content.split('-')


Member Data Documentation

Definition at line 1201 of file __init__.py.

Definition at line 1202 of file __init__.py.

Definition at line 1200 of file __init__.py.

Definition at line 1199 of file __init__.py.

Definition at line 1197 of file __init__.py.

list Bio.GenBank._BaseGenBankConsumer.remove_space_keys = ["translation"] [static, inherited]

Definition at line 471 of file __init__.py.


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