The navigator now displays the plots and data in a tree that shows the ancestry information.
This commit is contained in:
@@ -1,55 +1,55 @@
|
||||
import gtk
|
||||
import logger
|
||||
from annotations import Annotations
|
||||
from workflow import *
|
||||
import workflow
|
||||
import plots
|
||||
import dataset
|
||||
#import geneontology
|
||||
#import gostat
|
||||
from scipy import array,randn
|
||||
from scipy import array,randn,log
|
||||
import cPickle
|
||||
|
||||
class EinarsWorkflow (Workflow):
|
||||
class EinarsWorkflow (workflow.Workflow):
|
||||
|
||||
name = 'Test Workflow'
|
||||
description = 'Gene Ontology Workflow. This workflow currently serves as a general testing workflow.'
|
||||
def __init__(self, app):
|
||||
Workflow.__init__(self, app)
|
||||
workflow.Workflow.__init__(self, app)
|
||||
|
||||
load = Stage('load', 'Load Data')
|
||||
load.add_function(Function('load', 'Load Microarrays'))
|
||||
load = workflow.Stage('load', 'Load Data')
|
||||
load.add_function(CelFileImportFunction())
|
||||
load.add_function(TestDataFunction())
|
||||
load.add_function(DatasetLoadFunction())
|
||||
self.add_stage(load)
|
||||
|
||||
preproc = Stage('preprocess', 'Preprocessing')
|
||||
preproc.add_function(Function('rma', 'RMA'))
|
||||
preproc = workflow.Stage('preprocess', 'Preprocessing')
|
||||
preproc.add_function(DatasetLog())
|
||||
preproc.add_function(workflow.Function('rma', 'RMA'))
|
||||
self.add_stage(preproc)
|
||||
|
||||
go = Stage('go', 'Gene Ontology Data')
|
||||
go = workflow.Stage('go', 'Gene Ontology Data')
|
||||
go.add_function(LoadAnnotationsFunction())
|
||||
go.add_function(GODistanceFunction())
|
||||
self.add_stage(go)
|
||||
|
||||
regression = Stage('regression', 'Regression')
|
||||
regression.add_function(Function('pls', 'PLS'))
|
||||
regression = workflow.Stage('regression', 'Regression')
|
||||
regression.add_function(workflow.Function('pls', 'PLS'))
|
||||
self.add_stage(regression)
|
||||
|
||||
explore = Stage('explore', 'Explorative analysis')
|
||||
explore = workflow.Stage('explore', 'Explorative analysis')
|
||||
explore.add_function(PCAFunction(self))
|
||||
self.add_stage(explore)
|
||||
|
||||
save = Stage('save', 'Save Data')
|
||||
save = workflow.Stage('save', 'Save Data')
|
||||
save.add_function(DatasetSaveFunction())
|
||||
self.add_stage(save)
|
||||
|
||||
logger.log('debug', '\tEinar\'s workflow is now active')
|
||||
|
||||
class LoadAnnotationsFunction(Function):
|
||||
class LoadAnnotationsFunction(workflow.Function):
|
||||
|
||||
def __init__(self):
|
||||
Function.__init__(self, 'load-go-ann', 'Load Annotations')
|
||||
workflow.Function.__init__(self, 'load-go-ann', 'Load Annotations')
|
||||
self.annotations = None
|
||||
|
||||
def load_file(self, filename):
|
||||
@@ -80,10 +80,10 @@ class LoadAnnotationsFunction(Function):
|
||||
dialog.destroy()
|
||||
return [self.annotations]
|
||||
|
||||
class GODistanceFunction(Function):
|
||||
class GODistanceFunction(workflow.Function):
|
||||
|
||||
def __init__(self):
|
||||
Function.__init__(self, 'go_diatance', 'GO Distances')
|
||||
workflow.Function.__init__(self, 'go_diatance', 'GO Distances')
|
||||
self.output = None
|
||||
|
||||
def run(self, data):
|
||||
@@ -99,9 +99,9 @@ class GODistanceFunction(Function):
|
||||
return gene_distances
|
||||
|
||||
|
||||
class TestDataFunction(Function):
|
||||
class TestDataFunction(workflow.Function):
|
||||
def __init__(self):
|
||||
Function.__init__(self, 'test_data', 'Generate Test Data')
|
||||
workflow.Function.__init__(self, 'test_data', 'Generate Test Data')
|
||||
|
||||
def run(self, data):
|
||||
logger.log('notice', 'Injecting foo test data')
|
||||
@@ -109,11 +109,20 @@ class TestDataFunction(Function):
|
||||
X = dataset.Dataset(x)
|
||||
return [X, plots.SinePlot()]
|
||||
|
||||
class DatasetLog(workflow.Function):
|
||||
def __init__(self):
|
||||
workflow.Function.__init__(self, 'log', 'Log')
|
||||
|
||||
class DatasetLoadFunction(Function):
|
||||
def run(self, data):
|
||||
logger.log('notice', 'Taking the log of dataset %s' % data.get_name())
|
||||
d = data.asarray()
|
||||
d = log(d)
|
||||
return [dataset.Dataset(d)]
|
||||
|
||||
class DatasetLoadFunction(workflow.Function):
|
||||
"""Loader for previously pickled Datasets."""
|
||||
def __init__(self):
|
||||
Function.__init__(self, 'load_data', 'Load Pickled Dataset')
|
||||
workflow.Function.__init__(self, 'load_data', 'Load Pickled Dataset')
|
||||
|
||||
def run(self, data):
|
||||
chooser = gtk.FileChooserDialog(title="Select cel files...", parent=None,
|
||||
@@ -136,10 +145,10 @@ class DatasetLoadFunction(Function):
|
||||
chooser.destroy()
|
||||
|
||||
|
||||
class DatasetSaveFunction(Function):
|
||||
class DatasetSaveFunction(workflow.Function):
|
||||
"""QND way to save data to file for later import to this program."""
|
||||
def __init__(self):
|
||||
Function.__init__(self, 'save_data', 'Save Pickled Dataset')
|
||||
workflow.Function.__init__(self, 'save_data', 'Save Pickled Dataset')
|
||||
|
||||
def run(self, data):
|
||||
if not data:
|
||||
@@ -168,10 +177,10 @@ class DatasetSaveFunction(Function):
|
||||
chooser.destroy()
|
||||
|
||||
|
||||
class CelFileImportFunction(Function):
|
||||
class CelFileImportFunction(workflow.Function):
|
||||
"""Loads AffyMetrix .CEL-files into matrix."""
|
||||
def __init__(self):
|
||||
Function.__init__(self, 'cel_import', 'Import Affy')
|
||||
workflow.Function.__init__(self, 'cel_import', 'Import Affy')
|
||||
|
||||
def run(self, data):
|
||||
import rpy
|
||||
@@ -214,11 +223,11 @@ class CelFileImportFunction(Function):
|
||||
chooser.destroy()
|
||||
|
||||
|
||||
class PCAFunction(Function):
|
||||
class PCAFunction(workflow.Function):
|
||||
"""Generic PCA function."""
|
||||
def __init__(self, workflow):
|
||||
Function.__init__(self, 'pca', 'PCA')
|
||||
self._workflow = workflow
|
||||
def __init__(self, wf):
|
||||
workflow.Function.__init__(self, 'pca', 'PCA')
|
||||
self._workflow = wf
|
||||
|
||||
def run(self, data):
|
||||
import rpy
|
||||
|
Reference in New Issue
Block a user