ontology
index
c:\my projects\python\bioinformatics\ontology.py

Gene Ontology Parser
Zafer Barutcuoglu 2003/10/03
This module parses the bioinformatical Gene Ontology (GO) data available at
http://www.geneontology.org/ontology/process.ontology into a tree structure.

 
Classes
       
Ontology

 
class Ontology
    Gene Ontology tree class.
 
self.rootNode - Contains the multiple-inheritance tree after loading data.
self.nodes - List of all unique tree nodes.
self.nodesByID - Dictionary of nodes by GO ID string.
 
  Methods defined here:
__init__(self)
Constructor for an empty but valid tree.
clear(self)
Clears all data, reverting to an empty tree.
loadFile(self, filename)
Loads an ontology tree from file.
loadLevel(self, lines, iNextLine, level, parent)
Loads a subtree at <level> depth, starting at <iNextLine> in <lines>, under <parent>
Returns the new value of iNextLine.
loadLines(self, lines)
Loads an ontology tree from a list of strings.
loadNode(self, line, level, parent, lineNo=-1)
Creates a new node and adds it under parent, if not already existing.
If already exists, only adds parent and child refs.
Returns a ref to the node.

Data and other attributes defined here:
Node = <class ontology.Node at 0x00E97390>
Tree node class.
 
self.name - Textual node name. NOT  unique!
self.ids - List of GO ID strings that can identify this node.
self.parents - list of ("<" or "%", parent_ref) tuples.
self.children - list of ("<" or "%", child_ref) tuples.