def __init__(self, parent=None, signalManager = None, name='GSEA'): OWWidget.__init__(self, parent, signalManager, name) self.inputs = [("Examples", ExampleTable, self.setData)] self.outputs = [("Examples with selected genes only", ExampleTable), ("Results", ExampleTable), ("Distance Matrix", orange.SymMatrix) ] self.res = None self.dm = None self.name = 'GSEA' self.minSubsetSize = 3 self.minSubsetSizeC = True self.maxSubsetSize = 1000 self.maxSubsetSizeC = True self.minSubsetPart = 10 self.minSubsetPartC = True self.perms = 100 self.csgm = False self.gsgo = False self.gskegg = False self.buildDistances = False self.selectedPhenVar = 0 self.organismIndex = 0 self.atLeast = 3 self.permutationTypes = [("Phenotype", "p"),("Gene", "g") ] self.ptype = 0 self.correlationTypes = [ ("Signal2Noise", "s2n") ] self.ctype = 0 self.data = None self.geneSets = {} self.tabs = OWGUI.tabWidget(self.controlArea) ca = OWGUI.createTabPage(self.tabs, "Basic") box = OWGUI.widgetBox(ca, 'Organism') #FROM KEGG WIDGET - organism selection self.organismTaxids = [] self.organismComboBox = cb = OWGUI.comboBox(box, self, "organismIndex", items=[], debuggingEnabled=0) #changed cb.setMaximumWidth(200) #OWGUI.checkBox(box, self, "csgm", "Case sensitive gene matching") box2 = OWGUI.widgetBox(ca, "Descriptors") self.phenCombo = OWGUI.comboBox(box2, self, "selectedPhenVar", items=[], callback=self.phenComboChange, label="Phenotype:") self.geneCombo = OWGUI.comboBox(box2, self, "selectedGeneVar", items=[], label = "Gene:") self.allowComboChangeCallback = False ma = self.mainArea self.listView = QTreeWidget(ma) ma.layout().addWidget(self.listView) self.listView.setAllColumnsShowFocus(1) self.listView.setColumnCount(9) self.listView.setHeaderLabels(["Collection", "Geneset", "NES", "ES", "P-value", "FDR", "Size", "Matched Size", "Genes"]) self.listView.header().setStretchLastSection(True) self.listView.header().setClickable(True) self.listView.header().setSortIndicatorShown(True) self.listView.setSortingEnabled(True) #self.listView.header().setResizeMode(0, QHeaderView.Stretch) self.listView.setSelectionMode(QAbstractItemView.NoSelection) self.connect(self.listView, SIGNAL("itemSelectionChanged()"), self.newPathwaySelected) OWGUI.separator(ca) OWGUI.widgetLabel(ca, "Phenotype selection:") self.psel = PhenotypesSelection(ca) self.resize(600,50) OWGUI.separator(ca) OWGUI.checkBox(ca, self, "buildDistances", "Compute geneset distances") self.btnApply = OWGUI.button(ca, self, "&Compute", callback = self.compute, disabled=0) fileBox = OWGUI.widgetBox(ca, orientation='horizontal') OWGUI.button(fileBox, self, "Load", callback = self.loadData, disabled=0, debuggingEnabled=0) OWGUI.button(fileBox, self, "Save", callback = self.saveData, disabled=0, debuggingEnabled=0) #ca.layout().addStretch(1) ca = OWGUI.createTabPage(self.tabs, "Gene sets") box = OWGUI.widgetBox(ca) self.gridSel = [] self.geneSel = [] #FIXME temporary disabled - use the same as in new "David" widget self.lbgs = OWGUI.listBox(box, self, "gridSel", "geneSel", selectionMode = QListWidget.MultiSelection) OWGUI.button(box, self, "From &File", callback = self.addCollection, disabled=0, debuggingEnabled=0) box = OWGUI.widgetBox(box, "Additional sources:") OWGUI.checkBox(box, self, "gskegg", "KEGG pathways") OWGUI.checkBox(box, self, "gsgo", "GO terms") #ca.layout().addStretch(1) ca = OWGUI.createTabPage(self.tabs, "Settings") box = OWGUI.widgetBox(ca, 'Properties') self.permTypeF = OWGUI.comboBoxWithCaption(box, self, "ptype", items=nth(self.permutationTypes, 0), \ tooltip="Permutation type.", label="Permute") _ = OWGUI.spin(box, self, "perms", 50, 1000, orientation="horizontal", label="Times") self.corTypeF = OWGUI.comboBoxWithCaption(box, self, "ctype", items=nth(self.correlationTypes, 0), \ tooltip="Correlation type.", label="Correlation") box = OWGUI.widgetBox(ca, 'Subset Filtering') _,_ = OWGUI.checkWithSpin(box, self, "Min. Subset Size", 1, 10000, "minSubsetSizeC", "minSubsetSize", "") #TODO check sizes _,_ = OWGUI.checkWithSpin(box, self, "Max. Subset Size", 1, 10000, "maxSubsetSizeC", "maxSubsetSize", "") _,_ = OWGUI.checkWithSpin(box, self, "Min. Subset Part (%)", 1, 100, "minSubsetPartC", "minSubsetPart", "") box = OWGUI.widgetBox(ca, 'Gene Filtering') _ = OWGUI.spin(box, self, "atLeast", 2, 10, label="Min. Values in Group") ca.layout().addStretch(1) self.addComment("Computation was not started.") if sys.platform == "darwin": self.loadFileName = os.path.expanduser("~/") else: self.loadFileName = "." self.gridSels = [] self.loadSettings() self.setBlocking(True) QTimer.singleShot(0, self.UpdateOrganismComboBox) def cleanInvalid(maxn): """ Removes invalid gene set selection """ notAllOk = True while notAllOk: self.gridSels = getattr(self, "gridSels") notAllOk = False for i,a in enumerate(self.gridSels): if a >= maxn: self.gridSels.pop(i) notAllOk = True break cleanInvalid(len(self.geneSel)) self.gridSel = self.gridSels self.gridSels = self.gridSel