2006-04-17 22:29:29 +02:00
|
|
|
import gtk
|
2006-10-17 16:42:27 +02:00
|
|
|
from fluents import dataset, logger, plots, workflow
|
2006-04-20 12:27:58 +02:00
|
|
|
#import geneontology
|
|
|
|
#import gostat
|
2006-09-08 20:25:03 +02:00
|
|
|
from scipy import array, randn, log, ones
|
2006-04-22 18:27:33 +02:00
|
|
|
import cPickle
|
2006-08-01 15:22:39 +02:00
|
|
|
import networkx
|
2006-04-17 22:29:29 +02:00
|
|
|
|
2006-07-21 16:30:09 +02:00
|
|
|
class TestWorkflow (workflow.Workflow):
|
2006-04-17 22:29:29 +02:00
|
|
|
|
2006-07-21 16:30:09 +02:00
|
|
|
name = 'Test Workflow'
|
|
|
|
ident = 'test'
|
2007-09-03 15:22:11 +02:00
|
|
|
description = 'This workflow currently serves as a general testing workflow.'
|
2006-04-27 14:41:51 +02:00
|
|
|
|
2006-04-17 22:29:29 +02:00
|
|
|
def __init__(self, app):
|
2006-04-24 16:52:21 +02:00
|
|
|
workflow.Workflow.__init__(self, app)
|
2006-04-17 22:29:29 +02:00
|
|
|
|
2007-09-03 15:22:11 +02:00
|
|
|
load = workflow.Stage('load', 'Test Data')
|
2006-04-20 16:29:13 +02:00
|
|
|
load.add_function(TestDataFunction())
|
2006-04-17 22:29:29 +02:00
|
|
|
self.add_stage(load)
|
|
|
|
|
|
|
|
|
2007-09-03 15:22:11 +02:00
|
|
|
class TestDataTask(workflow.Task):
|
|
|
|
title = "Test data"
|
2006-04-17 22:29:29 +02:00
|
|
|
|
|
|
|
def __init__(self):
|
2007-09-03 15:22:11 +02:00
|
|
|
workflow.Task.__init__(self)
|
2006-04-20 16:29:13 +02:00
|
|
|
|
2006-05-03 13:52:54 +02:00
|
|
|
def run(self):
|
2006-04-20 16:29:13 +02:00
|
|
|
logger.log('notice', 'Injecting foo test data')
|
2006-10-17 15:59:31 +02:00
|
|
|
x = randn(500,15)
|
2006-04-24 11:53:07 +02:00
|
|
|
X = dataset.Dataset(x)
|
2006-08-31 12:04:19 +02:00
|
|
|
p = plots.ScatterPlot(X, X, 'rows', 'rows', '0_1', '0_2',name='scatter')
|
2007-09-03 15:22:11 +02:00
|
|
|
# p2 = plots.ScatterMarkerPlot(X, X, 'rows', 'rows', '0_1', '0_2',name='marker')
|
2006-08-01 15:22:39 +02:00
|
|
|
graph = networkx.XGraph()
|
|
|
|
for x in 'ABCDEF':
|
|
|
|
for y in 'ADE':
|
|
|
|
graph.add_edge(x, y, 3)
|
|
|
|
ds = dataset.GraphDataset(array(networkx.adj_matrix(graph)))
|
|
|
|
ds_plot = plots.NetworkPlot(ds)
|
2006-09-08 20:25:03 +02:00
|
|
|
|
|
|
|
cds = dataset.CategoryDataset(ones([3, 3]))
|
2007-09-03 15:22:11 +02:00
|
|
|
ds_scatter = plots.ScatterMarkerPlot(ds, ds,
|
|
|
|
'rows_0', 'rows_0',
|
|
|
|
'0_1', '0_2')
|
2006-10-17 15:59:31 +02:00
|
|
|
lp = plots.LineViewPlot(X,major_axis=0)
|
2007-01-31 14:03:27 +01:00
|
|
|
vp = plots.VennPlot()
|
2007-09-03 15:22:11 +02:00
|
|
|
self.datasets = [p]
|
2007-01-31 14:03:27 +01:00
|
|
|
return [X, ds, p, ds_plot, ds_scatter, p2, cds, lp, vp]
|
2006-04-22 02:17:22 +02:00
|
|
|
|