示例#1
0
    def __init__(self, parent=None, signalManager=None, name="dictyExpress"):
        OWWidget.__init__(self, parent, signalManager, name)
        self.outputs = [("Example table", ExampleTable)]
        self.serverToken = ""
        self.server = obiDicty.defaddress

        self.platform = None

        self.selectedExperiments = []
        self.buffer = obiDicty.CacheSQLite(bufferfile)

        self.searchString = ""
        self.excludeconstant = False

        box = OWGUI.widgetBox(self.controlArea, "Cache")
        OWGUI.button(box, self, "Clear cache", callback=self.clear_buffer)

        OWGUI.checkBox(self.controlArea, self, "excludeconstant",
                       "Exclude labels with constant values")

        OWGUI.button(self.controlArea, self, "&Commit", callback=self.Commit)
        box = OWGUI.widgetBox(self.controlArea, "Server")
        OWGUI.lineEdit(box,
                       self,
                       "serverToken",
                       "Token",
                       callback=self.Connect)
        OWGUI.rubber(self.controlArea)

        OWGUI.lineEdit(self.mainArea,
                       self,
                       "searchString",
                       "Search",
                       callbackOnType=True,
                       callback=self.SearchUpdate)
        self.experimentsWidget = QTreeWidget()
        self.experimentsWidget.setHeaderLabels([
            "Strain", "Treatment", "Growth condition", "Platform", "N", "Chips"
        ])
        self.experimentsWidget.setSelectionMode(QTreeWidget.ExtendedSelection)
        self.experimentsWidget.setRootIsDecorated(False)
        self.experimentsWidget.setSortingEnabled(True)
        ##        self.experimentsWidget.setAlternatingRowColors(True)

        self.mainArea.layout().addWidget(self.experimentsWidget)

        self.loadSettings()
        self.dbc = None

        QTimer.singleShot(0, self.UpdateExperiments)

        self.resize(800, 600)
示例#2
0
    def __init__(self, parent=None, signalManager=None, name="dictyExpress"):
        OWWidget.__init__(self, parent, signalManager, name)
        self.outputs = [("Example table", ExampleTable)]
        self.serverToken = ""
        self.server = obiDicty.defaddress

        self.platform = None

        self.selectedExperiments = []
        self.buffer = obiDicty.CacheSQLite(bufferfile)

        self.searchString = ""
        self.excludeconstant = False
        
        box = OWGUI.widgetBox(self.controlArea, "Cache")
        OWGUI.button(box, self, "Clear cache", callback=self.clear_buffer)

        OWGUI.checkBox(self.controlArea, self, "excludeconstant", "Exclude labels with constant values" )

        OWGUI.button(self.controlArea, self, "&Commit", callback=self.Commit)
        box  = OWGUI.widgetBox(self.controlArea, "Server")
        OWGUI.lineEdit(box, self, "serverToken","Token", callback=self.Connect)
        OWGUI.rubber(self.controlArea)

        OWGUI.lineEdit(self.mainArea, self, "searchString", "Search", callbackOnType=True, callback=self.SearchUpdate)
        self.experimentsWidget = QTreeWidget()
        self.experimentsWidget.setHeaderLabels(["Strain", "Treatment", "Growth condition", "Platform", "N", "Chips"]) 
        self.experimentsWidget.setSelectionMode(QTreeWidget.ExtendedSelection)
        self.experimentsWidget.setRootIsDecorated(False)
        self.experimentsWidget.setSortingEnabled(True)
##        self.experimentsWidget.setAlternatingRowColors(True)

        self.mainArea.layout().addWidget(self.experimentsWidget)

        self.loadSettings()
        self.dbc = None        

        QTimer.singleShot(0, self.UpdateExperiments)        

        self.resize(800, 600)
示例#3
0
    def __init__(self, parent=None, signalManager=None, name=" GEO Data Sets"):
        OWWidget.__init__(self, parent, signalManager, name)

        self.selectionChanged = False
        self.filterString = ""
        self.datasetName = ""

        ## GUI
        box = gui.widgetBox(self.controlArea, "Info", addSpace=True)
        self.infoBox = gui.widgetLabel(box, "Initializing\n\n")

        box = gui.widgetBox(self.controlArea, "Output", addSpace=True)
        gui.radioButtonsInBox(box,
                              self,
                              "outputRows",
                              ["Genes in rows", "Samples in rows"],
                              "Rows",
                              callback=self.commitIf)

        gui.checkBox(box,
                     self,
                     "mergeSpots",
                     "Merge spots of same gene",
                     callback=self.commitIf)

        gui.separator(box)
        self.nameEdit = gui.lineEdit(
            box,
            self,
            "datasetName",
            "Data set name",
            tooltip="Override the default output data set name",
            callback=self.onNameEdited)
        self.nameEdit.setPlaceholderText("")

        if sys.version_info < (3, ):
            box = gui.widgetBox(self.controlArea, "Commit", addSpace=True)
            self.commitButton = gui.button(box,
                                           self,
                                           "Commit",
                                           callback=self.commit)
            cb = gui.checkBox(box, self, "autoCommit", "Commit on any change")
            gui.setStopper(self, self.commitButton, cb, "selectionChanged",
                           self.commit)
        else:
            gui.auto_commit(self.controlArea,
                            self,
                            "autoCommit",
                            "Commit",
                            box="Commit")
            self.commitIf = self.commit

        gui.rubber(self.controlArea)

        gui.widgetLabel(self.mainArea, "Filter")
        self.filterLineEdit = QLineEdit(textChanged=self.filter)
        self.completer = TokenListCompleter(self,
                                            caseSensitivity=Qt.CaseInsensitive)
        self.filterLineEdit.setCompleter(self.completer)

        self.mainArea.layout().addWidget(self.filterLineEdit)

        splitter = QSplitter(Qt.Vertical, self.mainArea)
        self.mainArea.layout().addWidget(splitter)
        self.treeWidget = QTreeView(splitter)

        self.treeWidget.setSelectionMode(QTreeView.SingleSelection)
        self.treeWidget.setRootIsDecorated(False)
        self.treeWidget.setSortingEnabled(True)
        self.treeWidget.setAlternatingRowColors(True)
        self.treeWidget.setUniformRowHeights(True)
        self.treeWidget.setEditTriggers(QTreeView.NoEditTriggers)

        linkdelegate = LinkStyledItemDelegate(self.treeWidget)
        self.treeWidget.setItemDelegateForColumn(1, linkdelegate)
        self.treeWidget.setItemDelegateForColumn(8, linkdelegate)
        self.treeWidget.setItemDelegateForColumn(
            0, gui.IndicatorItemDelegate(self.treeWidget, role=Qt.DisplayRole))

        proxyModel = MySortFilterProxyModel(self.treeWidget)
        self.treeWidget.setModel(proxyModel)
        self.treeWidget.selectionModel().selectionChanged.connect(
            self.updateSelection)
        self.treeWidget.viewport().setMouseTracking(True)

        splitterH = QSplitter(Qt.Horizontal, splitter)

        box = gui.widgetBox(splitterH, "Description")
        self.infoGDS = gui.widgetLabel(box, "")
        self.infoGDS.setWordWrap(True)
        gui.rubber(box)

        box = gui.widgetBox(splitterH, "Sample Annotations")
        self.annotationsTree = QTreeWidget(box)
        self.annotationsTree.setHeaderLabels(
            ["Type (Sample annotations)", "Sample count"])
        self.annotationsTree.setRootIsDecorated(True)
        box.layout().addWidget(self.annotationsTree)
        self.annotationsTree.itemChanged.connect(
            self.annotationSelectionChanged)
        self._annotationsUpdating = False
        self.splitters = splitter, splitterH

        for sp, setting in zip(self.splitters, self.splitterSettings):
            sp.splitterMoved.connect(self.splitterMoved)
            sp.restoreState(setting)

        self.searchKeys = [
            "dataset_id", "title", "platform_organism", "description"
        ]

        self.gds = []
        self.gds_info = None

        self.resize(1000, 600)

        self.setBlocking(True)
        self.setEnabled(False)
        self.progressBarInit()

        self._executor = ThreadExecutor()

        func = partial(get_gds_model,
                       methodinvoke(self, "_setProgress", (float, )))
        self._inittask = Task(function=func)
        self._inittask.finished.connect(self._initializemodel)
        self._executor.submit(self._inittask)

        self._datatask = None
示例#4
0
    def __init__(self, parent=None, signalManager=None, name=" GEO Data Sets"):
        OWWidget.__init__(self, parent, signalManager, name)

        self.outputs = [("Expression Data", ExampleTable)]

        ## Settings
        self.selectedAnnotation = 0
        self.includeIf = False
        self.minSamples = 3
        self.autoCommit = False
        self.outputRows = 0
        self.mergeSpots = True
        self.filterString = ""
        self.currentGds = None
        self.selectionChanged = False
        self.autoCommit = False
        self.gdsSelectionStates = {}
        self.splitterSettings = [
            '\x00\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x01\xea\x00\x00\x00\xd7\x01\x00\x00\x00\x07\x01\x00\x00\x00\x02',
            '\x00\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x01\xb5\x00\x00\x02\x10\x01\x00\x00\x00\x07\x01\x00\x00\x00\x01'
        ]
        self.datasetNames = {}
        self.loadSettings()

        self.datasetName = ""

        ## GUI
        self.infoBox = OWGUI.widgetLabel(
            OWGUI.widgetBox(self.controlArea, "Info", addSpace=True),
            "Initializing\n\n"
        )

        box = OWGUI.widgetBox(self.controlArea, "Output", addSpace=True)
        OWGUI.radioButtonsInBox(box, self, "outputRows",
                                ["Genes or spots", "Samples"], "Rows",
                                callback=self.commitIf)
        OWGUI.checkBox(box, self, "mergeSpots", "Merge spots of same gene",
                       callback=self.commitIf)

        OWGUI.separator(box)
        self.nameEdit = OWGUI.lineEdit(
            box, self, "datasetName", "Data set name",
            tooltip="Override the default output data set name",
            callback=self.onNameEdited
        )
        self.nameEdit.setPlaceholderText("")

        box = OWGUI.widgetBox(self.controlArea, "Commit", addSpace=True)
        self.commitButton = OWGUI.button(box, self, "Commit",
                                         callback=self.commit)
        cb = OWGUI.checkBox(box, self, "autoCommit", "Commit on any change")
        OWGUI.setStopper(self, self.commitButton, cb, "selectionChanged",
                         self.commit)
        OWGUI.rubber(self.controlArea)

        self.filterLineEdit = OWGUIEx.lineEditHint(
            self.mainArea, self, "filterString", "Filter",
            caseSensitive=False, matchAnywhere=True,
            callback=self.filter,  delimiters=" ")

        splitter = QSplitter(Qt.Vertical, self.mainArea)
        self.mainArea.layout().addWidget(splitter)
        self.treeWidget = QTreeView(splitter)

        self.treeWidget.setSelectionMode(QAbstractItemView.SingleSelection)
        self.treeWidget.setRootIsDecorated(False)
        self.treeWidget.setSortingEnabled(True)
        self.treeWidget.setAlternatingRowColors(True)
        self.treeWidget.setUniformRowHeights(True)
        self.treeWidget.setEditTriggers(QTreeView.NoEditTriggers)

        linkdelegate = LinkStyledItemDelegate(self.treeWidget)
        self.treeWidget.setItemDelegateForColumn(1, linkdelegate)
        self.treeWidget.setItemDelegateForColumn(8, linkdelegate)
        self.treeWidget.setItemDelegateForColumn(
            0, OWGUI.IndicatorItemDelegate(self.treeWidget,
                                           role=Qt.DisplayRole))

        proxyModel = MySortFilterProxyModel(self.treeWidget)
        self.treeWidget.setModel(proxyModel)
        self.treeWidget.selectionModel().selectionChanged.connect(
            self.updateSelection
        )
        self.treeWidget.viewport().setMouseTracking(True)

        splitterH = QSplitter(Qt.Horizontal, splitter)

        box = OWGUI.widgetBox(splitterH, "Description")
        self.infoGDS = OWGUI.widgetLabel(box, "")
        self.infoGDS.setWordWrap(True)
        OWGUI.rubber(box)

        box = OWGUI.widgetBox(splitterH, "Sample Annotations")
        self.annotationsTree = QTreeWidget(box)
        self.annotationsTree.setHeaderLabels(
            ["Type (Sample annotations)", "Sample count"]
        )
        self.annotationsTree.setRootIsDecorated(True)
        box.layout().addWidget(self.annotationsTree)
        self.annotationsTree.itemChanged.connect(
            self.annotationSelectionChanged
        )
        self._annotationsUpdating = False
        self.splitters = splitter, splitterH

        for sp, setting in zip(self.splitters, self.splitterSettings):
            sp.splitterMoved.connect(self.splitterMoved)
            sp.restoreState(setting)

        self.searchKeys = ["dataset_id", "title", "platform_organism",
                           "description"]

        self.gds = []
        self.gds_info = None

        self.resize(1000, 600)

        self.setBlocking(True)
        self.setEnabled(False)
        self.progressBarInit()

        self._executor = ThreadExecutor()

        func = partial(get_gds_model,
                       methodinvoke(self, "_setProgress", (float,)))
        self._inittask = Task(function=func)
        self._inittask.finished.connect(self._initializemodel)
        self._executor.submit(self._inittask)

        self._datatask = None
示例#5
0
    def __init__(self, parent=None, signalManager=None,
                 name="Databases update", domains=None):
        OWWidget.__init__(self, parent, signalManager, name,
                          wantMainArea=False)

        self.searchString = ""
        self.accessCode = ""
        self.domains = domains or DOMAINS
        self.serverFiles = serverfiles.ServerFiles()

        fbox = gui.widgetBox(self.controlArea, "Filter")
        self.completer = TokenListCompleter(
            self, caseSensitivity=Qt.CaseInsensitive)
        self.lineEditFilter = QLineEdit(textChanged=self.SearchUpdate)
        self.lineEditFilter.setCompleter(self.completer)

        fbox.layout().addWidget(self.lineEditFilter)

        box = gui.widgetBox(self.controlArea, "Files")

        self.filesView = QTreeWidget(self)
        self.filesView.setHeaderLabels(
            ["", "Data Source", "Update", "Last Updated", "Size"])

        self.filesView.setRootIsDecorated(False)
        self.filesView.setUniformRowHeights(True)
        self.filesView.setSelectionMode(QAbstractItemView.NoSelection)
        self.filesView.setSortingEnabled(True)
        self.filesView.sortItems(1, Qt.AscendingOrder)
        self.filesView.setItemDelegateForColumn(
            0, UpdateOptionsItemDelegate(self.filesView))

        self.filesView.model().layoutChanged.connect(self.SearchUpdate)

        box.layout().addWidget(self.filesView)

        box = gui.widgetBox(self.controlArea, orientation="horizontal")
        self.updateButton = gui.button(
            box, self, "Update all",
            callback=self.UpdateAll,
            tooltip="Update all updatable files",
         )

        self.downloadButton = gui.button(
            box, self, "Download all",
            callback=self.DownloadFiltered,
            tooltip="Download all filtered files shown"
        )

        self.cancelButton = gui.button(
            box, self, "Cancel", callback=self.Cancel,
            tooltip="Cancel scheduled downloads/updates."
        )

        self.retryButton = gui.button(
            box, self, "Reconnect", callback=self.RetrieveFilesList
        )
        self.retryButton.hide()

        gui.rubber(box)

        gui.lineEdit(box, self, "accessCode", "Access Code",
                     orientation="horizontal",
                     callback=self.RetrieveFilesList)

        self.warning(0)

        box = gui.widgetBox(self.controlArea, orientation="horizontal")
        gui.rubber(box)

        self.infoLabel = QLabel()
        self.infoLabel.setAlignment(Qt.AlignCenter)

        self.controlArea.layout().addWidget(self.infoLabel)
        self.infoLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)

        self.updateItems = []

        self.resize(800, 600)

        self.progress = ProgressState(self, maximum=3)
        self.progress.valueChanged.connect(self._updateProgress)
        self.progress.rangeChanged.connect(self._updateProgress)
        self.executor = ThreadExecutor(
            threadPool=QThreadPool(maxThreadCount=2)
        )

        task = Task(self, function=self.RetrieveFilesList)
        task.exceptionReady.connect(self.HandleError)
        task.start()

        self._tasks = []
        self._haveProgress = False
示例#6
0
    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())
示例#7
0
    def __init__(self, parent=None, signalManager=None, name=" GEO Data Sets"):
        OWWidget.__init__(self, parent, signalManager, name)

        self.selectionChanged = False
        self.filterString = ""
        self.datasetName = ""

        ## GUI
        box = gui.widgetBox(self.controlArea, "Info", addSpace=True)
        self.infoBox = gui.widgetLabel(box, "Initializing\n\n")

        box = gui.widgetBox(self.controlArea, "Output", addSpace=True)
        gui.radioButtonsInBox(box, self, "outputRows",
                              ["Genes in rows", "Samples in rows"], "Rows",
                              callback=self.commitIf)

        gui.checkBox(box, self, "mergeSpots", "Merge spots of same gene",
                     callback=self.commitIf)

        gui.separator(box)
        self.nameEdit = gui.lineEdit(
            box, self, "datasetName", "Data set name",
            tooltip="Override the default output data set name",
            callback=self.onNameEdited
        )
        self.nameEdit.setPlaceholderText("")

        if sys.version_info < (3, ):
            box = gui.widgetBox(self.controlArea, "Commit", addSpace=True)
            self.commitButton = gui.button(
                box, self, "Commit", callback=self.commit)
            cb = gui.checkBox(box, self, "autoCommit", "Commit on any change")
            gui.setStopper(self, self.commitButton, cb, "selectionChanged",
                           self.commit)
        else:
            gui.auto_commit(self.controlArea, self, "autoCommit", "Commit",
                            box="Commit")
            self.commitIf = self.commit

        gui.rubber(self.controlArea)

        gui.widgetLabel(self.mainArea, "Filter")
        self.filterLineEdit = QLineEdit(
            textChanged=self.filter
        )
        self.completer = TokenListCompleter(
            self, caseSensitivity=Qt.CaseInsensitive
        )
        self.filterLineEdit.setCompleter(self.completer)

        self.mainArea.layout().addWidget(self.filterLineEdit)

        splitter = QSplitter(Qt.Vertical, self.mainArea)
        self.mainArea.layout().addWidget(splitter)
        self.treeWidget = QTreeView(splitter)

        self.treeWidget.setSelectionMode(QTreeView.SingleSelection)
        self.treeWidget.setRootIsDecorated(False)
        self.treeWidget.setSortingEnabled(True)
        self.treeWidget.setAlternatingRowColors(True)
        self.treeWidget.setUniformRowHeights(True)
        self.treeWidget.setEditTriggers(QTreeView.NoEditTriggers)

        linkdelegate = LinkStyledItemDelegate(self.treeWidget)
        self.treeWidget.setItemDelegateForColumn(1, linkdelegate)
        self.treeWidget.setItemDelegateForColumn(8, linkdelegate)
        self.treeWidget.setItemDelegateForColumn(
            0, gui.IndicatorItemDelegate(self.treeWidget,
                                         role=Qt.DisplayRole))

        proxyModel = MySortFilterProxyModel(self.treeWidget)
        self.treeWidget.setModel(proxyModel)
        self.treeWidget.selectionModel().selectionChanged.connect(
            self.updateSelection
        )
        self.treeWidget.viewport().setMouseTracking(True)

        splitterH = QSplitter(Qt.Horizontal, splitter)

        box = gui.widgetBox(splitterH, "Description")
        self.infoGDS = gui.widgetLabel(box, "")
        self.infoGDS.setWordWrap(True)
        gui.rubber(box)

        box = gui.widgetBox(splitterH, "Sample Annotations")
        self.annotationsTree = QTreeWidget(box)
        self.annotationsTree.setHeaderLabels(
            ["Type (Sample annotations)", "Sample count"]
        )
        self.annotationsTree.setRootIsDecorated(True)
        box.layout().addWidget(self.annotationsTree)
        self.annotationsTree.itemChanged.connect(
            self.annotationSelectionChanged
        )
        self._annotationsUpdating = False
        self.splitters = splitter, splitterH

        for sp, setting in zip(self.splitters, self.splitterSettings):
            sp.splitterMoved.connect(self.splitterMoved)
            sp.restoreState(setting)

        self.searchKeys = ["dataset_id", "title", "platform_organism",
                           "description"]

        self.gds = []
        self.gds_info = None

        self.resize(1000, 600)

        self.setBlocking(True)
        self.setEnabled(False)
        self.progressBarInit()

        self._executor = ThreadExecutor()

        func = partial(get_gds_model,
                       methodinvoke(self, "_setProgress", (float,)))
        self._inittask = Task(function=func)
        self._inittask.finished.connect(self._initializemodel)
        self._executor.submit(self._inittask)

        self._datatask = None
    def __init__(self, parent=None, signalManager=None,
                 name="Databases update", domains=None):
        OWWidget.__init__(self, parent, signalManager, name,
                          wantMainArea=False)

        self.searchString = ""
        self.accessCode = ""
        self.domains = domains or DOMAINS
        self.serverFiles = serverfiles.ServerFiles()

        self.__in_progress_update = False

        fbox = gui.widgetBox(self.controlArea, "Filter")

        # The completer model token strings
        self.completertokens = []
        # A 'dynamic' completer item model will be updated with
        # 'prefix {token}' where prefix is current 'active' filter list
        # (the QCompleter only completes on one item in the model)
        self.completermodel = QStringListModel(self)
        self.completer = QCompleter(
            self.completermodel, self,
            caseSensitivity=Qt.CaseInsensitive
        )

        self.lineEditFilter = QLineEdit(textChanged=self.SearchUpdate)

        self.lineEditFilter.setCompleter(self.completer)

        fbox.layout().addWidget(self.lineEditFilter)

        box = gui.widgetBox(self.controlArea, "Files")

        self.filesView = QTreeWidget(self)
        self.filesView.setHeaderLabels(
            ["", "Data Source", "Update", "Last Updated", "Size"])

        self.filesView.setRootIsDecorated(False)
        self.filesView.setUniformRowHeights(True)
        self.filesView.setSelectionMode(QAbstractItemView.NoSelection)
        self.filesView.setSortingEnabled(True)
        self.filesView.sortItems(1, Qt.AscendingOrder)
        self.filesView.setItemDelegateForColumn(
            0, UpdateOptionsItemDelegate(self.filesView))

        self.filesView.model().layoutChanged.connect(self.SearchUpdate)

        box.layout().addWidget(self.filesView)

        box = gui.widgetBox(self.controlArea, orientation="horizontal")
        self.updateButton = gui.button(
            box, self, "Update all",
            callback=self.UpdateAll,
            tooltip="Update all updatable files",
         )

        self.downloadButton = gui.button(
            box, self, "Download all",
            callback=self.DownloadFiltered,
            tooltip="Download all filtered files shown"
        )

        self.cancelButton = gui.button(
            box, self, "Cancel", callback=self.Cancel,
            tooltip="Cancel scheduled downloads/updates."
        )
        gui.rubber(box)

        gui.lineEdit(box, self, "accessCode", "Access Code",
                     orientation="horizontal",
                     callback=self.RetrieveFilesList)

        self.retryButton = gui.button(
            box, self, "Retry", callback=self.RetrieveFilesList
        )
        self.retryButton.hide()

        box = gui.widgetBox(self.controlArea, orientation="horizontal")
        gui.rubber(box)

        self.infoLabel = QLabel()
        self.infoLabel.setAlignment(Qt.AlignCenter)

        self.controlArea.layout().addWidget(self.infoLabel)
        self.infoLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)

        self.updateItems = []

        self.resize(800, 600)

        self.progress = ProgressState(self, maximum=3)
        self.progress.valueChanged.connect(self._updateProgress)
        self.progress.rangeChanged.connect(self._updateProgress)
        self.executor = ThreadExecutor(
            threadPool=QThreadPool(maxThreadCount=2)
        )

        task = Task(self, function=self.RetrieveFilesList)
        task.exceptionReady.connect(self.HandleError)
        task.start()

        self._tasks = []
        self._haveProgress = False
示例#9
0
    def __init__(self, parent=None, signalManager=None, name=" GEO Data Sets"):
        OWWidget.__init__(self, parent, signalManager, name)

        self.outputs = [("Expression Data", ExampleTable)]

        ## Settings
        self.selectedAnnotation = 0
        self.includeIf = False
        self.minSamples = 3
        self.autoCommit = False
        self.outputRows = 1
        self.mergeSpots = True
        self.filterString = ""
        self.currentGds = None
        self.selectionChanged = False
        self.autoCommit = False
        self.gdsSelectionStates = {}
        self.splitterSettings = [
            '\x00\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x01\xea\x00\x00\x00\xd7\x01\x00\x00\x00\x07\x01\x00\x00\x00\x02',
            '\x00\x00\x00\xff\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x01\xb5\x00\x00\x02\x10\x01\x00\x00\x00\x07\x01\x00\x00\x00\x01'
        ]
        self.datasetNames = {}
        self.loadSettings()

        self.datasetName = ""

        ## GUI
        self.infoBox = OWGUI.widgetLabel(
            OWGUI.widgetBox(self.controlArea, "Info", addSpace=True),
            "Initializing\n\n"
        )

        box = OWGUI.widgetBox(self.controlArea, "Output", addSpace=True)
        OWGUI.radioButtonsInBox(box, self, "outputRows",
                                ["Genes in rows", "Samples in rows"], "Rows",
                                callback=self.commitIf)
        OWGUI.checkBox(box, self, "mergeSpots", "Merge spots of same gene",
                       callback=self.commitIf)

        OWGUI.separator(box)
        self.nameEdit = OWGUI.lineEdit(
            box, self, "datasetName", "Data set name",
            tooltip="Override the default output data set name",
            callback=self.onNameEdited
        )
        self.nameEdit.setPlaceholderText("")

        box = OWGUI.widgetBox(self.controlArea, "Commit", addSpace=True)
        self.commitButton = OWGUI.button(box, self, "Commit",
                                         callback=self.commit)
        cb = OWGUI.checkBox(box, self, "autoCommit", "Commit on any change")
        OWGUI.setStopper(self, self.commitButton, cb, "selectionChanged",
                         self.commit)
        OWGUI.rubber(self.controlArea)

        self.filterLineEdit = OWGUIEx.lineEditHint(
            self.mainArea, self, "filterString", "Filter",
            caseSensitive=False, matchAnywhere=True,
            callback=self.filter,  delimiters=" ")

        splitter = QSplitter(Qt.Vertical, self.mainArea)
        self.mainArea.layout().addWidget(splitter)
        self.treeWidget = QTreeView(splitter)

        self.treeWidget.setSelectionMode(QAbstractItemView.SingleSelection)
        self.treeWidget.setRootIsDecorated(False)
        self.treeWidget.setSortingEnabled(True)
        self.treeWidget.setAlternatingRowColors(True)
        self.treeWidget.setUniformRowHeights(True)
        self.treeWidget.setEditTriggers(QTreeView.NoEditTriggers)

        linkdelegate = LinkStyledItemDelegate(self.treeWidget)
        self.treeWidget.setItemDelegateForColumn(1, linkdelegate)
        self.treeWidget.setItemDelegateForColumn(8, linkdelegate)
        self.treeWidget.setItemDelegateForColumn(
            0, OWGUI.IndicatorItemDelegate(self.treeWidget,
                                           role=Qt.DisplayRole))

        proxyModel = MySortFilterProxyModel(self.treeWidget)
        self.treeWidget.setModel(proxyModel)
        self.treeWidget.selectionModel().selectionChanged.connect(
            self.updateSelection
        )
        self.treeWidget.viewport().setMouseTracking(True)

        splitterH = QSplitter(Qt.Horizontal, splitter)

        box = OWGUI.widgetBox(splitterH, "Description")
        self.infoGDS = OWGUI.widgetLabel(box, "")
        self.infoGDS.setWordWrap(True)
        OWGUI.rubber(box)

        box = OWGUI.widgetBox(splitterH, "Sample Annotations")
        self.annotationsTree = QTreeWidget(box)
        self.annotationsTree.setHeaderLabels(
            ["Type (Sample annotations)", "Sample count"]
        )
        self.annotationsTree.setRootIsDecorated(True)
        box.layout().addWidget(self.annotationsTree)
        self.annotationsTree.itemChanged.connect(
            self.annotationSelectionChanged
        )
        self._annotationsUpdating = False
        self.splitters = splitter, splitterH

        for sp, setting in zip(self.splitters, self.splitterSettings):
            sp.splitterMoved.connect(self.splitterMoved)
            sp.restoreState(setting)

        self.searchKeys = ["dataset_id", "title", "platform_organism",
                           "description"]

        self.gds = []
        self.gds_info = None

        self.resize(1000, 600)

        self.setBlocking(True)
        self.setEnabled(False)
        self.progressBarInit()

        self._executor = ThreadExecutor()

        func = partial(get_gds_model,
                       methodinvoke(self, "_setProgress", (float,)))
        self._inittask = Task(function=func)
        self._inittask.finished.connect(self._initializemodel)
        self._executor.submit(self._inittask)

        self._datatask = None
示例#10
0
    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 = None              # p-values: 2D Numeric.array of shape (3, numExamples)
        self.selectorName = ""      # for Example Selection output: (self.selectorName, [0,1,0,...])

        # Settings
        self.anovaType = 0      # 0: single-sample t-test, 1: one-way (A), 2: one-way (B), 3: two-way (A,B), 4: ful factorial (A, B, A*B)
        self.compareToValue = 0 # single sample t-test, value to compare to
        self._interaction = 0    # 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 = self.controlArea
       
        # info
        box = OWGUI.widgetBox(ca, "Info")
        #gl.addWidget(box,0,0)
        self.infoa = OWGUI.label(box, self, 'No data on input.')
        self.infob = OWGUI.label(box, self, "")
        self.infoc = OWGUI.label(box, self, "")

        # ANOVA type
        # group selection
        anovaTypes = ["Single sample t-test", 
            "Single-factor (A, variables)", 
            "Single-factor (B, data sets)", 
            "Two-factor", 
            "Two-factor with interaction effect"]

        self.boxAnovaType = OWGUI.widgetBox(ca, "Anova Type")
        self.anovaTypeS = OWGUI.radioButtonsInBox(self.boxAnovaType, self, "anovaType", btnLabels=anovaTypes)
        
        self.boxAnovaType.setDisabled(1)

        self.boxCompareTo = OWGUI.widgetBox(self.boxAnovaType)
        OWGUI.lineEdit(self.boxCompareTo, self, "compareToValue", callback=self.onCompareToChange, label="compare to")

        # selection of examples
        self.boxSelection = OWGUI.widgetBox(ca, "Example Selection")
        self.lblNumGenes = []   # list of labels

        # selector A
        self.boxSelectorA = OWGUI.widgetBox(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 = OWGUI.widgetBox(self.boxSelectorA)
        leA = OWGUI.lineEdit(frmA, self, "alphaA", orientation="horizontal", callback=lambda x=0: self.onAlphaChange(x), label= "p <= ")
        self.lblNumGenes.append(OWGUI.label(frmA, self, ""))

        # selector B
        self.boxSelectorB = OWGUI.widgetBox(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 = OWGUI.widgetBox(self.boxSelectorB)
        leB = OWGUI.lineEdit(frmB, self, "alphaB", orientation="horizontal", callback=lambda x=1: self.onAlphaChange(x), label= "p <= ")
        self.lblNumGenes.append(OWGUI.label(frmB, self, ""))

        # selector I
        self.boxSelectorI = OWGUI.widgetBox(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 = OWGUI.widgetBox(self.boxSelectorI)
        leI = OWGUI.lineEdit(frmI, self, "alphaI", orientation="horizontal", callback=lambda x=2: self.onAlphaChange(x), label= "p <= ")
        self.lblNumGenes.append(OWGUI.label(frmI, self, ""))

        # output
        box = OWGUI.widgetBox(ca, "Output")
        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())
示例#11
0
    def __init__(self, parent=None, signalManager=None, name="Gene Info"):
        OWWidget.__init__(self, parent, signalManager, name)

        self.inputs = [("Examples", Orange.data.Table, self.setData)]
        self.outputs = [("Selected Examples", Orange.data.Table)]

        self.organismIndex = 0
        self.taxid = None
        self.geneAttr = 0
        self.useAttr = False
        self.autoCommit = False
        self.searchString = ""
        self.selectionChangedFlag = False
        self.useAltSource = 0
        self.loadSettings()

        self.__initialized = False
        self.initfuture = None
        self.itemsfuture = None

        self.infoLabel = OWGUI.widgetLabel(
            OWGUI.widgetBox(self.controlArea, "Info", addSpace=True),
            "Initializing\n"
        )

        self.organisms = None
        self.organismBox = OWGUI.widgetBox(
            self.controlArea, "Organism", addSpace=True)

        self.organismComboBox = OWGUI.comboBox(
            self.organismBox, self, "organismIndex",
            callback=self._onSelectedOrganismChanged,
            debuggingEnabled=0)

        # For now only support one alt source, with a checkbox
        # In the future this can be extended to multiple selections
        self.altSourceCheck = OWGUI.checkBox(self.organismBox, self,
                            "useAltSource", "Show information from dictyBase",
                            callback=self.onAltSourceChange,
#                            debuggingEnabled=0,
                            )
        self.altSourceCheck.hide()

        box = OWGUI.widgetBox(self.controlArea, "Gene names", addSpace=True)
        self.geneAttrComboBox = OWGUI.comboBox(
            box, self, "geneAttr",
            "Gene atttibute", callback=self.updateInfoItems
        )
        OWGUI.checkBox(box, self, "useAttr", "Use attribute names",
                       callback=self.updateInfoItems,
                       disables=[(-1, self.geneAttrComboBox)])

        self.geneAttrComboBox.setDisabled(bool(self.useAttr))

        box = OWGUI.widgetBox(self.controlArea, "Commit", addSpace=True)
        b = OWGUI.button(box, self, "Commit", callback=self.commit)
        c = OWGUI.checkBox(box, self, "autoCommit", "Commit on change")
        OWGUI.setStopper(self, b, c, "selectionChangedFlag",
                         callback=self.commit)

        # A label for dictyExpress link
        self.dictyExpressBox = OWGUI.widgetBox(
            self.controlArea, "Dicty Express")
        self.linkLabel = OWGUI.widgetLabel(self.dictyExpressBox, "")
        self.linkLabel.setOpenExternalLinks(False)
        self.connect(self.linkLabel, SIGNAL("linkActivated(QString)"),
                     self.onDictyExpressLink)
        self.dictyExpressBox.hide()

        OWGUI.rubber(self.controlArea)

        OWGUI.lineEdit(self.mainArea, self, "searchString", "Filter",
                       callbackOnType=True, callback=self.searchUpdate)

        self.treeWidget = QTreeView(self.mainArea)
        self.treeWidget.setRootIsDecorated(False)
        self.treeWidget.setSelectionMode(
            QAbstractItemView.ExtendedSelection)
        self.treeWidget.setItemDelegate(
            LinkStyledItemDelegate(self.treeWidget))
        self.treeWidget.setUniformRowHeights(True)
        self.treeWidget.viewport().setMouseTracking(True)
        self.treeWidget.setSortingEnabled(True)
        self.mainArea.layout().addWidget(self.treeWidget)

        box = OWGUI.widgetBox(self.mainArea, "",
                              orientation="horizontal")
        OWGUI.button(box, self, "Select Filtered",
                     callback=self.selectFiltered)
        OWGUI.button(box, self, "Clear Selection",
                     callback=self.treeWidget.clearSelection)

        self.resize(1000, 700)

        self.geneinfo = []
        self.cells = []
        self.row2geneinfo = {}
        self.data = None

        # : (# input genes, # matches genes)
        self.matchedInfo = 0, 0
        self.selectionUpdateInProgress = False

        self.setBlocking(True)
        self.executor = ThreadExecutor(self)

        self.progressBarInit()

        task = Task(
            function=partial(
                taxonomy.ensure_downloaded,
                callback=methodinvoke(self, "advance", ())
            )
        )

        task.resultReady.connect(self.initialize)
        task.exceptionReady.connect(self._onInitializeError)

        self.initfuture = self.executor.submit(task)
示例#12
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "MeshBrowser")
        self.inputs = [("Reference data", ExampleTable, self.getReferenceData),
                       ("Cluster data", ExampleTable, self.getClusterData)]
        self.outputs = [("Selected examples", ExampleTable)]

        # widget variables
        self.loadedRef = 0
        self.loadedClu = 0
        self.maxPValue = 0.05
        self.minExamplesInTerm = 5
        self.multi = 1
        self.reference = None
        self.cluster = None
        self.loadSettings()
        self.mesh = obiMeSH()  # main object is created
        self.dataLoaded = self.mesh.dataLoaded

        # left pane
        box = OWGUI.widgetBox(self.controlArea, "Info")
        #box = QGroupBox("Info", self.controlArea)
        self.infoa = OWGUI.label(box, self, "No reference data.")
        self.infob = OWGUI.label(box, self, "No cluster data.")
        self.ratio = OWGUI.label(box, self, "")
        self.ref_att = OWGUI.label(box, self, "")
        self.clu_att = OWGUI.label(box, self, "")
        self.resize(960, 600)
        OWGUI.separator(self.controlArea)

        self.optionsBox = OWGUI.widgetBox(self.controlArea, "Options")
        self.maxp = OWGUI.lineEdit(self.optionsBox,
                                   self,
                                   "maxPValue",
                                   label="threshold:",
                                   orientation="horizontal",
                                   labelWidth=120,
                                   valueType=float)
        self.minf = OWGUI.lineEdit(self.optionsBox,
                                   self,
                                   "minExamplesInTerm",
                                   label="min. frequency:",
                                   orientation="horizontal",
                                   labelWidth=120,
                                   valueType=int)
        #OWGUI.checkBox(self.optionsBox, self, 'multi', 'Multiple selection', callback= self.checkClicked)
        OWGUI.button(self.optionsBox, self, "Refresh", callback=self.refresh)

        # right pane
        self.col_size = [280, 84, 84, 100, 110]
        self.sort_col = 0
        self.sort_dir = True
        self.columns = [
            'MeSH term', '# reference', '# cluster', 'p value',
            'fold enrichment'
        ]  # both datasets

        self.splitter = QSplitter(Qt.Vertical, self.mainArea)
        self.mainArea.layout().addWidget(self.splitter)

        # list view
        self.meshLV = QTreeWidget(self.splitter)
        #self.meshLV.setSelectionMode(QAbstractItemView.MultiSelection)
        self.meshLV.setAllColumnsShowFocus(1)
        self.meshLV.setColumnCount(len(self.columns))
        self.meshLV.setHeaderLabels(self.columns)

        self.meshLV.header().setClickable(True)
        #self.meshLV.header().setSortIndicatorShown(True)
        #self.meshLV.setSortingEnabled(True)
        self.meshLV.setRootIsDecorated(True)
        self.connect(self.meshLV, SIGNAL("itemSelectionChanged()"),
                     self.viewSelectionChanged)
        #self.meshLV.setItemDelegateForColumn(3, EnrichmentColumnItemDelegate(self))
        #self.tooltips = ListViewToolTip(self.meshLV,0, self.mesh.toDesc)

        # table of significant mesh terms
        self.sigTermsTable = QTableWidget(self.splitter)
        self.sigTermsTable.setColumnCount(len(self.columns))
        self.sigTermsTable.setRowCount(4)
        ## hide the vertical header
        self.sigTermsTable.verticalHeader().hide()
        #self.sigTermsTable.setLeftMargin(0)
        #self.sigTermsTable.setSelectionMode(QAbstractItemView.MultiSelection)

        for i in range(0, len(self.columns)):
            self.sigTermsTable.horizontalHeader().resizeSection(
                i, self.col_size[i])
            self.meshLV.header().resizeSection(i, self.col_size[i])

        self.sigTermsTable.setHorizontalHeaderLabels(self.columns)

        self.connect(self.sigTermsTable, SIGNAL("itemSelectionChanged()"),
                     self.tableSelectionChanged)
        self.connect(self.sigTermsTable,
                     SIGNAL("clicked(int,int,int,const QPoint&)"),
                     self.tableClicked)
        self.splitter.show()
        self.optionsBox.setDisabled(1)
示例#13
0
    def __init__(self, parallelWidget, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager,
                          "Parallel Optimization Dialog", False)
        self.setCaption("Parallel Optimization Dialog")
        self.parallelWidget = parallelWidget

        self.optimizationMeasure = 0
        self.attributeCount = 5
        self.numberOfAttributes = 6
        self.fileName = ""
        self.lastSaveDirName = os.getcwd() + "/"
        self.fileBuffer = []
        self.projections = []
        self.allResults = []
        self.canOptimize = 0
        self.orderAllAttributes = 1  # do we wish to order all attributes or find just an interesting subset
        self.worstVal = -1  # used in heuristics to stop the search in uninteresting parts of the graph

        self.loadSettings()

        self.measureBox = OWGUI.radioButtonsInBox(
            self.controlArea,
            self,
            "optimizationMeasure", ["Correlation", "VizRank"],
            box="Select optimization measure",
            callback=self.updateGUI)
        self.vizrankSettingsBox = OWGUI.widgetBox(self.controlArea,
                                                  "VizRank settings")
        self.optimizeBox = OWGUI.widgetBox(self.controlArea, "Optimize")
        self.manageBox = OWGUI.widgetBox(self.controlArea, "Manage results")
        self.resultsBox = OWGUI.widgetBox(self.mainArea, "Results")

        self.resultList = OWGUI.listBox(self.resultsBox, self)
        self.resultList.setMinimumSize(200, 200)
        self.connect(self.resultList, SIGNAL("itemSelectionChanged()"),
                     self.showSelectedAttributes)

        # remove non-existing files
        names = []
        for i in range(len(self.fileBuffer) - 1, -1, -1):
            (short, longName) = self.fileBuffer[i]
            if not os.path.exists(longName):
                self.fileBuffer.remove((short, longName))
            else:
                names.append(short)
        names.append("(None)")
        self.fileName = "(None)"

        self.hbox1 = OWGUI.widgetBox(self.vizrankSettingsBox,
                                     "VizRank projections file",
                                     orientation="horizontal")
        self.vizrankFileCombo = OWGUI.comboBox(
            self.hbox1,
            self,
            "fileName",
            items=names,
            tooltip=
            "File that contains information about interestingness of scatterplots\n"
            "generated by VizRank method in scatterplot widget",
            callback=self.changeProjectionFile,
            sendSelectedValue=1,
            valueType=str)
        self.browseButton = OWGUI.button(self.hbox1,
                                         self,
                                         "...",
                                         callback=self.loadProjections)
        self.browseButton.setMaximumWidth(20)

        self.resultsInfoBox = OWGUI.widgetBox(self.vizrankSettingsBox,
                                              "VizRank parameters")
        self.kNeighborsLabel = OWGUI.widgetLabel(self.resultsInfoBox,
                                                 "Number of neighbors (k):")
        self.percentDataUsedLabel = OWGUI.widgetLabel(self.resultsInfoBox,
                                                      "Percent of data used:")
        self.testingMethodLabel = OWGUI.widgetLabel(self.resultsInfoBox,
                                                    "Testing method used:")
        self.qualityMeasureLabel = OWGUI.widgetLabel(self.resultsInfoBox,
                                                     "Quality measure used:")

        self.allAttributesRadio = QRadioButton("Order all attributes",
                                               self.optimizeBox)
        self.optimizeBox.layout().addWidget(self.allAttributesRadio)
        self.connect(self.allAttributesRadio, SIGNAL("clicked()"),
                     self.setAllAttributeRadio)
        box = OWGUI.widgetBox(self.optimizeBox, orientation="horizontal")
        self.subsetAttributeRadio = QRadioButton("Find subsets of", box)
        box.layout().addWidget(self.subsetAttributeRadio)
        self.connect(self.subsetAttributeRadio, SIGNAL("clicked()"),
                     self.setSubsetAttributeRadio)
        self.subsetAttributeEdit = OWGUI.lineEdit(box,
                                                  self,
                                                  "numberOfAttributes",
                                                  valueType=int)
        self.subsetAttributeEdit.setMaximumWidth(30)
        OWGUI.widgetLabel(box, "attributes")

        self.startOptimizationButton = OWGUI.button(
            self.optimizeBox,
            self,
            "Start Optimization",
            callback=self.startOptimization)
        f = self.startOptimizationButton.font()
        f.setBold(1)
        self.startOptimizationButton.setFont(f)
        self.stopOptimizationButton = OWGUI.button(
            self.optimizeBox,
            self,
            "Stop Evaluation",
            callback=self.stopOptimizationClick)
        self.stopOptimizationButton.setFont(f)
        self.stopOptimizationButton.hide()
        self.connect(self.stopOptimizationButton, SIGNAL("clicked()"),
                     self.stopOptimizationClick)

        self.clearButton = OWGUI.button(self.manageBox, self, "Clear Results",
                                        self.clearResults)
        self.loadButton = OWGUI.button(self.manageBox, self, "Load",
                                       self.loadResults)
        self.saveButton = OWGUI.button(self.manageBox, self, "Save",
                                       self.saveResults)
        self.closeButton = OWGUI.button(self.manageBox, self, "Close Dialog",
                                        self.hide)

        self.changeProjectionFile()
        self.updateGUI()
        if self.orderAllAttributes:
            self.setAllAttributeRadio()
        else:
            self.setSubsetAttributeRadio()
示例#14
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "MeshBrowser")
        self.inputs = [("Reference data", ExampleTable, self.getReferenceData), ("Cluster data", ExampleTable, self.getClusterData)]
        self.outputs = [("Selected examples", ExampleTable)]

        # widget variables
        self.loadedRef = 0
        self.loadedClu = 0
        self.maxPValue = 0.05
        self.minExamplesInTerm = 5
        self.multi = 1
        self.reference = None
        self.cluster = None
        self.loadSettings()
        self.mesh = obiMeSH() # main object is created
        self.dataLoaded = self.mesh.dataLoaded

        # left pane
        box = OWGUI.widgetBox(self.controlArea, "Info")
        #box = QGroupBox("Info", self.controlArea)
        self.infoa = OWGUI.label(box, self, "No reference data.")
        self.infob = OWGUI.label(box, self, "No cluster data.")
        self.ratio = OWGUI.label(box, self, "")
        self.ref_att = OWGUI.label(box, self, "")
        self.clu_att = OWGUI.label(box, self, "")
        self.resize(960, 600)
        OWGUI.separator(self.controlArea)

        self.optionsBox = OWGUI.widgetBox(self.controlArea, "Options")
        self.maxp = OWGUI.lineEdit(self.optionsBox, self, "maxPValue", label="threshold:", orientation="horizontal", labelWidth=120, valueType=float)
        self.minf = OWGUI.lineEdit(self.optionsBox, self, "minExamplesInTerm", label="min. frequency:", orientation="horizontal", labelWidth=120, valueType=int)
        #OWGUI.checkBox(self.optionsBox, self, 'multi', 'Multiple selection', callback= self.checkClicked)
        OWGUI.button(self.optionsBox, self, "Refresh", callback=self.refresh)

        # right pane
        self.col_size = [280, 84, 84, 100, 110]
        self.sort_col = 0
        self.sort_dir = True
        self.columns = ['MeSH term', '# reference', '# cluster', 'p value', 'fold enrichment'] # both datasets

        self.splitter = QSplitter(Qt.Vertical, self.mainArea)
        self.mainArea.layout().addWidget(self.splitter)

        # list view
        self.meshLV = QTreeWidget(self.splitter)
        #self.meshLV.setSelectionMode(QAbstractItemView.MultiSelection)
        self.meshLV.setAllColumnsShowFocus(1)
        self.meshLV.setColumnCount(len(self.columns))
        self.meshLV.setHeaderLabels(self.columns)

        self.meshLV.header().setClickable(True)
        #self.meshLV.header().setSortIndicatorShown(True)
        #self.meshLV.setSortingEnabled(True)
        self.meshLV.setRootIsDecorated(True)
        self.connect(self.meshLV, SIGNAL("itemSelectionChanged()"), self.viewSelectionChanged)
        #self.meshLV.setItemDelegateForColumn(3, EnrichmentColumnItemDelegate(self))
        #self.tooltips = ListViewToolTip(self.meshLV,0, self.mesh.toDesc)

        # table of significant mesh terms
        self.sigTermsTable = QTableWidget(self.splitter)
        self.sigTermsTable.setColumnCount(len(self.columns))
        self.sigTermsTable.setRowCount(4)
        ## hide the vertical header
        self.sigTermsTable.verticalHeader().hide()
        #self.sigTermsTable.setLeftMargin(0)
        #self.sigTermsTable.setSelectionMode(QAbstractItemView.MultiSelection)

        for i in range(0, len(self.columns)):
            self.sigTermsTable.horizontalHeader().resizeSection(i, self.col_size[i])
            self.meshLV.header().resizeSection(i, self.col_size[i])

        self.sigTermsTable.setHorizontalHeaderLabels(self.columns)

        self.connect(self.sigTermsTable, SIGNAL("itemSelectionChanged()"), self.tableSelectionChanged)
        self.connect(self.sigTermsTable, SIGNAL("clicked(int,int,int,const QPoint&)"), self.tableClicked)
        self.splitter.show()
        self.optionsBox.setDisabled(1)
示例#15
0
    def __init__(self, parallelWidget, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "Parallel Optimization Dialog", False)
        self.setCaption("Parallel Optimization Dialog")
        self.parallelWidget = parallelWidget

        self.optimizationMeasure = 0
        self.attributeCount = 5
        self.numberOfAttributes = 6
        self.fileName = ""
        self.lastSaveDirName = os.getcwd() + "/"
        self.fileBuffer = []
        self.projections = []
        self.allResults = []
        self.canOptimize = 0
        self.orderAllAttributes = 1  # do we wish to order all attributes or find just an interesting subset
        self.worstVal = -1  # used in heuristics to stop the search in uninteresting parts of the graph

        self.loadSettings()

        self.measureBox = OWGUI.radioButtonsInBox(self.controlArea, self, "optimizationMeasure",
                                                  ["Correlation", "VizRank"], box="Select optimization measure",
                                                  callback=self.updateGUI)
        self.vizrankSettingsBox = OWGUI.widgetBox(self.controlArea, "VizRank settings")
        self.optimizeBox = OWGUI.widgetBox(self.controlArea, "Optimize")
        self.manageBox = OWGUI.widgetBox(self.controlArea, "Manage results")
        self.resultsBox = OWGUI.widgetBox(self.mainArea, "Results")

        self.resultList = OWGUI.listBox(self.resultsBox, self)
        self.resultList.setMinimumSize(200, 200)
        self.connect(self.resultList, SIGNAL("itemSelectionChanged()"), self.showSelectedAttributes)

        # remove non-existing files
        names = []
        for i in range(len(self.fileBuffer) - 1, -1, -1):
            (short, longName) = self.fileBuffer[i]
            if not os.path.exists(longName):
                self.fileBuffer.remove((short, longName))
            else:
                names.append(short)
        names.append("(None)")
        self.fileName = "(None)"

        self.hbox1 = OWGUI.widgetBox(self.vizrankSettingsBox, "VizRank projections file", orientation="horizontal")
        self.vizrankFileCombo = OWGUI.comboBox(self.hbox1, self, "fileName", items=names,
                                               tooltip="File that contains information about interestingness of scatterplots\n"
                                                       "generated by VizRank method in scatterplot widget",
                                               callback=self.changeProjectionFile, sendSelectedValue=1, valueType=str)
        self.browseButton = OWGUI.button(self.hbox1, self, "...", callback=self.loadProjections)
        self.browseButton.setMaximumWidth(20)

        self.resultsInfoBox = OWGUI.widgetBox(self.vizrankSettingsBox, "VizRank parameters")
        self.kNeighborsLabel = OWGUI.widgetLabel(self.resultsInfoBox, "Number of neighbors (k):")
        self.percentDataUsedLabel = OWGUI.widgetLabel(self.resultsInfoBox, "Percent of data used:")
        self.testingMethodLabel = OWGUI.widgetLabel(self.resultsInfoBox, "Testing method used:")
        self.qualityMeasureLabel = OWGUI.widgetLabel(self.resultsInfoBox, "Quality measure used:")

        self.allAttributesRadio = QRadioButton("Order all attributes", self.optimizeBox)
        self.optimizeBox.layout().addWidget(self.allAttributesRadio)
        self.connect(self.allAttributesRadio, SIGNAL("clicked()"), self.setAllAttributeRadio)
        box = OWGUI.widgetBox(self.optimizeBox, orientation="horizontal")
        self.subsetAttributeRadio = QRadioButton("Find subsets of", box)
        box.layout().addWidget(self.subsetAttributeRadio)
        self.connect(self.subsetAttributeRadio, SIGNAL("clicked()"), self.setSubsetAttributeRadio)
        self.subsetAttributeEdit = OWGUI.lineEdit(box, self, "numberOfAttributes", valueType=int)
        self.subsetAttributeEdit.setMaximumWidth(30)
        OWGUI.widgetLabel(box, "attributes")

        self.startOptimizationButton = OWGUI.button(self.optimizeBox, self, "Start Optimization",
                                                    callback=self.startOptimization)
        f = self.startOptimizationButton.font()
        f.setBold(1)
        self.startOptimizationButton.setFont(f)
        self.stopOptimizationButton = OWGUI.button(self.optimizeBox, self, "Stop Evaluation",
                                                   callback=self.stopOptimizationClick)
        self.stopOptimizationButton.setFont(f)
        self.stopOptimizationButton.hide()
        self.connect(self.stopOptimizationButton, SIGNAL("clicked()"), self.stopOptimizationClick)

        self.clearButton = OWGUI.button(self.manageBox, self, "Clear Results", self.clearResults)
        self.loadButton = OWGUI.button(self.manageBox, self, "Load", self.loadResults)
        self.saveButton = OWGUI.button(self.manageBox, self, "Save", self.saveResults)
        self.closeButton = OWGUI.button(self.manageBox, self, "Close Dialog", self.hide)

        self.changeProjectionFile()
        self.updateGUI()
        if self.orderAllAttributes:
            self.setAllAttributeRadio()
        else:
            self.setSubsetAttributeRadio()