Package CHEM :: Package Annotation :: Module BaseAnnotator :: Class BaseAnnotator
[hide private]
[frames] | no frames]

Class BaseAnnotator



Abstract base class for all annotators. Given some kind of input object representing a DB row / tuple, probably an OEMolBase or RowItemModel object, the annotator should report what keys (columns) it is meant to populate, and the value of the columns that should be filled in, given the input.

Instance Methods [hide private]
 
__init__(self, specificCols=None)
Constructor allows specification of a list of specific column names to return values for, instead of all possible by this annotator.
 
specifyColumns(self, specificCols)
Given a new collection of columns of interest, update the annotator so it will only generate results for columns found in the specificCols collection.
 
keys(self)
Return an ordered sequence of the column names of values that the values method will produce.
 
iterkeys(self)
 
values(self, input)
Return an ordered sequence of the values this multiple annotator will calculate off of the input.
 
itervalues(self, input)
 
iteritems(self, input)
 
annotateDict(self, rowDict, input)
Enhanced version from base class.
 
allColumns(self)
Return an ordered sequence of all the column names that this multiple annotator can generate values for.
 
allValues(self, input)
Return an ordered sequence of all the values this multiple annotator can calculate off of the input.
Class Variables [hide private]
  specificCols = <CHEM.DB.rdb.search.NameRxnPatternMatchingModel...
Method Details [hide private]

__init__(self, specificCols=None)
(Constructor)

 

Constructor allows specification of a list of specific column names to return values for, instead of all possible by this annotator. This collection can be a superset of those returnable by the annotator. If so, the columnName and __call__ method will just return any ones it can that are in the specificCols collection.

Includes (and is the method subclasses should override) allColumns and allValues methods to retrieve everything this annotator can produce, without filtering by the specificCols.

keys(self)

 
Return an ordered sequence of the column names of values that the values method will produce. This should be a subset of the allColumns method, as specified by the specificCols parameter to the constructor or specifyColumns method.

values(self, input)

 
Return an ordered sequence of the values this multiple annotator will calculate off of the input. The order must correspond to the column list returned by the keys method so the caller can know which element is which. The result should be a subset of the allValues method as specified by the specificCols parameter to the constructor or specifyColumns method.

annotateDict(self, rowDict, input)

 
Enhanced version from base class. Since this is a MultipleAnnotator, it may actually be able to populate several items in the dictionary. However, it will only do so for items already keyed in the dictionary and whose keys are in the list of instance specificCols (if provided).

allColumns(self)

 

Return an ordered sequence of all the column names that this multiple annotator can generate values for.

To facilitate ease of filtering with case-insensitivity, all of the values returned by this method should be lowercase.

allValues(self, input)

 
Return an ordered sequence of all the values this multiple annotator can calculate off of the input. The order must correspond to the column list returned by allColumns so the caller can know which element is which.

Class Variable Details [hide private]

specificCols

Value:
None