Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Added text-input for contrast-matrix creator for affymetrics workflow.

This commit is contained in:
Truls Alexander Tangstad 2006-05-05 14:30:23 +00:00
parent 98445498b5
commit 97f56f66ac
2 changed files with 43 additions and 2 deletions

View File

@ -79,3 +79,30 @@ class CreateProjectDruid(gtk.Window):
wf = self.workflows.get_value(it, 1) wf = self.workflows.get_value(it, 1)
self.wf_info.set_text(wf.description) self.wf_info.set_text(wf.description)
def get_text(title, text):
"""Allow user to type in a string for text."""
dlg = gtk.Dialog(title)
dlg.show()
text = gtk.Label(text)
text.show()
entry = gtk.Entry()
entry.show()
entry.set_activates_default(True)
dlg.vbox.pack_start(text)
dlg.vbox.pack_start(entry)
dlg.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
dlg.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
dlg.set_default_response(gtk.RESPONSE_OK)
response = dlg.run()
retval = None
if response == gtk.RESPONSE_OK:
retval = entry.get_text()
dlg.destroy()
return retval

View File

@ -1,5 +1,5 @@
import gtk import gtk
from system import dataset, logger, plots, workflow from system import dataset, logger, plots, workflow, dialogs
from scipy import randn, array, transpose, zeros from scipy import randn, array, transpose, zeros
import cPickle import cPickle
@ -17,6 +17,7 @@ class AffyWorkflow (workflow.Workflow):
load.add_function(PhenotypeImportFunction()) load.add_function(PhenotypeImportFunction())
load.add_function(TestDataFunction()) load.add_function(TestDataFunction())
load.add_function(DatasetLoadFunction()) load.add_function(DatasetLoadFunction())
load.add_function(ContrastMatrixGenerateFunction())
self.add_stage(load) self.add_stage(load)
explore = workflow.Stage('explore', 'Explorative analysis') explore = workflow.Stage('explore', 'Explorative analysis')
@ -103,7 +104,20 @@ class DatasetSaveFunction(workflow.Function):
logger.log("notice", "Saved data to %r." % chooser.get_filename()) logger.log("notice", "Saved data to %r." % chooser.get_filename())
finally: finally:
chooser.destroy() chooser.destroy()
class ContrastMatrixGenerateFunction(workflow.Function):
def __init__(self):
workflow.Function.__init__(self, 'contrast_create', 'Create contrast matrix')
def run(self, data):
response = dialogs.get_text('Enter contrasts...', """\
Enter comma-separated list of contrasts.
Available categories: %s
Example: Y-N, M-F""" % ", ".join(data.get_categories()))
logger.log("notice", "contrasts selected: %s" % response)
class CelFileImportFunction(workflow.Function): class CelFileImportFunction(workflow.Function):
"""Loads Affymetrics .CEL-files into matrix.""" """Loads Affymetrics .CEL-files into matrix."""