Changes to DAG plot.
This commit is contained in:
parent
5cfa505ae2
commit
f07ce85e46
|
@ -483,8 +483,9 @@ class SetICFunction(workflow.Function):
|
|||
return
|
||||
|
||||
class PlotDagFunction(workflow.Function):
|
||||
def __init__(self):
|
||||
def __init__(self, subtree="bp"):
|
||||
workflow.Function.__init__(self, 'go-dag', 'Build DAG')
|
||||
self.subtree = subtree
|
||||
|
||||
def run(self, selection):
|
||||
g = self.get_network(list(selection['go-terms']))
|
||||
|
@ -493,7 +494,7 @@ class PlotDagFunction(workflow.Function):
|
|||
name="DAG")
|
||||
return [ThresholdDagPlot(g)]
|
||||
|
||||
def get_network(self, terms, subtree='bp'):
|
||||
def get_network(self, terms):
|
||||
"""Returns a DAG connecting the given terms by including their parents
|
||||
up to the level needed to connect them. The subtree parameter is one of
|
||||
mf - molecular function
|
||||
|
@ -502,6 +503,7 @@ class PlotDagFunction(workflow.Function):
|
|||
|
||||
rpy.r.library("GOstats")
|
||||
|
||||
subtree = self.subtree
|
||||
if subtree == 'mf':
|
||||
subtree_r = rpy.r.GOMFPARENTS
|
||||
elif subtree == 'bp':
|
||||
|
@ -573,6 +575,7 @@ class DagPlot(plots.Plot):
|
|||
self._nodecolor = nodecolor
|
||||
self._with_labels = with_labels
|
||||
self.visible = set()
|
||||
self.labels = {}
|
||||
|
||||
self.current_dim = dim
|
||||
|
||||
|
@ -753,15 +756,15 @@ class ThresholdDagPlot(DagPlot, plots.PlotThresholder):
|
|||
with_labels=False, name='DAG Plot'):
|
||||
DagPlot.__init__(self, graph, dim='go-terms', pos=None,
|
||||
nodecolor='b', nodesize=40,
|
||||
with_labels=False, name='DAG Plot')
|
||||
with_labels=True, name='DAG Plot')
|
||||
plots.PlotThresholder.__init__(self, "IC")
|
||||
|
||||
def rectangle_select_callback(self, x1, y1, x2, y2, key):
|
||||
ids = self.points_in_rect(x1, y1, x2, y2, key)
|
||||
ids = self.visible.intersection(ids)
|
||||
ids = self.update_selection(ids, key)
|
||||
|
||||
self.selection_listener(self.current_dim, ids)
|
||||
# def rectangle_select_callback(self, x1, y1, x2, y2, key):
|
||||
# ids = self.points_in_rect(x1, y1, x2, y2, key)
|
||||
# ids = self.visible.intersection(ids)
|
||||
# ids = self.update_selection(ids, key)
|
||||
#
|
||||
# self.selection_listener(self.current_dim, ids)
|
||||
|
||||
def _update_color_from_dataset(self, ds):
|
||||
DagPlot._update_color_from_dataset(self, ds)
|
||||
|
|
|
@ -66,6 +66,8 @@ class SmallTestWorkflow(workflow.Workflow):
|
|||
# go.add_function(gobrowser.DistanceToSelectionFunction())
|
||||
# go.add_function(gobrowser.TTestFunction())
|
||||
go.add_function(gobrowser.PlotDagFunction())
|
||||
go.add_function(gobrowser.PlotDagFunction("cc"))
|
||||
go.add_function(gobrowser.PlotDagFunction("mf"))
|
||||
go.add_function(GoEnrichment())
|
||||
go.add_function(GoEnrichmentCond())
|
||||
go.add_function(MapGO2Gene())
|
||||
|
|
Reference in New Issue