Fixed selection in DAG-plot to work both with and without IC set.
This commit is contained in:
parent
b334e94b15
commit
94f4b276b9
|
@ -633,17 +633,17 @@ class DagPlot(plots.Plot):
|
||||||
def _add_ic_spin_buttons(self):
|
def _add_ic_spin_buttons(self):
|
||||||
"""Adds spin buttons to the toolbar for selecting minimum and maximum
|
"""Adds spin buttons to the toolbar for selecting minimum and maximum
|
||||||
threshold values on information content."""
|
threshold values on information content."""
|
||||||
sb_min = gtk.SpinButton()
|
sb_min = gtk.SpinButton(digits=2)
|
||||||
sb_min.set_range(0, 100)
|
sb_min.set_range(0, 100)
|
||||||
sb_min.set_value(1)
|
sb_min.set_value(0)
|
||||||
sb_min.set_increments(1, 3)
|
sb_min.set_increments(.1, 1.)
|
||||||
sb_min.connect('value-changed', self._on_ic_value_changed)
|
sb_min.connect('value-changed', self._on_ic_value_changed)
|
||||||
self._ic_sb_min = sb_min
|
self._ic_sb_min = sb_min
|
||||||
|
|
||||||
sb_max = gtk.SpinButton()
|
sb_max = gtk.SpinButton(digits=2)
|
||||||
sb_max.set_range(0, 100)
|
sb_max.set_range(0, 100)
|
||||||
sb_max.set_value(1)
|
sb_max.set_value(1)
|
||||||
sb_max.set_increments(1, 3)
|
sb_max.set_increments(.1, 1.)
|
||||||
sb_max.connect('value-changed', self._on_ic_value_changed)
|
sb_max.connect('value-changed', self._on_ic_value_changed)
|
||||||
self._ic_sb_max = sb_max
|
self._ic_sb_max = sb_max
|
||||||
|
|
||||||
|
@ -694,7 +694,7 @@ class DagPlot(plots.Plot):
|
||||||
icnodes = ic.existing_identifiers('go-terms', self.nodes)
|
icnodes = ic.existing_identifiers('go-terms', self.nodes)
|
||||||
icindices = ic.get_indices('go-terms', icnodes)
|
icindices = ic.get_indices('go-terms', icnodes)
|
||||||
a = ravel(ic.asarray()[icindices])
|
a = ravel(ic.asarray()[icindices])
|
||||||
ic_good = set(array(icnodes)[(a>ic_min) & (a<ic_max)])
|
ic_good = set(array(icnodes)[(a>=ic_min) & (a<=ic_max)])
|
||||||
|
|
||||||
sizes = zeros(len(self.nodes))
|
sizes = zeros(len(self.nodes))
|
||||||
visible = set()
|
visible = set()
|
||||||
|
@ -728,7 +728,10 @@ class DagPlot(plots.Plot):
|
||||||
assert y1<=y2
|
assert y1<=y2
|
||||||
|
|
||||||
index = nonzero((xdata>x1) & (xdata<x2) & (ydata>y1) & (ydata<y2))[0]
|
index = nonzero((xdata>x1) & (xdata<x2) & (ydata>y1) & (ydata<y2))[0]
|
||||||
|
if getattr(main.workflow, 'current_ic', None) != None:
|
||||||
ids = self.visible.intersection([self.nodes[i] for i in index])
|
ids = self.visible.intersection([self.nodes[i] for i in index])
|
||||||
|
else:
|
||||||
|
ids = set([self.nodes[i] for i in index])
|
||||||
ids = self.update_selection(ids, key)
|
ids = self.update_selection(ids, key)
|
||||||
self.selection_listener(self.current_dim, ids)
|
self.selection_listener(self.current_dim, ids)
|
||||||
|
|
||||||
|
@ -798,11 +801,15 @@ class DagPlot(plots.Plot):
|
||||||
|
|
||||||
map_vec = zeros(len(self.nodes))
|
map_vec = zeros(len(self.nodes))
|
||||||
for i, n in enumerate(self.nodes):
|
for i, n in enumerate(self.nodes):
|
||||||
map_vec[i] = d.get(n, -1)
|
map_vec[i] = d.get(n, vec_min)
|
||||||
|
|
||||||
# update facecolors
|
# update facecolors
|
||||||
self.node_collection.set_array(map_vec)
|
self.node_collection.set_array(map_vec)
|
||||||
self.node_collection.set_clim(vec_min, vec_max)
|
self.node_collection.set_clim(vec_min, vec_max)
|
||||||
self.node_collection.update_scalarmappable() #sets facecolors from array
|
self.node_collection.update_scalarmappable() #sets facecolors from array
|
||||||
self.canvas.draw()
|
self._ic_sb_min.set_range(0, vec_max)
|
||||||
|
self._ic_sb_min.set_value(vec_min)
|
||||||
|
self._ic_sb_max.set_range(0, vec_max)
|
||||||
|
self._ic_sb_max.set_value(vec_max)
|
||||||
|
|
||||||
|
self.canvas.draw()
|
||||||
|
|
Reference in New Issue