Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0
This repository has been archived on 2024-07-04. You can view files and clone it, but cannot push or open issues or pull requests.
laydi/workflows/test_workflow.py

66 lines
1.9 KiB
Python
Raw Normal View History

import gtk
from fluents import dataset, logger, plots, workflow
#import geneontology
#import gostat
2007-09-03 18:16:39 +02:00
from scipy import array, randn, log, ones, newaxis
import cPickle
import networkx
class TestWorkflow (workflow.Workflow):
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
2007-09-03 17:46:45 +02:00
def __init__(self):
workflow.Workflow.__init__(self)
2007-09-03 15:22:11 +02:00
load = workflow.Stage('load', 'Test Data')
2007-09-03 17:46:45 +02:00
load.add_task(TestDataTask)
2007-09-03 17:50:16 +02:00
load.add_task(TestPlot)
self.add_stage(load)
2007-09-03 15:22:11 +02:00
class TestDataTask(workflow.Task):
2007-09-03 17:46:45 +02:00
name = "Test data"
2007-09-03 17:46:45 +02:00
def __init__(self, input):
workflow.Task.__init__(self, input)
2006-05-03 13:52:54 +02:00
def run(self):
logger.log('notice', 'Injecting foo test data')
2006-10-17 15:59:31 +02:00
x = randn(500,15)
X = dataset.Dataset(x)
2007-09-03 18:16:39 +02:00
dname = X.get_dim_name()[0]
p = plots.ScatterPlot(X, X, dname, dname, '0_1', '0_2',name='scatter')
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)
cds = dataset.CategoryDataset(ones([3, 3]))
2007-09-03 18:16:39 +02:00
dname2 = cds.get_dim_name()[0]
ds_scatter = plots.ScatterMarkerPlot(cds, cds, dname2, dname2, '0_1', '0_2')
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-09-03 18:16:39 +02:00
return [X, ds, p, ds_plot, ds_scatter, cds, lp, vp]
2006-04-22 02:17:22 +02:00
2007-09-03 17:50:16 +02:00
class TestPlot(workflow.Task):
name = "Test plot data"
def __init__(self, input):
workflow.Task.__init__(self, input)
def run(self):
logger.log('notice', 'Injecting foo test data')
x = randn(500,15)
X = dataset.Dataset(x)
2007-09-03 18:16:39 +02:00
ii = X.get_dim_name()
p = plots.ScatterPlot(X, X, ii[0], ii[0], '0_1', '0_2',name='scatter')
2007-09-03 17:50:16 +02:00
return [p]