Fixed drag'n'drop of datasets to DAG-plots to convert inf/-inf to
maximum/minimum values of the dataset.
This commit is contained in:
parent
e84a202fbe
commit
0bc4a6e3f0
@ -1,6 +1,6 @@
|
||||
|
||||
import gtk
|
||||
from fluents import dataset, logger, plots, workflow, fluents, project
|
||||
from fluents import dataset, logger, plots, workflow, fluents, project, view
|
||||
import geneontology
|
||||
from matplotlib.nxutils import points_inside_poly
|
||||
import matplotlib
|
||||
@ -547,12 +547,13 @@ class VolcanoPlot(plots.ScatterPlot):
|
||||
name="Volcano plot",
|
||||
sel_dim_2='_p', **kw)
|
||||
|
||||
|
||||
|
||||
class DagPlot(plots.Plot):
|
||||
def __init__(self, graph, dim='go-terms', pos=None, nodecolor='b', nodesize=40,
|
||||
with_labels=False, name='DAG Plot'):
|
||||
|
||||
plots.Plot.__init__(self, name)
|
||||
self._add_ic_spin_button()
|
||||
self.nodes = graph.nodes()
|
||||
self.graph = graph
|
||||
self._pos = pos
|
||||
@ -617,6 +618,25 @@ class DagPlot(plots.Plot):
|
||||
self.axes.set_frame_on(False)
|
||||
self.fig.subplots_adjust(left=0, right=1, bottom=0, top=1)
|
||||
|
||||
def _add_ic_spin_button(self):
|
||||
sb = gtk.SpinButton()
|
||||
sb.set_range(0, 100)
|
||||
sb.set_value(1)
|
||||
sb.set_increments(1, 3)
|
||||
label = gtk.Label("IC > ")
|
||||
hbox = gtk.HBox()
|
||||
hbox.pack_start(label)
|
||||
hbox.pack_start(sb)
|
||||
ti = gtk.ToolItem()
|
||||
ti.set_expand(False)
|
||||
ti.add(hbox)
|
||||
sb.show()
|
||||
label.show()
|
||||
hbox.show()
|
||||
ti.show()
|
||||
self._toolbar.insert(ti, -1)
|
||||
ti.set_tooltip(self._toolbar.tooltips, "Set information content threshold")
|
||||
|
||||
def _calc_pos(self, graph):
|
||||
"""Calculates position for graph nodes."""
|
||||
gv_graph = networkx.DiGraph()
|
||||
@ -704,7 +724,13 @@ class DagPlot(plots.Plot):
|
||||
|
||||
indices = ds.get_indices(self.current_dim, self.nodes)
|
||||
nodes = ds.existing_identifiers(self.current_dim, self.nodes)
|
||||
|
||||
v = vec.take(indices, 0)
|
||||
vec_min = min(v[v > -inf])
|
||||
vec_max = max(v[v < inf])
|
||||
v[v==inf] = vec_max
|
||||
v[v==-inf] = vec_min
|
||||
|
||||
d = dict(zip(nodes, list(v)))
|
||||
|
||||
map_vec = zeros(len(self.nodes))
|
||||
|
Reference in New Issue
Block a user