Added main.py that now contains the One & Only Singleton instance of these classes:

- Navigator
 - Aplication
 - Workflow
 - Project
 - Options
Corresponding changes have been added in lots of other files to account for this, but
the access to these objects should now be a lot easier.
This commit is contained in:
2007-07-26 12:35:59 +00:00
parent 91abf12f51
commit a45743c31e
12 changed files with 196 additions and 78 deletions

View File

@@ -164,17 +164,12 @@ def read_gene_ontology(fd):
section = s
if s == 'Term':
term = GOTerm()
# 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
# print '.',
line = fd.readline()
if term:
@@ -182,6 +177,18 @@ def read_gene_ontology(fd):
return go
def pickle_gene_ontology(go, fn):
fd = open(fn, 'wb')
pickle.dump(go, fd)
fd.close()
def load_pickled_ontology(fn):
fd = open(fn, 'rb')
go = pickle.load(fd)
fd.close()
return go
def read_default_go():
f = open("/usr/share/gene-ontology/gene_ontology.obo")
go = read_gene_ontology(f)

View File

@@ -37,7 +37,7 @@ class GoTermView (gtk.Frame):
def __init__(self):
gtk.Frame.__init__(self)
tab = gtk.Table(2, 2, False)
tab = gtk.Table(2, 3, False)
self._table = tab
self._name = gtk.Label('')
@@ -48,6 +48,11 @@ class GoTermView (gtk.Frame):
tab.attach(name_label, 0, 1, 0, 1, gtk.FILL, gtk.FILL, 5, 5)
tab.attach(self._name, 1, 2, 0, 1, gtk.FILL|gtk.EXPAND, gtk.FILL, 5, 5)
self._isa_parents = gtk.HBox()
isa_parents_label = gtk.Label('Is a:')
tab.attach(isa_parents_label, 0, 1, 1, 2, gtk.FILL, gtk.FILL, 5, 5)
tab.attach(self._isa_parents, 1, 2, 1, 2, gtk.FILL, gtk.FILL, 5, 5)
self._def = gtk.TextBuffer()
textview = gtk.TextView(self._def)
textview.set_wrap_mode(gtk.WRAP_WORD)
@@ -55,9 +60,10 @@ class GoTermView (gtk.Frame):
scrolled_window.add(textview)
def_label = gtk.Label('Def:')
def_label.set_alignment(0.0, 0.0)
tab.attach(def_label, 0, 1, 1, 2, gtk.FILL, gtk.FILL, 5, 5)
tab.attach(scrolled_window, 1, 2, 1, 2, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 5, 5)
tab.attach(def_label, 0, 1, 2, 3, gtk.FILL, gtk.FILL, 5, 5)
tab.attach(scrolled_window, 1, 2, 2, 3, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 5, 5)
self._tab = tab
self.add(tab)
self.set_go_term(None)
@@ -66,16 +72,28 @@ class GoTermView (gtk.Frame):
self.set_label(term['id'])
self._name.set_text(term['name'])
self._def.set_text(term['def'])
self._tab.remove(self._isa_parents)
self._isa_parents = gtk.HBox()
for p in term['is_a']:
btn = gtk.Button(p)
btn.show()
self._isa_parents.add(btn)
self._isa_parents.show()
self._tab.attach(self._isa_parents, 1, 2, 1, 2, gtk.FILL, gtk.FILL, 5, 5)
else:
self.set_label('GO Term')
self._name.set_text('')
self._def.set_text('')
self._tab.remove(self._isa_parents)
self._isa_parents = gtk.HBox()
self._tab.attach(self._isa_parents, 1, 2, 1, 2, gtk.FILL, gtk.FILL, 5, 5)
class GeneOntologyTree (gtk.HPaned):
def __init__(self, network):
gtk.HPaned.__init__(self)
self.set_position(400)
treemodel = geneontology.get_go_treestore(network)
self._treemodel = treemodel

View File

@@ -13,8 +13,8 @@ class SmallTestWorkflow(workflow.Workflow):
ident = 'smokers'
description = 'A small test workflow for gene expression analysis.'
def __init__(self, app):
workflow.Workflow.__init__(self, app)
def __init__(self):
workflow.Workflow.__init__(self)
# DATA IMPORT
load = workflow.Stage('load', 'Data')