Updated go-workflow.
This commit is contained in:
@@ -42,6 +42,12 @@ class GeneOntology(networkx.XDiGraph):
|
||||
for link in node[linkattr]:
|
||||
self.add_edge(self.by_id[link], node, linkattr)
|
||||
|
||||
def link_relationships(self):
|
||||
for node in self.nodes():
|
||||
for link in node['relationship']:
|
||||
link_type, term = link.split(' ')
|
||||
self.add_edge(self.by_id[term.strip()], node, link_type.strip())
|
||||
|
||||
def get_bp(self):
|
||||
"""Returns the root node of the biological_process tree"""
|
||||
return self.by_id['GO:0008150']
|
||||
@@ -114,13 +120,13 @@ def read_gene_ontology(fd):
|
||||
# print "[Term]"
|
||||
else:
|
||||
term = None
|
||||
print "ignoring: %s" %s
|
||||
#print "ignoring: %s" %s
|
||||
else:
|
||||
if term:
|
||||
_add_term_attribute(term, k, v, c)
|
||||
# print " %s: %s" % (k, v)
|
||||
else:
|
||||
print "no term: ignoring: %s" %line
|
||||
# else:
|
||||
# print "no term: ignoring: %s" %line
|
||||
# print '.',
|
||||
line = fd.readline()
|
||||
|
||||
@@ -133,6 +139,7 @@ def read_default_go():
|
||||
f = open("/usr/share/gene-ontology/gene_ontology.obo")
|
||||
go = read_gene_ontology(f)
|
||||
go.link_ontology('is_a')
|
||||
go.link_relationships()
|
||||
f.close()
|
||||
return go
|
||||
|
||||
|
Reference in New Issue
Block a user