Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0

Created new workflow for showing information about a dataset as a view.

This commit is contained in:
Truls Alexander Tangstad 2006-04-21 13:04:31 +00:00
parent e4831ada13
commit c4f9f5c399
1 changed files with 35 additions and 0 deletions

View File

@ -17,6 +17,7 @@ class EinarsWorkflow (Workflow):
load = Stage('load', 'Load Data') load = Stage('load', 'Load Data')
load.add_function(Function('load', 'Load Microarrays')) load.add_function(Function('load', 'Load Microarrays'))
load.add_function(TestDataFunction()) load.add_function(TestDataFunction())
load.add_function(DatasetInfoFunction())
self.add_stage(load) self.add_stage(load)
preproc = Stage('preprocess', 'Preprocessing') preproc = Stage('preprocess', 'Preprocessing')
@ -99,3 +100,37 @@ class TestDataFunction(Function):
X = dataset.Dataset(x,[axis_0,axis_1]) X = dataset.Dataset(x,[axis_0,axis_1])
return [X] return [X]
class DatasetInfoFunction(Function):
def __init__(self):
Function.__init__(self, 'data_info', 'Show information')
def run(self, data):
if data:
logger.log('notice', 'Generating view for %s.' % data.get_name())
return [DatasetInfoView(data)]
else:
logger.log('notice', 'Not generating view... no data.')
return []
class DatasetInfoView(plots.Plot):
def __init__(self, data):
plots.Plot.__init__(self, None)
buf = gtk.TextBuffer()
buf_iter = buf.get_start_iter()
buf.insert(buf_iter, "Data: %s\n\n" % data.get_name())
buf.insert(buf_iter, "Dimensions: ")
dims = []
for name in data.get_dim_names():
dims.append((name, data.dims[data._dim_num[name]]))
buf.insert(buf_iter, ", ".join(["%s (%d)" % dim for dim in dims]))
area = gtk.TextView(buf)
area.connect('button_press_event', self.on_button_press)
area.set_editable(False)
self.add(area)
area.show()