workflow update
This commit is contained in:
parent
2e53626393
commit
aa6f598f87
|
@ -2,7 +2,7 @@ import gtk
|
||||||
import logger
|
import logger
|
||||||
from workflow import *
|
from workflow import *
|
||||||
from scipy import array
|
from scipy import array
|
||||||
from data import read_affy_annot
|
from data import read_affy_annot,read_mootha,data_dict_to_matrix
|
||||||
import plots
|
import plots
|
||||||
|
|
||||||
class PCAWorkflow(Workflow):
|
class PCAWorkflow(Workflow):
|
||||||
|
@ -12,7 +12,7 @@ class PCAWorkflow(Workflow):
|
||||||
self.name = 'PCAs Workflow'
|
self.name = 'PCAs Workflow'
|
||||||
|
|
||||||
load = Stage('load', 'Load Data')
|
load = Stage('load', 'Load Data')
|
||||||
load.add_function(Function('load_mootha', 'Load Microarrays'))
|
load.add_function(Function('load_mootha', 'Load'))
|
||||||
self.add_stage(load)
|
self.add_stage(load)
|
||||||
|
|
||||||
preproc = Stage('preprocess', 'Preprocessing')
|
preproc = Stage('preprocess', 'Preprocessing')
|
||||||
|
@ -103,3 +103,34 @@ class PCAFunction(Function):
|
||||||
|
|
||||||
return [T,P,E,r]
|
return [T,P,E,r]
|
||||||
|
|
||||||
|
class LoadMoothaData(Function):
|
||||||
|
def __init__(self):
|
||||||
|
Function.__init__(self, 'load', 'Load diabetes data')
|
||||||
|
self.annotations = None
|
||||||
|
|
||||||
|
def load_expression_file(self, filename):
|
||||||
|
f = open(filename)
|
||||||
|
logger.log('notice', 'Loading expression file: %s' % filename)
|
||||||
|
self.file = f
|
||||||
|
|
||||||
|
def on_response(self, dialog, response):
|
||||||
|
if response == gtk.RESPONSE_OK:
|
||||||
|
logger.log('notice', 'Reading file: %s' % dialog.get_filename())
|
||||||
|
self.load_expression_file(dialog.get_filename())
|
||||||
|
|
||||||
|
def run(self, data):
|
||||||
|
btns = ('Open', gtk.RESPONSE_OK, \
|
||||||
|
'Cancel', gtk.RESPONSE_CANCEL)
|
||||||
|
dialog = gtk.FileChooserDialog('Open Affy Annotation File',
|
||||||
|
buttons=btns)
|
||||||
|
dialog.connect('response', self.on_response)
|
||||||
|
dialog.run()
|
||||||
|
dialog.destroy()
|
||||||
|
|
||||||
|
### Reading and parsing here
|
||||||
|
d,sample_names = read_mootha(self.file)
|
||||||
|
x,gene_ids = data_dict_to_matrix(d)
|
||||||
|
gene_def = ['genes',gene_ids]
|
||||||
|
sample_def = ['samples', sample_names]
|
||||||
|
X = dataset.Dataset(x,[sample_def,gene_def]) # samples x genes
|
||||||
|
return X
|
||||||
|
|
Reference in New Issue