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
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=" 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
def __init__(self, parent=None, signalManager=None, title="Gene Network"): super(OWGeneNetwork, self).__init__(parent, signalManager, title, wantMainArea=False, resizingEnabled=False) self.taxid = "9606" self.gene_var_index = -1 self.use_attr_names = False self.network_source = 1 self.include_neighborhood = True self.autocommit = False self.min_score = 0.9 self.loadSettings() self.taxids = taxonomy.common_taxids() self.current_taxid_index = self.taxids.index(self.taxid) self.data = None self.geneinfo = None self.nettask = None self._invalidated = False box = OWGUI.widgetBox(self.controlArea, "Info") self.info = OWGUI.widgetLabel(box, "No data on input\n") box = OWGUI.widgetBox(self.controlArea, "Organism") self.organism_cb = OWGUI.comboBox(box, self, "current_taxid_index", items=map(taxonomy.name, self.taxids), callback=self._update_organism) box = OWGUI.widgetBox(self.controlArea, "Genes") self.genes_cb = OWGUI.comboBox(box, self, "gene_var_index", callback=self._update_query_genes) self.varmodel = OWItemModels.VariableListModel() self.genes_cb.setModel(self.varmodel) OWGUI.checkBox(box, self, "use_attr_names", "Use attribute names", callback=self._update_query_genes) box = OWGUI.widgetBox(self.controlArea, "Network") OWGUI.comboBox(box, self, "network_source", items=[s.name for s in SOURCES], callback=self._on_source_db_changed) OWGUI.checkBox(box, self, "include_neighborhood", "Include immediate gene neighbors", callback=self.invalidate) self.score_spin = OWGUI.doubleSpin(box, self, "min_score", 0.0, 1.0, step=0.001, label="Minimal edge score", callback=self.invalidate) self.score_spin.setEnabled(SOURCES[self.network_source].score_filter) box = OWGUI.widgetBox(self.controlArea, "Commit") OWGUI.button(box, self, "Commit", callback=self.commit, default=True) self.executor = ThreadExecutor()
def __init__(self, parent=None, signalManager=None, wantCloseButton=False, showAll=True): OWWidget.__init__(self, parent, signalManager, wantMainArea=False) self.searchString = "" self.showAll = showAll self.serverFiles = serverfiles.ServerFiles() box = OWGUI.widgetBox(self.controlArea, orientation="horizontal") self.lineEditFilter = \ OWGUIEx.lineEditHint(box, self, "searchString", "Filter", caseSensitive=False, delimiters=" ", matchAnywhere=True, listUpdateCallback=self.SearchUpdate, callbackOnType=True, callback=self.SearchUpdate) box = OWGUI.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)) QObject.connect(self.filesView.model(), SIGNAL("layoutChanged()"), self.SearchUpdate) box.layout().addWidget(self.filesView) box = OWGUI.widgetBox(self.controlArea, orientation="horizontal") self.updateButton = OWGUI.button( box, self, "Update all", callback=self.UpdateAll, tooltip="Update all updatable files", ) self.downloadButton = OWGUI.button( box, self, "Download all", callback=self.DownloadFiltered, tooltip="Download all filtered files shown") self.cancelButton = OWGUI.button( box, self, "Cancel", callback=self.Cancel, tooltip="Cancel scheduled downloads/updates.") OWGUI.rubber(box) self.retryButton = OWGUI.button(box, self, "Retry", callback=self.RetrieveFilesList) self.retryButton.hide() box = OWGUI.widgetBox(self.controlArea, orientation="horizontal") OWGUI.rubber(box) if wantCloseButton: OWGUI.button(box, self, "Close", callback=self.accept, tooltip="Close") 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
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)
def __init__(self, parent=None, signalManager=None, name="KEGG Pathways"): OWWidget.__init__(self, parent, signalManager, name, wantGraph=True) self.inputs = [("Examples", Orange.data.Table, self.SetData), ("Reference", Orange.data.Table, self.SetRefData)] self.outputs = [("Selected Examples", Orange.data.Table), ("Unselected Examples", Orange.data.Table)] self.organismIndex = 0 self.geneAttrIndex = 0 self.autoCommit = False self.autoResize = True self.useReference = False self.useAttrNames = 0 self.showOrthology = True self.loadSettings() self.organismCodes = [] self._changedFlag = False self.controlArea.setMaximumWidth(250) box = OWGUI.widgetBox(self.controlArea, "Info") self.infoLabel = OWGUI.widgetLabel(box, "No data on input\n") # Organism selection. box = OWGUI.widgetBox(self.controlArea, "Organism") self.organismComboBox = OWGUI.comboBox( box, self, "organismIndex", items=[], callback=self.Update, addSpace=True, debuggingEnabled=0, tooltip="Select the organism of the input genes") # Selection of genes attribute box = OWGUI.widgetBox(self.controlArea, "Gene attribute") self.geneAttrCandidates = VariableListModel(parent=self) self.geneAttrCombo = OWGUI.comboBox( box, self, "geneAttrIndex", callback=self.Update) self.geneAttrCombo.setModel(self.geneAttrCandidates) OWGUI.checkBox(box, self, "useAttrNames", "Use variable names", disables=[(-1, self.geneAttrCombo)], callback=self.Update) self.geneAttrCombo.setDisabled(bool(self.useAttrNames)) OWGUI.separator(self.controlArea) OWGUI.checkBox(self.controlArea, self, "useReference", "From signal", box="Reference", callback=self.Update) OWGUI.separator(self.controlArea) OWGUI.checkBox(self.controlArea, self, "showOrthology", "Show pathways in full orthology", box="Orthology", callback=self.UpdateListView) OWGUI.checkBox(self.controlArea, self, "autoResize", "Resize to fit", box="Image", callback=self.UpdatePathwayViewTransform) box = OWGUI.widgetBox(self.controlArea, "Cache Control") OWGUI.button(box, self, "Clear cache", callback=self.ClearCache, tooltip="Clear all locally cached KEGG data.") OWGUI.separator(self.controlArea) box = OWGUI.widgetBox(self.controlArea, "Selection") cb = OWGUI.checkBox(box, self, "autoCommit", "Commit on update") button = OWGUI.button(box, self, "Commit", callback=self.Commit, default=True) OWGUI.setStopper(self, button, cb, "_changedFlag", self.Commit) OWGUI.rubber(self.controlArea) spliter = QSplitter(Qt.Vertical, self.mainArea) self.pathwayView = PathwayView(self, spliter) self.pathwayView.scene().selectionChanged.connect( self._onSelectionChanged ) self.mainArea.layout().addWidget(spliter) self.listView = QTreeWidget(spliter) spliter.addWidget(self.listView) self.listView.setAllColumnsShowFocus(1) self.listView.setColumnCount(4) self.listView.setHeaderLabels(["Pathway", "P value", "Genes", "Reference"]) self.listView.setSelectionMode(QTreeWidget.SingleSelection) self.listView.setSortingEnabled(True) self.listView.setMaximumHeight(200) self.connect(self.listView, SIGNAL("itemSelectionChanged()"), self.UpdatePathwayView) self.connect(self.graphButton, SIGNAL("clicked()"), self.saveGraph) select = QAction( "Select All", self, shortcut=QKeySequence.SelectAll ) select.triggered.connect(self.selectAll) self.addAction(select) self.data = None self.refData = None self.resize(800, 600) self.connect(self, SIGNAL("widgetStateChanged(QString, int, QString)"), self.onStateChange) self.has_new_data = False self.has_new_reference_set = False self._executor = ThreadExecutor() self.setEnabled(False) self.setBlocking(True) QTimer.singleShot(0, self._initialize) self.infoLabel.setText("Fetching organism definitions\n")