def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, 'ANOVA') # input / output data: [("name1", [orange.ExampleTable1a,...]), ("name2", [orange.ExampleTable2a,...])] self.inputs = [("Structured Data", DataFiles, self.onDataInput)] self.outputs = [("Example Selection", ExampleSelection, Default), ("Selected Structured Data", DataFiles, Default), ("Other Structured Data", DataFiles)] # data, p-values, selected examples self.dataStructure = None # input data self.numExamples = 0 self.numVariables = 0 self.ps = Numeric.ones((3,0), Numeric.Float) # p-values: 2D Numeric.array of shape (3, numExamples) self.selectorName = "" # for Example Selection output: (self.selectorName, [0,1,0,...]) # Settings self.anovaType = OWHypTest.StSST self.popMean = 0 # single sample t-test, value to compare to self.useFactors = [0,0,0] # [use factor A, use factor B, use interaction] self._interaction = 0 # to store last setting: 0: no interaction, 1: test for interaction effect (set this value manually !!!) self.selectorA = True self.selectorB = False self.selectorI = False self.alphaA = "0.05" self.alphaB = "0.05" self.alphaI = "0.05" self.autoUpdateSelName = 1 self.sendNotSelectedData = 1 self.sendProbabilities = 0 self.commitOnChange = 0 self.loadSettings() # GUI self.mainArea.setFixedWidth(0) ca=QFrame(self.controlArea) gl=QGridLayout(ca,4,1,5) # info box = QVGroupBox("Info", ca) gl.addWidget(box,0,0) self.infoa = QLabel('No data on input.', box) self.infob = QLabel('', box) self.infoc = QLabel('', box) # ANOVA type self.boxAnovaType = QVButtonGroup("Statistics", ca) gl.addWidget(self.boxAnovaType,1,0) self.boxAnovaType.setDisabled(1) self.boxAnovaType.setRadioButtonExclusive(1) self.boxAnovaType.buttons = [] ## for i,lbl in enumerate(OWHypTest.StNames): ## w = QRadioButton(lbl, self.boxAnovaType) ## w.setOn(self.anovaType == i) ## self.boxAnovaType.buttons.append(w) ## if i == OWHypTest.StSST: ## self.boxPopMean = QHBox(self.boxAnovaType) ## QLabel(" population mean ", self.boxPopMean) ## OWGUI.lineEdit(self.boxPopMean, self, "popMean", callback=self.onPopMeanChange) for i,lbl in enumerate(OWHypTest.StNames): w = QRadioButton(lbl, self.boxAnovaType) w.setOn(self.anovaType == i) self.boxAnovaType.buttons.append(w) if i == OWHypTest.StSST: self.boxPopMean = QHBox(self.boxAnovaType) QLabel(" population mean ", self.boxPopMean) OWGUI.lineEdit(self.boxPopMean, self, "popMean", callback=self.onPopMeanChange) OWGUI.connectControl(self.boxAnovaType, self, "anovaType", self.onAnovaType, "clicked(int)", OWGUI.CallFront_radioButtons(self.boxAnovaType)) # selection of examples self.boxSelection = QVGroupBox("Example Selection", ca) gl.addWidget(self.boxSelection,2,0) self.lblNumGenes = [] # list of labels # selector A self.boxSelectorA = QVBox(self.boxSelection) self.cbSelectorA = OWGUI.checkBox(self.boxSelectorA, self, "selectorA", "Factor A (variables)", callback=self.onSelectionChange, tooltip='H0: The mean does not depend on factor A (represented by variables).') frmA = QFrame(self.boxSelectorA) glA = QGridLayout(frmA,1,3,5) leA = OWGUI.lineEdit(frmA, self, "alphaA", orientation="horizontal", controlWidth=None, callback=lambda x=0: self.onAlphaChange(x)) glA.addWidget(leA,0,1) # Qt.AlignRight glA.addWidget(QLabel(" p <= ", frmA), 0,0) self.lblNumGenes.append(QLabel('', frmA)) glA.addWidget(self.lblNumGenes[-1],0,2) # Qt.AlignRight | 0x22 # selector B self.boxSelectorB = QVBox(self.boxSelection) self.cbSelectorB = OWGUI.checkBox(self.boxSelectorB, self, "selectorB", "Factor B (data sets)", callback=self.onSelectionChange, tooltip='H0: The mean does not depend on factor B (represented by data sets).') frmB = QFrame(self.boxSelectorB) glB = QGridLayout(frmB,1,3,5) leB = OWGUI.lineEdit(frmB, self, "alphaB", orientation="horizontal", callback=lambda x=1: self.onAlphaChange(x)) glB.addWidget(leB,0,1) glB.addWidget(QLabel(" p <= ", frmB), 0,0) self.lblNumGenes.append(QLabel('', frmB)) glB.addWidget(self.lblNumGenes[-1],0,2) # selector I self.boxSelectorI = QVBox(self.boxSelection) self.cbSelectorI = OWGUI.checkBox(self.boxSelectorI, self, "selectorI", "Interaction (variables * data sets)", callback=self.onSelectionChange, tooltip='H0: There is no interaction between factor A and factor B.') frmI = QFrame(self.boxSelectorI) glI = QGridLayout(frmI,1,3,5) leI = OWGUI.lineEdit(frmI, self, "alphaI", orientation="horizontal", callback=lambda x=2: self.onAlphaChange(x)) ## slider could be used to replace lineEdit (but not sensitive enough) ## self.alphaIf = 0.05 ## leI = OWGUI.qwtHSlider(self.boxSelectorI, self, "alphaIf", box="", label=" p < ", labelWidth=None, minValue=0.0001, maxValue=1.0, step=0.1, precision=3, callback=lambda x=2: self.onAlphaChange(x), logarithmic=1, ticks=0, maxWidth=None) glI.addWidget(leI,0,1) glI.addWidget(QLabel(" p <= ", frmI), 0,0) self.lblNumGenes.append(QLabel('', frmI)) glI.addWidget(self.lblNumGenes[-1],0,2) # output box = QVGroupBox("Output", ca) gl.addWidget(box,3,0) self.leSelectorName = OWGUI.lineEdit(box, self, 'selectorName', label='Selector Name: ') self.leSelectorName.setReadOnly(self.autoUpdateSelName) OWGUI.checkBox(box, self, 'autoUpdateSelName', 'Automatically update selector name', callback=self.onAutoUpdateSelNameChange) OWGUI.checkBox(box, self, 'sendNotSelectedData', 'Send not selected data', callback=self.onSendNotSelectedChange) OWGUI.checkBox(box, self, 'sendProbabilities', 'Show p-values', callback=self.onSendProbabilitiesChange) OWGUI.checkBox(box, self, 'commitOnChange', 'Commit data on selection change', callback=lambda: self.onCommit(self.commitOnChange)) self.btnCommit = OWGUI.button(box, self, "Commit", callback=self.onCommit) # enable/disable anova type box, example selection box, commit button, update the number of examples for individual selectors self.updateAnovaTypeBox() self.updateSelectorBox() self.updateSelectorInfos() self.updateSelectorName() self.resize(283, self.sizeHint().height())