Small updates.
This commit is contained in:
@@ -61,7 +61,29 @@ class GeneOntology(networkx.XDiGraph):
|
||||
"""Returns the root node of the molecular_function tree"""
|
||||
return self.by_id['GO:0003674']
|
||||
|
||||
def _subsumer(self, t1, t2, heap):
|
||||
while heap != []:
|
||||
t = heap[0]
|
||||
heap = heap[1:]
|
||||
|
||||
p1 = networkx.shortest_path(self, t, t1)
|
||||
p2 = networkx.shortest_path(self, t, t2)
|
||||
if p1 and p2:
|
||||
return t
|
||||
|
||||
heap += self.in_neighbors(t)
|
||||
return None
|
||||
|
||||
def subsumer(self, t1, t2):
|
||||
if t1 == t2:
|
||||
return t1
|
||||
if networkx.shortest_path(self, t1, t2):
|
||||
return t1
|
||||
elif networkx.shortest_path(self, t2, t1):
|
||||
return t2
|
||||
return self._subsumer(t1, t2, self.in_neighbors(t1))
|
||||
|
||||
def old_subsumer(self, t1, t2):
|
||||
if t1 == t2:
|
||||
return t1
|
||||
|
||||
@@ -83,6 +105,8 @@ class GeneOntology(networkx.XDiGraph):
|
||||
return t
|
||||
|
||||
print "GeneOntology.subsumer: should not reach this point"
|
||||
print "path is now: %s" % path
|
||||
print "ids are: %s " % [x['id'] for x in path]
|
||||
|
||||
def _split_obo_line(line):
|
||||
"""Splits a line from an obo file in its three constituent parts.
|
||||
|
Reference in New Issue
Block a user