Commits

Blaz Zupan committed 0817fd6

no message

Comments (0)

Files changed (6)

     pass
 
 class OWChipANOVA(OWWidget):
-    settingsList  = ['p1', 'p2', 'p3', 'filter1', 'filter2', 'filter3', 'commitOnChange']
+    settingsList  = ['p1', 'p2', 'p3', 'filter1', 'filter2', 'filter3', 'commitOnChange', 'selectorName', 'updateSelectorName']
 
     def __init__(self, parent=None, name='ANOVA on Chip Data'):
         OWWidget.__init__(self, parent, name, "ANOVA on chip data (strains, replicas).")
         self.callbackDeposit = []
 
         self.inputs = [("Structured Chip Data", ChipData, self.chipdata, 1)]
-        self.outputs = [("Selected Data", ChipData), ("Other Data", ChipData), ("Results of ANOVA", ANOVAResults), ("Gene Selection", GeneSelection)]
+        self.outputs = [("Results of ANOVA", ANOVAResults), ("Gene Selection", GeneSelection), ("Selected Data", ChipData), ("Other Data", ChipData)]
 
         self.commitOnChange = 0
         self.chipdata = None
         self.p1, self.p2, self.p3 = (2, 2, 2)
         self.filter1, self.filter2, self.filter3 = (1, 0, 0)
+        self.selectorName = 'ANOVA'
+        self.updateSelectorName = 1
         # Settings
         self.loadSettings()
         self.ps = None
         box = QVGroupBox("Info", self.controlArea)
         self.infoa = QLabel('No data on input.', box)
         self.infob = QLabel('', box)
+        self.infoc = QLabel('Total of 0 genes match criteria', box)
         OWGUI.separator(self.controlArea)
 
         # gene selection
         self.selectionBox = QVGroupBox("Gene Selection", self.controlArea)
-        self.factors = [('First factor (time)', 'p1', 'filter1'),
-                   ('Second factor (strain)', 'p2', 'filter2'),
-                   ('Interaction factor (time*strain)', 'p3', 'filter3')]
+        self.factors = [('First factor (time)', 'p1', 'filter1', 'H0: The expression of a gene does not depend on\ntime through the course of development.', 'Time (P<%3.2f)'),
+                   ('Second factor (condition)', 'p2', 'filter2', 'H0: The expression of a gene does not depend on\nthe texperimental condition (mutation).', 'Cond (P<%3.2f)'),
+                   ('Interaction factor (time*condition)', 'p3', 'filter3', 'H0: The effect of experimental conditions on\nthe expression does not depend on time. ', 'Time x Cond (P<%3.2f)')]
         self.pvals = [0.0001, 0.001, 0.01, 0.05, 0.1, 0.2, 0.5]
 
         self.numgenes = []
         for i in range(3):
-            OWGUI.checkBox(self.selectionBox, self, self.factors[i][2], self.factors[i][0], callback=self.finalselection)
+            OWGUI.checkBox(self.selectionBox, self, self.factors[i][2], self.factors[i][0], callback=self.finalselection, tooltip=self.factors[i][3])
             hbox = QHBox(self.selectionBox)
             lbl = QLabel('', hbox)
             lbl.setFixedSize(20, lbl.sizeHint().height())
             lbl.setFixedSize(25, lbl.sizeHint().height())
             OWGUI.comboBox(hbox, self, self.factors[i][1], items = self.pvals, callback=lambda x=i: self.geneselection(x))
             self.numgenes.append(QLabel('  (0 genes)', hbox))
-        self.selectionLbl = QLabel('Total of 0 genes match criteria', self.selectionBox)
         self.selectionBox.setDisabled(1)
 
+        OWGUI.separator(self.selectionBox)
+        self.selectorNameLE = OWGUI.lineEdit(self.selectionBox, self, 'selectorName', label='Selector Name: ')
+        OWGUI.checkBox(self.selectionBox, self, 'updateSelectorName', 'Automatically update selector name')
+
         # output
         box = QVGroupBox("Output", self.controlArea)
         OWGUI.checkBox(box, self, 'commitOnChange', 'Commit data on selection change')
         self.commitBtn = OWGUI.button(box, self, "Commit", callback=self.senddata, disabled=1)
 
+##        OWGUI.button(self.controlArea, self, 'TEST', self.setSelectorName)        
+
         self.resize(200,100)
         
     def chipdata(self, data):
                 nfiles += len(d)
             self.infoa.setText("Microarray data, %d strains, total of %d data files" % (len(data), nfiles))
             d = data[0][1][0]
-            self.infob.setText("Each data file contains %d measurements of %d genes" % (len(d.domain.attributes), len(d)))
+            self.infob.setText("Each file contains %d measurements of %d genes" % (len(d.domain.attributes), len(d)))
 
             self.analysis()
         else:
             if getattr(self, self.factors[indx][2]) and self.selection[indx]:
                 self.match = map(lambda a,b: a or b, self.match, self.selection[indx])
         n = self.match.count(1)
-        self.selectionLbl.setText('Total of %d %s match criteria' % (n, ['genes', 'gene'][n==1]))
+        self.infoc.setText('Total of %d %s match criteria' % (n, ['genes', 'gene'][n==1]))
+        self.setSelectorName()
         if self.commitOnChange:
             self.senddata()
 
         pbStep = 90./len(self.data[0][1][0])
         self.ps, anova_results = chipstat.anova_on_genes(self.data, callback=lambda: self.progressBarAdvance(pbStep))
         self.send("Results of ANOVA", anova_results)
-        #print 'AAA', anova_results.classNames
         self.progressBarSet(90)
         self.selection = [None]*3
         for indx in range(3):
         self.progressBarFinished()
 
     def senddata(self):
-        self.send("Gene Selection", self.match)
+        self.send("Gene Selection", (self.selectorName, self.match))
         n = self.match.count(1)
         if n==len(self.data[0][1][0]): # all genes match
             self.send("Selected Data", self.data)
             self.send("Selected Data", None)
             self.send("Other Data", self.data)
         else:
-            print 'processing'
             P = []; N = []
             for (strainname, data) in self.data:
                 dataP = [d.select(self.match) for d in data]
             self.send("Selected Data", P)
             self.send("Other Data", N)
 
+    def setSelectorName(self):
+        if self.updateSelectorName:
+            s = 'ANOVA '
+            if len(self.data): s += reduce(lambda x,y:x+', '+y, [x[0] for x in self.data][:2]) + ['. ', '... '][len(self.data)>2]
+            ss = []
+            for indx in range(3):
+                if getattr(self, self.factors[indx][2]):
+                    ss.append(self.factors[indx][4] % self.pvals[getattr(self, self.factors[indx][1])])
+            if len(ss): s += reduce(lambda x,y:x+', '+y, ss)
+            self.selectorName = s
+
 if __name__=="__main__":
     a=QApplication(sys.argv)
     ow=OWChipANOVA()

OWChipDataFiles.py

         self.selectedDirName = "None"
         self.applyOnChange = 0
         self.loadSettings()
-        print 'ddd (1)', self.recentDirs
 
         # GUI
         # CONTROLS
 
         if self.recentDirs!=[]:
             self.loadData(self.recentDirs[0])
-        print 'ddd (2)', self.recentDirs
 
-        self.commitBtn = OWGUI.button(box, self, "Test", callback=self.test)
+##        self.commitBtn = OWGUI.button(box, self, "Test", callback=self.test)
             
-    def test(self):
-        print 'ddd (tst)', self.recentDirs
-        print 'ddd (tst) type', type(self.recentDirs), type(self.recentDirs[0])
-        
     def setFileTree(self):
         self.tree.clear()
         self.listitems = []
         self.dircombo.clear()
         if len(self.recentDirs):
             for dir in self.recentDirs:
-                print 'DDD', dir
                 (upperdir,dirname)=os.path.split(dir[:-1]) #:-1 removes the trailing '\'
-                print '---'
                 #leave out the path
                 self.dircombo.insertItem(dirname)
         else:
     def addDirToList(self, dir):
         # Add a directory to the start of the file list. 
         # If it exists, move it to the start of the list
-        print 'ddd (4)', self.recentDirs
         if dir in self.recentDirs:
             self.recentDirs.remove(dir)
         self.recentDirs.insert(0, str(dir))
         self.setDirlist()
-        print 'ddd (5)', self.recentDirs
         self.selectedDirName = dir
 
     # called when user makes a selection from the drop-down menu
     ow.show()
     a.exec_loop()
     ow.saveSettings()
-    print 'ddd', ow.recentDirs

OWChipPostHocANOVA.py

 import chipstat
 
 class OWChipPostHocANOVA(OWWidget):
-    settingsList  = ['commitOnChange', 'f1', 'f2', 'p1', 'p2', 'p3', 'filter1', 'filter2', 'filter3']
+    settingsList  = ['commitOnChange', 'f1', 'f2', 'p1', 'p2', 'p3', 'filter1', 'filter2', 'filter3', 'selectorName', 'updateSelectorName']
 
     def __init__(self, parent=None, name='ANOVA on Chip Data'):
         OWWidget.__init__(self, parent, name, "ANOVA on chip data (strains, replicas).")
         self.p1, self.p2, self.p3 = (2, 2, 2)
         self.filter1, self.filter2, self.filter3 = (1, 0, 0)
         self.f1 = None; self.f2 = None
+        self.selectorName = "PostHoc Test"; self.updateSelectorName = 1
         # Settings
         self.loadSettings()
         self.ps = None
         # info
         box = QVGroupBox("Info", self.controlArea)
         self.infoa = QLabel('No data on input.', box)
+        self.infob = QLabel('Total of 0 genes selected', box)
         OWGUI.separator(self.controlArea)
 
         # factors
             lbl.setFixedSize(25, lbl.sizeHint().height())
             OWGUI.comboBox(hbox, self, self.factors[i][1], items = self.pvals, callback=lambda x=i: self.geneselection(x))
             self.numgenes.append(QLabel('  (0 genes)', hbox))
-        self.selectionLbl = QLabel('Total of 0 genes selected', self.selectionBox)
         self.selectionBox.setDisabled(1)
 
+        OWGUI.separator(self.selectionBox)
+        self.selectorNameLE = OWGUI.lineEdit(self.selectionBox, self, 'selectorName', label='Selector Name: ')
+        OWGUI.checkBox(self.selectionBox, self, 'updateSelectorName', 'Automatically update selector name')
+
         # output
         box = QVGroupBox("Output", self.controlArea)
         OWGUI.checkBox(box, self, 'commitOnChange', 'Commit data on selection change')
                 self.match = map(lambda a,b: a or b, self.match, self.selection[indx])
         n = self.match.count(1)
         print self.match
-        self.selectionLbl.setText('Total of %d %s match criteria' % (n, ['genes', 'gene'][n==1]))
+        self.infob.setText('Total of %d %s match criteria' % (n, ['genes', 'gene'][n==1]))
         if self.commitOnChange or commit:
             self.senddata()
 
     def analysis(self, commit=0):
+        self.setSelectorName()
         self.progressBarInit()
         if not self.anova:
             return
         self.progressBarFinished()
 
     def senddata(self):
-        self.send("PostHoc Gene Selection", self.match)
+        self.send("PostHoc Gene Selection", (selectorName, self.match))
+
+    def setSelectorName(self):
+        if self.updateSelectorName:
+            s = 'PostHoc %s, %s' % (self.f1, self.f2)
+##            ss = []
+##            for indx in range(3):
+##                if getattr(self, self.factors[indx][2]):
+##                    ss.append(self.factors[indx][4] % self.pvals[getattr(self, self.factors[indx][1])])
+##            if len(ss): s += reduce(lambda x,y:x+', '+y, ss)
+            self.selectorName = s
 
 if __name__=="__main__":
     a=QApplication(sys.argv)
         self.SortGenes = 1
         self.SelectionType = 0         # selection on a single data set
         self.setColorPalette()
+        self.refFile = 0               # position index of a reference file
+        self.selectedFile = None       # position of the selected file in the list box
         
         self.loadSettings()
         self.data = []
         self.filesTab = QVGroupBox(self)
         box = QVButtonGroup("Data Files", self.filesTab)
         self.fileLB = QListBox(box, "lb")
-        self.connect(self.fileLB, SIGNAL("highlighted(int)"), self.fileSelectionChanged)    
+##        self.fileLB.setMaximumWidth(10)
+        self.connect(self.fileLB, SIGNAL("highlighted(int)"), self.fileSelectionChanged)
+        self.connect(self.fileLB, SIGNAL("selected(int)"), self.setFileReferenceBySelection)
         self.tabs.insertTab(self.filesTab, "Files")
         self.tabs.setTabEnabled(self.filesTab, 0)
-        dir = os.path.dirname(__file__) + "../icons/"
-        hbox = QHBox(box)
-        self.fileUp = self.createButton(hbox, self, 'File Up', icon = QPixmap(dir+'Dlg_send.png'), toggle = 0, callback=lambda i=-1: self.fileOrderChange(i))
-        self.fileRef = self.createButton(hbox, self, 'File Up', icon = QPixmap(dir+'Dlg_send.png'), toggle = 0, callback=lambda i=0: self.fileOrderChange(i))
-        self.fileDown = self.createButton(hbox, self, 'File Up', icon = QPixmap(dir+'Dlg_send.png'), toggle = 0, callback=lambda i=1: self.fileOrderChange(i))
+        hbox = QVBox(box)
+        self.fileUp = OWGUI.button(hbox, self, 'Up', callback=lambda i=-1: self.fileOrderChange(i), disabled=1)
+        self.fileRef = OWGUI.button(hbox, self, 'Reference', self.setFileReference, disabled=1)
+        self.fileDown = OWGUI.button(hbox, self, 'Down', callback=lambda i=1: self.fileOrderChange(i), disabled=1)
 
         OWGUI.checkBox(self.filesTab, self, 'ShowDataFileNames', 'Show data file names', callback=self.drawHeatMap)
         OWGUI.radioButtonsInBox(self.filesTab, self, 'SelectionType', ['Single data set', 'Multiple data sets'], box='Selection')
         # self.canvasView = QCanvasView(self.canvas, self.mainArea)
         self.layout.add(self.canvasView)
 
-    def createButton(self, widget, parent, text, callback=None, icon=None, toggle=0):
-        btn = QPushButton(text, widget)
-        btn.setToggleButton(toggle)
-        if callback: parent.connect(btn, SIGNAL("clicked()"), callback)
-        if icon:   btn.setPixmap(icon)
-        return btn
-
     def createColorStripe(self, palette):
         dx = 104; dy = 18
         bmp = chr(252)*dx*2 + reduce(lambda x,y:x+y, [chr(i*250/dx) for i in range(dx)] * (dy-4)) + chr(252)*dx*2 
     # handling of input/output signals
 
     def dataset(self, data, id):
-        dataIDs = [d.id for d in self.data]
+        ids = [d.id for d in self.data]
         if not data:
-            if id in dataIDs:
-                del self.data[dataIDs.index(id)]
+            if id in ids:
+                del self.data[ids.index(id)]
+                self.fileLB.removeItem(id)
         else:
             # check if the same length
             if data.domain.classVar:
                 if domain:
                     data = orange.ExampleTable(domain, data)
             data.setattr("id", id)
-            if len(self.data) and (id in dataIDs):
-                for i in range(len(self.data)):
-                    if id==self.data[i].id:
-                        self.data[i] = data
-                        self.fileLB.changeItem(data.name, i)
-                        break
+            if id in ids:
+                data.id = id
+                indx = ids.index(id)
+                self.data[indx] = data
+                self.fileLB.changeItem(self.createListItem(data.name, indx), indx)
             else:
+                self.fileLB.insertItem(self.createListItem(data.name, len(self.data)))
                 self.data.append(data)
-                self.fileLB.insertItem(data.name)
+#                self.fileLB.insertItem(data.name)
 
             if len(self.data) > 1:
                 self.tabs.setTabEnabled(self.filesTab, 1)
         self.canvas.update()
 
     def chipdata(self, data):
-        print 'CHIPDATA'
         self.data = [] # XXX should only remove the data from the same source, use id in this rutine
         if not data:
             for i in self.canvas.allItems():
         self.canvas.update()
         
     def constructHeatmap(self):
-        self.heatmapconstructor = []
         if len(self.data):
+            self.heatmapconstructor = [None] * len(self.data)
             if self.SortGenes:
-                self.heatmapconstructor.append(orange.HeatmapConstructor(self.data[0]))
+                self.heatmapconstructor[self.refFile] = orange.HeatmapConstructor(self.data[self.refFile])
             else:
-                self.heatmapconstructor.append(orange.HeatmapConstructor(self.data[0], None))
-            for i in range(len(self.data))[1:]:
-                self.heatmapconstructor.append(orange.HeatmapConstructor(self.data[i], self.heatmapconstructor[0]))
+                self.heatmapconstructor[self.refFile] = orange.HeatmapConstructor(self.data[self.refFile], None)
+            for i in range(len(self.data)):
+                if i <> self.refFile:
+                    self.heatmapconstructor[i] = orange.HeatmapConstructor(self.data[i], self.heatmapconstructor[self.refFile])
+        else:
+            self.heatmapconstructor = []
         self.createHeatMap()
 
     # remove unused values from the class of the data set
         self.createHeatMap()
         self.savedMerge = self.Merge
 
-    def fileSelectionChanged(self, sel):
-        # self.fileRef.setDisabled(sel==0)
-        self.selectedFile = sel
-        pass
-
     def fileOrderChange(self, chg):
         if chg==-1 and self.selectedFile>0:
             switchFiles(self.selectedFile, self.selectedFile-1)
             self.selection.remove()
         self.drawHeatMap()
 
+    ##########################################################################
+    # file list management
+
+    # rel = -1 for up, or 1 for down
+    def fileOrderChange(self, rel):
+        sel = self.selectedFile
+        data = self.data
+        data[sel], data[sel+rel] = (data[sel+rel], data[sel])
+        if sel == self.refFile:
+            self.refFile += rel
+        elif sel + rel == self.refFile:
+            self.refFile += -rel
+        # i got lazy here
+        self.fileLB.clear()
+        for i in range(len(data)):
+            self.fileLB.insertItem(self.createListItem(data[i].name, i))
+        self.fileLB.setSelected(sel + rel, 1)
+        self.constructHeatmap()
+
+    def setFileReferenceBySelection(self, sel):
+        self.fileSelectionChanged(sel)
+        self.setFileReference()
+        
+    def setFileReference(self):
+        sel = self.selectedFile
+        self.fileLB.changeItem(self.createListItem(self.data[self.refFile].name, -1), self.refFile)
+        self.refFile = sel
+        self.fileLB.changeItem(self.createListItem(self.data[sel].name, sel), sel)
+        self.constructHeatmap()
+##        self.canvas.update()
+
+    def fileSelectionChanged(self, sel):
+        print 'SEL', sel
+        # self.fileRef.setDisabled(sel==0)
+        self.selectedFile = sel
+        self.fileDown.setEnabled(sel < len(self.data)-1)
+        self.fileUp.setEnabled(sel>0)
+        self.fileRef.setEnabled(sel <> self.refFile)
+
+    def createListItem(self, text, position):
+        print 'MARK', position, self.refFile
+        pixmap = QPixmap()
+        pixmap.resize(14,13)
+        pixmap.fill(Qt.white)
+        
+        if position == self.refFile:
+            painter = QPainter()
+            painter.begin(pixmap)
+            painter.setPen(Qt.black)
+            painter.setBrush(Qt.black)
+            painter.drawRect(3, 3, 8, 8)
+            painter.end()
+            
+        listItem = QListBoxPixmap(pixmap)
+        listItem.setText(text)
+        return listItem
+##        return QListBoxText(text)
+
+
+##################################################################################################
 ##################################################################################################
 # color palette dialog
 
 
     ow.show()
 ##    d = orange.ExampleTable('wt'); d.name = 'wt'
-    d = orange.ExampleTable('wt-nometa'); d.name = 'wt'
-    ow.dataset(d, 2)
-    d = orange.ExampleTable('wt-nometa'); d.name = 'wt'
-    ow.dataset(d, 1)
-    ow.dataset(None, 1)
+##    d = orange.ExampleTable('wt-nometa'); d.name = 'wt'
+##    ow.dataset(d, 2)
+##    d = orange.ExampleTable('wt-nometa'); d.name = 'wt'
+##    ow.dataset(d, 1)
+##    ow.dataset(None, 1)
+##    ow.dataset(None, 2)
+
+    names = ['wt1', 'wt2', 'wt3', 'wt4']
+    for i, s in enumerate(names): 
+        d = orange.ExampleTable(s); d.name = s
+        ow.dataset(d, i)
     ow.dataset(None, 2)
-##    d = orange.ExampleTable('wt2'); d.name = 'wt2'
-##    ow.dataset(d, 1)
-##    d = orange.ExampleTable('wt3'); d.name = 'wt3'
-##    ow.dataset(d, 2)
+
     a.exec_loop()
     ow.saveSettings()

OWProcessChipData.py

 class OWProcessChipData(OWWidget):
     settingsList  = ["preStdMethod", "postStdMethod", "preStdRob", "postStdRob", "mergeType", "commitOnChange"]
 
-    def __init__(self, parent=None, name='Chip Data Files'):
+    def __init__(self, parent=None, name='Process Chip Data'):
         OWWidget.__init__(self, parent, name, "Process Chip Data pre- and post-processes chip data.")
         self.callbackDeposit = []
 
 """
 
 from OWWidget import *
+from qttable import *
 import OWGUI
 from OWChipDataFiles import ChipData
 from OWChipANOVA import GeneSelection
         self.callbackDeposit = []
 
         self.inputs = [("Gene Selection", GeneSelection, self.loadselection, 0), ("Structured Chip Data", ChipData, self.chipdata, 1)]
-        self.outputs = [("Selected Data", ChipData), ("Other Data", ChipData), ("Gene Selection", GeneSelection)]
+        self.outputs = [("Gene Selection", GeneSelection), ("Selected Data", ChipData), ("Other Data", ChipData)]
 
-        self.negate = 1
+        self.negate = 0
         self.selectors = {}
         self.data = None
         self.commitOnChange = 1
         self.infoa = QLabel('No data on input.', box)
         self.infob = QLabel('', box)
         OWGUI.separator(self.controlArea)
+        box.setMinimumWidth(170)
 
         # gene selection
-        box = QVGroupBox("Gene Selection", self.controlArea)
+        self.layout=QVBoxLayout(self.mainArea)
+        box = QVGroupBox("Gene Selection", self.mainArea)
+        self.table=QTable(box)
+        self.table.setSelectionMode(QTable.NoSelection)
+        self.layout.add(box)
+        self.table.hide()
+        self.drawtable()
+
         OWGUI.checkBox(box, self, 'negate', 'Negate', callback = self.selectionChange)
 
         # output
         box = QVGroupBox("Output", self.controlArea)
-        OWGUI.checkBox(box, self, 'commitOnChange', 'Commit data on selection change')
+        OWGUI.checkBox(box, self, 'commitOnChange', 'Commit data on change')
         self.commitBtn = OWGUI.button(box, self, "Commit", callback=self.senddata, disabled=1)
 
-        self.resize(200,100)
+        self.resize(700,100)
         
     def chipdata(self, data):
         if data:
             self.data = data
-##            nfiles = 0
-##            for (n, d) in data:
-##                nfiles += len(d)
-##            self.infoa.setText("Microarray data, %d strains, total of %d data files" % (len(data), nfiles))
-##            d = data[0][1][0]
-##            self.infob.setText("Each data file contains %d measurements of %d genes" % (len(d.domain.attributes), len(d)))
             self.senddata()
         else:
             self.send("Selected Data", None)
 
     def loadselection(self, selector, id):
         if selector:
-            self.selectors[id] = selector
+            self.selectors[id] = list(selector + (1,0))    # the last two items for use and negation
         else:
             del self.selectors[id]
-        print 'SELN',
-        for s in self.selectors.values():
-            print len(s),
-        print
-##        print self.selectors
-        self.infoa.setText('%d selectors on input' % len(self.selectors))
+        self.infoa.setText('%d selectors on input.' % len(self.selectors))
+        self.drawtable()
         self.senddata()
         self.commitBtn.setEnabled(self.selectors <> None and len(self.selectors))
 
+    def drawtable(self):
+        header = ['', 'Selector Name', 'Match #', 'Neg']
+        self.table.setNumCols(len(header))
+        self.header=self.table.horizontalHeader()
+        for i in range(len(header)):
+            self.header.setLabel(i, header[i])
+
+        self.table.setNumRows(len(self.selectors))
+        self.usesel_callback = [None] * len(self.selectors)
+        self.tmpWidgets = []
+        for (i, sel) in enumerate(self.selectors.values()):
+            for (pos, k) in [(0,2), (3,3)]:
+                cb = QCheckBox('', None)
+                cb.setChecked(sel[k])
+                self.usesel_callback[i] = lambda x, i=sel, k=k: self.usesel(x, i, k)
+                self.connect(cb, SIGNAL("toggled(bool)"), self.usesel_callback[i])
+                self.table.setCellWidget(i, pos, cb)
+                self.tmpWidgets.append(cb)
+            
+            self.table.setText(i, 1, sel[0])
+            self.table.setText(i, 2, '%d (%4.1f%s)' % (sel[1].count(1), 100.*sel[1].count(1)/len(sel[1]), '%') )
+        self.table.setLeftMargin(0)
+        self.table.verticalHeader().hide()
+
+        for i in range(len(header)):
+            self.table.adjustColumn(i)
+
+        self.table.show()
+
+    def usesel(self, x, sel, k):
+        sel[k] = int(x)
+        if self.commitOnChange:
+            self.senddata()
+
     def senddata(self):
         if len(self.selectors):
             self.progressBarInit()
             s = self.selectors.values()
-##            match = map(lambda *args: min(args), self.selectors.values())
-            # this needs to be changed!!!
-            match = []
-            n = len(s)
-            for i in range(len(s[0])):
-                mm = []
-                for j in range(n):
-                    mm.append(s[j][i])
-                match.append(min(mm))
-                
+
+            sel = []
+            for s in self.selectors.values():
+                if s[2]: # used?
+                    if s[3]: # negated?
+                        sel.append([not x for x in s[1]])
+                    else:
+                        sel.append(s[1])
+            if len(sel) == 0:
+                match = [0]*len(self.selectors.values()[0][1])
+            elif len(sel)>1:
+                match = apply(map, (max, ) + tuple(sel))
+            else:
+                match = sel[0]
             if self.negate:
-                match = [(1,0)[x] for x in match]
+                match = [not x for x in match]
+
+            nmatch = match.count(1)
+            self.infob.setText("%d genes (%4.1f%s) match criteria" % (nmatch, 100.*nmatch/len(self.selectors.values()[0][1]), '%'))
+
             self.match = match
             self.progressBarSet(20)
 
             self.progressBarFinished()
 
     def selectionChange(self):
-        pass
+        if self.commitOnChange:
+            self.senddata()
 
 if __name__=="__main__":
     a=QApplication(sys.argv)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.