* fluent: General cleanup.
This commit is contained in:
@@ -2,6 +2,9 @@ import gtk
|
||||
import logger
|
||||
from annotations import Annotations
|
||||
from workflow import *
|
||||
import geneontology
|
||||
import gostat
|
||||
from scipy import array
|
||||
|
||||
class EinarsWorkflow (Workflow):
|
||||
|
||||
@@ -19,7 +22,7 @@ class EinarsWorkflow (Workflow):
|
||||
|
||||
go = Stage('go', 'Gene Ontology Data')
|
||||
go.add_function(LoadAnnotationsFunction())
|
||||
go.add_function(Function('godist', 'GO Distances'))
|
||||
go.add_function(GODistanceFunction())
|
||||
self.add_stage(go)
|
||||
|
||||
regression = Stage('regression', 'Regression')
|
||||
@@ -37,6 +40,7 @@ class LoadAnnotationsFunction(Function):
|
||||
def load_file(self, filename):
|
||||
f = open(filename)
|
||||
self.annotations = Annotations('genes', 'go-terms')
|
||||
logger.log('notice', 'Loading annotation file: %s' % filename)
|
||||
|
||||
for line in f.readlines():
|
||||
val = line.split(' \t')
|
||||
@@ -61,3 +65,21 @@ class LoadAnnotationsFunction(Function):
|
||||
dialog.destroy()
|
||||
return [self.annotations]
|
||||
|
||||
class GODistanceFunction(Function):
|
||||
|
||||
def __init__(self):
|
||||
Function.__init__(self, 'go_diatance', 'GO Distances')
|
||||
self.output = None
|
||||
|
||||
def run(self, data):
|
||||
logger.log('debug', 'datatype: %s' % type(data))
|
||||
if not type(data) == Annotations:
|
||||
return None
|
||||
|
||||
logger.log('debug', 'dimensions: %s' % data.dimensions)
|
||||
|
||||
genes = data.get_ids('genes')
|
||||
gene_distances = array((len(genes), len(genes)))
|
||||
|
||||
return gene_distances
|
||||
|
||||
|
Reference in New Issue
Block a user