def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, 'Process Chip Data') self.callbackDeposit = [] self.inputs = [("Structured Data", DataFiles, self.chipdata)] self.outputs = [("Structured Data", DataFiles)] self.chipdata = None; self.datasets = None self.std = [("No preprocessing", None), ("Array-based standardization", chipstat.standardize_arrays), ("Gene-based standardization", chipstat.standardize_genes), ("First array-, then gene-based standardization", lambda e,r: chipstat.standardize_genes(chipstat.standardize_arrays(e,r),r)), ("First gene-, then array-based standardization", lambda e,r: chipstat.standardize_arrays(chipstat.standardize_genes(e,r),r))] # Settings self.data = None self.preStdMethod = 0; self.preStdRob = 1 self.postStdMethod = 0; self.postStdRob = 1 self.mergeType = 0 self.commitOnChange = 0 self.loadSettings() # GUI # info box = QVGroupBox("Info", self.controlArea) self.infoa = QLabel('No data on input.', box) self.infob = QLabel('', box) # preprocessing OWGUI.separator(self.controlArea) box = QVGroupBox("Preprocessing", self.controlArea) labels = [x[0] for x in self.std] OWGUI.comboBox(box, self, 'preStdMethod', label=None, labelWidth=None, orientation='vertical', items=labels, callback=self.selectionChange) self.preRobBtn = OWGUI.checkBox(box, self, "preStdRob", "Robust standardization", callback=self.selectionChange) # merge OWGUI.separator(self.controlArea) self.mergeTypes = [(0, "No merging"), ('mean', 'Mean'), ('median', 'Median'), ('min', 'Minimum expression'), ('max', 'Maximum expression')] labels = [x[1] for x in self.mergeTypes] OWGUI.radioButtonsInBox(self.controlArea, self, 'mergeType', labels, box='Merge Replicas', tooltips=None, callback=self.selectionChange) # postprocessing OWGUI.separator(self.controlArea) self.boxPostproc = QVGroupBox("Postprocessing", self.controlArea) labels = [x[0] for x in self.std] OWGUI.comboBox(self.boxPostproc, self, 'postStdMethod', label=None, labelWidth=None, orientation='vertical', items=labels, callback=self.selectionChange) self.postRobBtn = OWGUI.checkBox(self.boxPostproc, self, "postStdRob", "Robust standardization", callback=self.selectionChange) # output OWGUI.separator(self.controlArea) box = QVGroupBox("Output", self.controlArea) OWGUI.checkBox(box, self, 'commitOnChange', 'Commit data on selection change') self.commitBtn = OWGUI.button(box, self, "Commit", callback=self.selectionChange, disabled=1) self.setBtnsState() self.resize(100,100)
def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, 'Epistasis Analysis') self.inputs = [("Examples", ExampleTable, self.dataset, Multiple), ("Structured Data", DataFiles, self.chipdata, 1)] self.outputs = [("Gene Selection", ExampleSelection), ("Examples A->B", ExampleTable), ("Examples B->A", ExampleTable), ("Examples A||B", ExampleTable)] self.data = [] self.selectedFile = None self.A, self.B, self.AB = (None, None, None) self.epiA, self.epiB, self.para = (0, 0, 0) self.distype = 0 #set default settings self.loadSettings() # Selection of data files box = OWGUI.widgetBox(self.controlArea, "Data files", addSpace=True) # box = QVButtonGroup("Data Files", self.controlArea) # self.fileLB = OWGUI.listBox(box, self, "selectedFile", "files", # tooltip="Select example table", ## callback=self.fileSelectionChanged, # selectionMode=QListWidget.SingleSelection, # ) # self.connect(self.fileLB, SIGNAL("currentRowChanged(int)"), self.fileSelectionChanged) self.fileLB = QListWidget() # self.fileLB.setMaximumWidth(10) self.connect(self.fileLB, SIGNAL("highlighted(int)"), self.fileSelectionChanged) # self.connect(self.fileLB, SIGNAL("selected(int)"), self.setFileReferenceBySelection) box.layout().addWidget(self.fileLB) hbox = OWGUI.widgetBox(box, "", orientation="horizontal") # hbox = QHBox(box) self.markBtns = [] for (i, lbl) in enumerate(["A","B","D"]): btn = OWGUI.button(hbox, self, lbl, callback=lambda i=i: self.setMark(i), disabled=1) # btn.setMaximumWidth(45) # btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.markBtns.append(btn) # Relations, checkbox for gene selection self.sbox = OWGUI.widgetBox(self.controlArea, "Relations (Gene Selection)") # self.sbox = QVButtonGroup("Relations (Gene Selection)", self.controlArea) self.selChkbox = [] self.cbinfo = (("epiA", "A -> B", "Gene B is epistatic to gene A"), ("epiB", "B -> A", "Gene A is epistatic to gene B"), ("para", "A || B", "Genes A and B are on parallel pathways")) for (i, cb) in enumerate(self.cbinfo): cb = OWGUI.checkBox(self.sbox, self, cb[0], cb[1], tooltip=cb[2], callback=self.filterSelectionChanged) self.selChkbox.append(cb) self.infochi = OWGUI.widgetLabel(self.sbox, "") #QLabel(self.sbox, '') self.sbox.setDisabled(1) OWGUI.radioButtonsInBox(self.controlArea, self, "distype", ["Average By Gene", "Average By Measurement"], box="Distance", tooltips=None, callback=self.analysis) # scene self.scene = QGraphicsScene() self.sceneView = QGraphicsView() self.sceneView.setScene(self.scene) self.scene.setSceneRect(QRectF(0, 0, canvasW, canvasW)) self.mainArea.layout().addWidget(self.sceneView) # canvas # self.canvas = QCanvas() # self.layout = QVBoxLayout(self.mainArea) # self.canvasView = QCanvasView(self.canvas, self.mainArea) # self.canvas.resize(canvasW, canvasW) # self.layout.add(self.canvasView) self.resize(420,350)
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, title="Molecule visualizer"): super(OWMoleculeVisualizer, self).__init__(parent, signalManager, title) self.colorFragments = 1 self.showFragments = 0 self.selectedFragment = "" self.moleculeSmiles = [] self.fragmentSmiles = [] self.defFragmentSmiles = [] self.smiles_var = 0 self.moleculeTitleAttr = 0 self.moleculeTitleAttributeList = [] self.selectedMoleculeTitleAttrs = [] self.fragmentSmilesAttr = 0 self.imageSize = 200 self.numColumns = 4 self.commitOnChange = 0 ## GUI box = OWGUI.widgetBox(self.controlArea, "Info", addSpace=True) self.infoLabel = OWGUI.label(box, self, "Chemicals:") box = OWGUI.radioButtonsInBox(self.controlArea, self, "showFragments", ["Show molecules", "Show fragments"], "Show", callback=self.updateitems) self.showFragmentsRadioButton = box.buttons[-1] self.markFragmentsCheckBox = OWGUI.checkBox(box, self, "colorFragments", "Mark fragments", callback=self._update) box.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum)) OWGUI.separator(self.controlArea) self.moleculeSmilesCombo = OWGUI.comboBox(self.controlArea, self, "smiles_var", "Molecule SMILES Attribute", callback=self.updateitems) self.moleculeSmilesCombo.box.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum)) self.smiles_var_model = VariableListModel(parent=self) self.moleculeSmilesCombo.setModel(self.smiles_var_model) OWGUI.separator(self.controlArea) box = OWGUI.widgetBox(self.controlArea, "Molecule Title Attributes", addSpace=True) self.title_var_view = QListView( selectionMode=QListView.ExtendedSelection) self.title_var_model = VariableListModel(parent=self) self.title_var_view.setModel(self.title_var_model) self.title_var_view.selectionModel().selectionChanged.connect( self._title_selection_changed) box.layout().addWidget(self.title_var_view) OWGUI.separator(self.controlArea) self.fragmentSmilesCombo = OWGUI.comboBox( self.controlArea, self, "fragmentSmilesAttr", "Fragment SMILES Attribute", callback=self.updateFragmentsListBox) self.fragmentSmilesCombo.setModel(VariableListModel(parent=self)) self.fragmentSmilesCombo.box.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum)) OWGUI.separator(self.controlArea) box = OWGUI.spin(self.controlArea, self, "imageSize", 50, 500, 10, box="Image Size", callback=self._image_size_changed) box.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum)) OWGUI.separator(self.controlArea) box = OWGUI.widgetBox(self.controlArea, "Selection", addSpace=True) OWGUI.checkBox(box, self, "commitOnChange", "Commit on change") self.selectMarkedMoleculesButton = OWGUI.button( box, self, "Select &matched molecules", self.select_marked) OWGUI.button(box, self, "&Commit", callback=self.commit, default=True) OWGUI.separator(self.controlArea) OWGUI.rubber(self.controlArea) spliter = QSplitter(Qt.Vertical) self.scrollArea = ScrollArea(spliter) self.grid = GridWidget() self.grid.selectionChanged.connect(self._on_selection_changed) self.scrollArea.setWidget(self.grid) self.scrollArea.setWidgetResizable(True) self.mainArea.layout().addWidget(spliter) if pybel: self.listBox = QListWidget(spliter) else: self.listBox = QListWidget(None) self.listBox.setHidden(True) self.listBox.itemClicked.connect(self.fragmentSelection) self.fragmentSmilesCombo.box.setDisabled(not pybel) self.data = None self.data_subset = [] self.fragment_data = None self.resize(800, 600) self.listBox.setMaximumHeight(150) self.fragmentSmilesCombo.setDisabled(True) self.selectMarkedMoleculesButton.setDisabled(True) self.markFragmentsCheckBox.setDisabled(True) self.showFragmentsRadioButton.setDisabled(True) self.loadSettings() if not pybel: self.showFragments = 0 self.warning( 10, "Pybel module not installed. To view molecule fragments\n" "please install openbabel python extension.") self.__loop = None
def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, 'Epistasis Analysis') self.inputs = [("Examples", ExampleTable, self.dataset, Multiple), ("Structured Data", DataFiles, self.chipdata, 1)] self.outputs = [("Gene Selection", ExampleSelection), ("Examples A->B", ExampleTable), ("Examples B->A", ExampleTable), ("Examples A||B", ExampleTable)] self.data = [] self.selectedFile = None self.A, self.B, self.AB = (None, None, None) self.epiA, self.epiB, self.para = (0, 0, 0) self.distype = 0 #set default settings self.loadSettings() # Selection of data files box = OWGUI.widgetBox(self.controlArea, "Data files", addSpace=True) # box = QVButtonGroup("Data Files", self.controlArea) # self.fileLB = OWGUI.listBox(box, self, "selectedFile", "files", # tooltip="Select example table", ## callback=self.fileSelectionChanged, # selectionMode=QListWidget.SingleSelection, # ) # self.connect(self.fileLB, SIGNAL("currentRowChanged(int)"), self.fileSelectionChanged) self.fileLB = QListWidget() # self.fileLB.setMaximumWidth(10) self.connect(self.fileLB, SIGNAL("highlighted(int)"), self.fileSelectionChanged) # self.connect(self.fileLB, SIGNAL("selected(int)"), self.setFileReferenceBySelection) box.layout().addWidget(self.fileLB) hbox = OWGUI.widgetBox(box, "", orientation="horizontal") # hbox = QHBox(box) self.markBtns = [] for (i, lbl) in enumerate(["A", "B", "D"]): btn = OWGUI.button(hbox, self, lbl, callback=lambda i=i: self.setMark(i), disabled=1) # btn.setMaximumWidth(45) # btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) self.markBtns.append(btn) # Relations, checkbox for gene selection self.sbox = OWGUI.widgetBox(self.controlArea, "Relations (Gene Selection)") # self.sbox = QVButtonGroup("Relations (Gene Selection)", self.controlArea) self.selChkbox = [] self.cbinfo = (("epiA", "A -> B", "Gene B is epistatic to gene A"), ("epiB", "B -> A", "Gene A is epistatic to gene B"), ("para", "A || B", "Genes A and B are on parallel pathways")) for (i, cb) in enumerate(self.cbinfo): cb = OWGUI.checkBox(self.sbox, self, cb[0], cb[1], tooltip=cb[2], callback=self.filterSelectionChanged) self.selChkbox.append(cb) self.infochi = OWGUI.widgetLabel(self.sbox, "") #QLabel(self.sbox, '') self.sbox.setDisabled(1) OWGUI.radioButtonsInBox(self.controlArea, self, "distype", ["Average By Gene", "Average By Measurement"], box="Distance", tooltips=None, callback=self.analysis) # scene self.scene = QGraphicsScene() self.sceneView = QGraphicsView() self.sceneView.setScene(self.scene) self.scene.setSceneRect(QRectF(0, 0, canvasW, canvasW)) self.mainArea.layout().addWidget(self.sceneView) # canvas # self.canvas = QCanvas() # self.layout = QVBoxLayout(self.mainArea) # self.canvasView = QCanvasView(self.canvas, self.mainArea) # self.canvas.resize(canvasW, canvasW) # self.layout.add(self.canvasView) self.resize(420, 350)
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
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): 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())
def __init__(self,parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "Nomogram", 1) #self.setWFlags(Qt.WResizeNoErase | Qt.WRepaintNoErase) #this works like magic.. no flicker during repaint! self.parent = parent # self.setWFlags(self.getWFlags()+Qt.WStyle_Maximize) self.callbackDeposit = [] # deposit for OWGUI callback functions self.alignType = 0 self.contType = 0 self.yAxis = 0 self.probability = 0 self.verticalSpacing = 60 self.verticalSpacingContinuous = 100 self.diff_between_ordinal = 30 self.fontSize = 9 self.lineWidth = 1 self.histogram = 0 self.histogram_size = 10 self.data = None self.cl = None self.confidence_check = 0 self.confidence_percent = 95 self.sort_type = 0 self.loadSettings() self.pointsName = ["Total", "Total"] self.totalPointsName = ["Probability", "Probability"] self.bnomogram = None self.inputs=[("Classifier", orange.Classifier, self.classifier), ("Data", Orange.data.Table, self.data)] self.TargetClassIndex = 0 self.targetCombo = OWGUI.comboBox(self.controlArea, self, "TargetClassIndex", " Target Class ", addSpace=True, tooltip='Select target (prediction) class in the model.', callback = self.setTarget) self.alignRadio = OWGUI.radioButtonsInBox(self.controlArea, self, 'alignType', ['Align left', 'Align by zero influence'], box='Attribute placement', tooltips=['Attributes in nomogram are left aligned', 'Attributes are not aligned, top scale represents true (normalized) regression coefficient value'], addSpace=True, callback=self.showNomogram) self.verticalSpacingLabel = OWGUI.spin(self.alignRadio, self, 'verticalSpacing', 15, 200, label = 'Vertical spacing:', orientation = 0, tooltip='Define space (pixels) between adjacent attributes.', callback = self.showNomogram) self.ContRadio = OWGUI.radioButtonsInBox(self.controlArea, self, 'contType', ['1D projection', '2D curve'], 'Continuous attributes', tooltips=['Continuous attribute are presented on a single scale', 'Two dimensional space is used to present continuous attributes in nomogram.'], addSpace=True, callback=[lambda:self.verticalSpacingContLabel.setDisabled(not self.contType), self.showNomogram]) self.verticalSpacingContLabel = OWGUI.spin(OWGUI.indentedBox(self.ContRadio, sep=OWGUI.checkButtonOffsetHint(self.ContRadio.buttons[-1])), self, 'verticalSpacingContinuous', 15, 200, label = "Height", orientation=0, tooltip='Define space (pixels) between adjacent 2d presentation of attributes.', callback = self.showNomogram) self.verticalSpacingContLabel.setDisabled(not self.contType) self.yAxisRadio = OWGUI.radioButtonsInBox(self.controlArea, self, 'yAxis', ['Point scale', 'Log odds ratios'], 'Scale', tooltips=['values are normalized on a 0-100 point scale','values on top axis show log-linear contribution of attribute to full model'], addSpace=True, callback=self.showNomogram) layoutBox = OWGUI.widgetBox(self.controlArea, "Display", orientation=1, addSpace=True) self.probabilityCheck = OWGUI.checkBox(layoutBox, self, 'probability', 'Show prediction', tooltip='', callback = self.setProbability) self.CICheck, self.CILabel = OWGUI.checkWithSpin(layoutBox, self, 'Confidence intervals (%):', min=1, max=99, step = 1, checked='confidence_check', value='confidence_percent', checkCallback=self.showNomogram, spinCallback = self.showNomogram) self.histogramCheck, self.histogramLabel = OWGUI.checkWithSpin(layoutBox, self, 'Show histogram, size', min=1, max=30, checked='histogram', value='histogram_size', step = 1, tooltip='-(TODO)-', checkCallback=self.showNomogram, spinCallback = self.showNomogram) OWGUI.separator(layoutBox) self.sortOptions = ["No sorting", "Absolute importance", "Positive influence", "Negative influence"] self.sortBox = OWGUI.comboBox(layoutBox, self, "sort_type", label="Sort by ", items=self.sortOptions, callback = self.sortNomogram, orientation="horizontal") OWGUI.rubber(self.controlArea) self.connect(self.graphButton, SIGNAL("clicked()"), self.menuItemPrinter) #add a graph widget self.header = OWNomogramHeader(None, self.mainArea) self.header.setFixedHeight(60) self.header.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.header.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.graph = OWNomogramGraph(self.bnomogram, self.mainArea) self.graph.setMinimumWidth(200) self.graph.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.footer = OWNomogramHeader(None, self.mainArea) self.footer.setFixedHeight(60*2+10) self.footer.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.footer.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.mainArea.layout().addWidget(self.header) self.mainArea.layout().addWidget(self.graph) self.mainArea.layout().addWidget(self.footer) self.resize(700,500) #self.repaint() #self.update() # mouse pressed flag self.mousepr = False
def __init__(self, parent=None, signalManager=None, title="Venn Diagram"): super(OWVennDiagram, self).__init__(parent, signalManager, title, wantGraph=True) self.autocommit = False # Selected disjoint subset indices self.selection = [] # Stored input set hints # {(index, inputname, attributes): (selectedattrname, itemsettitle)} # The 'selectedattrname' can be None self.inputhints = {} # Use identifier columns for instance matching self.useidentifiers = 1 self.loadSettings() # Output changed flag self._changed = False # Diagram update is in progress self._updating = False # Input update is in progress self._inputUpdate = False # All input tables have the same domain. self.samedomain = True # Input datasets in the order they were 'connected'. self.data = OrderedDict() # Extracted input item sets in the order they were 'connected' self.itemsets = OrderedDict() # GUI box = OWGUI.widgetBox(self.controlArea, "Info") self.info = OWGUI.widgetLabel(box, "No data on input\n") self.identifiersBox = OWGUI.radioButtonsInBox( self.controlArea, self, "useidentifiers", [], box="Data Instance Identifiers", callback=self._on_useidentifiersChanged ) self.useequalityButton = OWGUI.appendRadioButton( self.identifiersBox, self, "useidentifiers", "Use instance equality" ) rb = OWGUI.appendRadioButton( self.identifiersBox, self, "useidentifiers", "Use identifiers" ) self.inputsBox = OWGUI.indentedBox( self.identifiersBox, sep=OWGUI.checkButtonOffsetHint(rb) ) self.inputsBox.setEnabled(self.useidentifiers == 1) for i in range(5): box = OWGUI.widgetBox(self.inputsBox, "Data set #%i" % (i + 1), flat=True) model = OWItemModels.VariableListModel(parent=self) cb = QComboBox() cb.setModel(model) cb.activated[int].connect(self._on_inputAttrActivated) box.setEnabled(False) # Store the combo in the box for later use. box.combo_box = cb box.layout().addWidget(cb) OWGUI.rubber(self.controlArea) box = OWGUI.widgetBox(self.controlArea, "Output") cb = OWGUI.checkBox(box, self, "autocommit", "Commit on any change") b = OWGUI.button(box, self, "Commit", callback=self.commit, default=True) OWGUI.setStopper(self, b, cb, "_changed", callback=self.commit) # Main area view self.scene = QGraphicsScene() self.view = QGraphicsView(self.scene) self.view.setRenderHint(QPainter.Antialiasing) self.view.setBackgroundRole(QPalette.Window) self.view.setFrameStyle(QGraphicsView.StyledPanel) self.mainArea.layout().addWidget(self.view) self.vennwidget = VennDiagram() self.vennwidget.resize(400, 400) self.vennwidget.itemTextEdited.connect(self._on_itemTextEdited) self.scene.selectionChanged.connect(self._on_selectionChanged) self.scene.addItem(self.vennwidget) self.resize(self.controlArea.sizeHint().width() + 550, max(self.controlArea.sizeHint().height(), 550)) self._queue = [] self.graphButton.clicked.connect(self.saveImage)
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()
def __init__(self, parent=None, signalManager=None, title="Molecule visualizer"): super(OWMoleculeVisualizer, self).__init__(parent, signalManager, title) self.colorFragments = 1 self.showFragments = 0 self.selectedFragment = "" self.moleculeSmiles = [] self.fragmentSmiles = [] self.defFragmentSmiles = [] self.smiles_var = 0 self.moleculeTitleAttr = 0 self.moleculeTitleAttributeList = [] self.selectedMoleculeTitleAttrs = [] self.fragmentSmilesAttr = 0 self.imageSize = 200 self.numColumns = 4 self.commitOnChange = 0 ## GUI box = OWGUI.widgetBox(self.controlArea, "Info", addSpace=True) self.infoLabel = OWGUI.label(box, self, "Chemicals:") box = OWGUI.radioButtonsInBox( self.controlArea, self, "showFragments", ["Show molecules", "Show fragments"], "Show", callback=self.updateitems ) self.showFragmentsRadioButton = box.buttons[-1] self.markFragmentsCheckBox = OWGUI.checkBox( box, self, "colorFragments", "Mark fragments", callback=self._update ) box.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum)) OWGUI.separator(self.controlArea) self.moleculeSmilesCombo = OWGUI.comboBox( self.controlArea, self, "smiles_var", "Molecule SMILES Attribute", callback=self.updateitems ) self.moleculeSmilesCombo.box.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum) ) self.smiles_var_model = VariableListModel(parent=self) self.moleculeSmilesCombo.setModel(self.smiles_var_model) OWGUI.separator(self.controlArea) box = OWGUI.widgetBox(self.controlArea, "Molecule Title Attributes", addSpace=True) self.title_var_view = QListView( selectionMode=QListView.ExtendedSelection ) self.title_var_model = VariableListModel(parent=self) self.title_var_view.setModel(self.title_var_model) self.title_var_view.selectionModel().selectionChanged.connect( self._title_selection_changed ) box.layout().addWidget(self.title_var_view) OWGUI.separator(self.controlArea) self.fragmentSmilesCombo = OWGUI.comboBox( self.controlArea, self, "fragmentSmilesAttr", "Fragment SMILES Attribute", callback=self.updateFragmentsListBox ) self.fragmentSmilesCombo.setModel(VariableListModel(parent=self)) self.fragmentSmilesCombo.box.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum) ) OWGUI.separator(self.controlArea) box = OWGUI.spin(self.controlArea, self, "imageSize", 50, 500, 10, box="Image Size", callback=self._image_size_changed) box.setSizePolicy( QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum)) OWGUI.separator(self.controlArea) box = OWGUI.widgetBox(self.controlArea, "Selection", addSpace=True) OWGUI.checkBox(box, self, "commitOnChange", "Commit on change") self.selectMarkedMoleculesButton = OWGUI.button( box, self, "Select &matched molecules", self.select_marked ) OWGUI.button(box, self, "&Commit", callback=self.commit, default=True) OWGUI.separator(self.controlArea) OWGUI.rubber(self.controlArea) spliter = QSplitter(Qt.Vertical) self.scrollArea = ScrollArea(spliter) self.grid = GridWidget() self.grid.selectionChanged.connect(self._on_selection_changed) self.scrollArea.setWidget(self.grid) self.scrollArea.setWidgetResizable(True) self.mainArea.layout().addWidget(spliter) if pybel: self.listBox = QListWidget(spliter) else: self.listBox = QListWidget(None) self.listBox.setHidden(True) self.listBox.itemClicked.connect(self.fragmentSelection) self.fragmentSmilesCombo.box.setDisabled(not pybel) self.data = None self.data_subset = [] self.fragment_data = None self.resize(800, 600) self.listBox.setMaximumHeight(150) self.fragmentSmilesCombo.setDisabled(True) self.selectMarkedMoleculesButton.setDisabled(True) self.markFragmentsCheckBox.setDisabled(True) self.showFragmentsRadioButton.setDisabled(True) self.loadSettings() if not pybel: self.showFragments = 0 self.warning(10, "Pybel module not installed. To view molecule fragments\n" "please install openbabel python extension.") self.__loop = None
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()