Package obitools :: Package obo :: Module parser
[hide private]
[frames] | no frames]

Module parser

source code

Classes [hide private]
  FileFormatError
An error derived from the class Exception.
  TrailingModifier
A class object which inherits from the class dict.
  TaggedValue
A couple 'tag:value' of an OBOEntry.
  NameValue
A couple 'name:value' inherited from the class TaggedValue.
  DefValue
A couple 'def:value' inherited from the class TaggedValue.
  SynonymValue
A couple 'synonym:value' inherited from the class TaggedValue.
  XrefValue
A couple 'xref:value' inherited from the class TaggedValue.
  RelationshipValue
A couple 'xref:value' inherited from the class TaggedValue.
  NamespaceValue
  RemarkValue
  Xref
A xref object of an OBOentry.
  OBOEntry
An entry of an OBOFile.
  OBOTerm
A stanza named 'Term'.
Functions [hide private]
a stream of aggregated strings
stanzaIterator(inputfile)
Iterator of stanza.
source code
 
trailingModifierFactory(string)
Dispatcher of trailing modifiers.
source code
 
taggedValueFactory(line)
A function used to dispatch lines of an OBOEntry between the class TaggedValue and its inherited classes.
source code
 
xrefFactory(string)
Dispatcher of xrefs.
source code
 
OBOEntryFactory(stanza)
Dispatcher of stanza.
source code
 
OBOEntryIterator(file) source code
Variables [hide private]
  __package__ = 'obitools.obo'

Imports: skipWhiteLineIterator, multiLineWrapper, universalOpen, genericEntryIteratorGenerator, debug, warning, re, _oboEntryIterator


Function Details [hide private]

stanzaIterator(inputfile)

source code 

Iterator of stanza. The stanza are the basic units of OBO files.

Parameters:
  • inputfile (a stream of strings) - a stream of strings from an opened OBO file.
Returns: a stream of aggregated strings
a stream of stanza

Note: The iterator constructs stanza by aggregate strings from the OBO file.

trailingModifierFactory(string)

source code 

Dispatcher of trailing modifiers.

Parameters:
  • string (string) - a string from a TaggedValue object with a trailing modifiers signal.
Returns:
a class object

Note: The dispatcher is currently very simple. Only one case is treated by the function. `the function returns a class object inherited from the class dict if the trailing modifiers exist, None if they don't.

taggedValueFactory(line)

source code 

A function used to dispatch lines of an OBOEntry between the class TaggedValue and its inherited classes.

Parameters:
  • line (string) - a line of an OBOEntry composed of a tag and a value.
Returns:
a class object

xrefFactory(string)

source code 

Dispatcher of xrefs.

Parameters:
  • string (string) - a string (between brackets) from an inherited TaggedValue object with a dbxrefs signal (actually, the signal can only be found into SynonymValue and DefValue objects) or a string (without brackets) from a XrefValue object.
Returns:
a class object

Note: The dispatcher treats differently the strings between brackets (from SynonymValue and DefValue objects) and without brackets (from XrefValue objects).

OBOEntryFactory(stanza)

source code 

Dispatcher of stanza.

Parameters:
  • stanza (text) - a stanza composed of several lines.
Returns:
an OBOTerm | OBOEntry instance

Note: The dispatcher treats differently the stanza which are OBO "Term" and the others.