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, name='GSEA'): OWWidget.__init__(self, parent, signalManager, name) self.inputs = [("Examples", ExampleTable, self.setData)] self.outputs = [("Examples with selected genes only", ExampleTable), ("Results", ExampleTable), ("Distance Matrix", orange.SymMatrix) ] self.res = None self.dm = None self.name = 'GSEA' self.minSubsetSize = 3 self.minSubsetSizeC = True self.maxSubsetSize = 1000 self.maxSubsetSizeC = True self.minSubsetPart = 10 self.minSubsetPartC = True self.perms = 100 self.csgm = False self.gsgo = False self.gskegg = False self.buildDistances = False self.selectedPhenVar = 0 self.organismIndex = 0 self.atLeast = 3 self.permutationTypes = [("Phenotype", "p"),("Gene", "g") ] self.ptype = 0 self.correlationTypes = [ ("Signal2Noise", "s2n") ] self.ctype = 0 self.data = None self.geneSets = {} self.tabs = OWGUI.tabWidget(self.controlArea) ca = OWGUI.createTabPage(self.tabs, "Basic") box = OWGUI.widgetBox(ca, 'Organism') #FROM KEGG WIDGET - organism selection self.organismTaxids = [] self.organismComboBox = cb = OWGUI.comboBox(box, self, "organismIndex", items=[], debuggingEnabled=0) #changed cb.setMaximumWidth(200) #OWGUI.checkBox(box, self, "csgm", "Case sensitive gene matching") box2 = OWGUI.widgetBox(ca, "Descriptors") self.phenCombo = OWGUI.comboBox(box2, self, "selectedPhenVar", items=[], callback=self.phenComboChange, label="Phenotype:") self.geneCombo = OWGUI.comboBox(box2, self, "selectedGeneVar", items=[], label = "Gene:") self.allowComboChangeCallback = False ma = self.mainArea self.listView = QTreeWidget(ma) ma.layout().addWidget(self.listView) self.listView.setAllColumnsShowFocus(1) self.listView.setColumnCount(9) self.listView.setHeaderLabels(["Collection", "Geneset", "NES", "ES", "P-value", "FDR", "Size", "Matched Size", "Genes"]) self.listView.header().setStretchLastSection(True) self.listView.header().setClickable(True) self.listView.header().setSortIndicatorShown(True) self.listView.setSortingEnabled(True) #self.listView.header().setResizeMode(0, QHeaderView.Stretch) self.listView.setSelectionMode(QAbstractItemView.NoSelection) self.connect(self.listView, SIGNAL("itemSelectionChanged()"), self.newPathwaySelected) OWGUI.separator(ca) OWGUI.widgetLabel(ca, "Phenotype selection:") self.psel = PhenotypesSelection(ca) self.resize(600,50) OWGUI.separator(ca) OWGUI.checkBox(ca, self, "buildDistances", "Compute geneset distances") self.btnApply = OWGUI.button(ca, self, "&Compute", callback = self.compute, disabled=0) fileBox = OWGUI.widgetBox(ca, orientation='horizontal') OWGUI.button(fileBox, self, "Load", callback = self.loadData, disabled=0, debuggingEnabled=0) OWGUI.button(fileBox, self, "Save", callback = self.saveData, disabled=0, debuggingEnabled=0) #ca.layout().addStretch(1) ca = OWGUI.createTabPage(self.tabs, "Gene sets") box = OWGUI.widgetBox(ca) self.gridSel = [] self.geneSel = [] #FIXME temporary disabled - use the same as in new "David" widget self.lbgs = OWGUI.listBox(box, self, "gridSel", "geneSel", selectionMode = QListWidget.MultiSelection) OWGUI.button(box, self, "From &File", callback = self.addCollection, disabled=0, debuggingEnabled=0) box = OWGUI.widgetBox(box, "Additional sources:") OWGUI.checkBox(box, self, "gskegg", "KEGG pathways") OWGUI.checkBox(box, self, "gsgo", "GO terms") #ca.layout().addStretch(1) ca = OWGUI.createTabPage(self.tabs, "Settings") box = OWGUI.widgetBox(ca, 'Properties') self.permTypeF = OWGUI.comboBoxWithCaption(box, self, "ptype", items=nth(self.permutationTypes, 0), \ tooltip="Permutation type.", label="Permute") _ = OWGUI.spin(box, self, "perms", 50, 1000, orientation="horizontal", label="Times") self.corTypeF = OWGUI.comboBoxWithCaption(box, self, "ctype", items=nth(self.correlationTypes, 0), \ tooltip="Correlation type.", label="Correlation") box = OWGUI.widgetBox(ca, 'Subset Filtering') _,_ = OWGUI.checkWithSpin(box, self, "Min. Subset Size", 1, 10000, "minSubsetSizeC", "minSubsetSize", "") #TODO check sizes _,_ = OWGUI.checkWithSpin(box, self, "Max. Subset Size", 1, 10000, "maxSubsetSizeC", "maxSubsetSize", "") _,_ = OWGUI.checkWithSpin(box, self, "Min. Subset Part (%)", 1, 100, "minSubsetPartC", "minSubsetPart", "") box = OWGUI.widgetBox(ca, 'Gene Filtering') _ = OWGUI.spin(box, self, "atLeast", 2, 10, label="Min. Values in Group") ca.layout().addStretch(1) self.addComment("Computation was not started.") if sys.platform == "darwin": self.loadFileName = os.path.expanduser("~/") else: self.loadFileName = "." self.gridSels = [] self.loadSettings() self.setBlocking(True) QTimer.singleShot(0, self.UpdateOrganismComboBox) def cleanInvalid(maxn): """ Removes invalid gene set selection """ notAllOk = True while notAllOk: self.gridSels = getattr(self, "gridSels") notAllOk = False for i,a in enumerate(self.gridSels): if a >= maxn: self.gridSels.pop(i) notAllOk = True break cleanInvalid(len(self.geneSel)) self.gridSel = self.gridSels self.gridSels = self.gridSel
def __init__(self, parent=None, signalManager=None, name="Gene selection"): OWWidget.__init__(self, parent, signalManager, name, wantGraph=True, showSaveGraph=True) self.inputs = [("Examples", ExampleTable, self.set_data)] self.outputs = [("Example table with selected genes", ExampleTable), ("Example table with remaining genes", ExampleTable), ("Selected genes", ExampleTable)] self.method_index = 0 self.genes_in_columns = False self.compute_null = False self.permutations_count = 10 self.auto_commit = False self.selectNBest = 20 self.selectPValue = 0.01 self.data_changed_flag = False self.add_scores_to_output = True self.thresholds = { "fold change": (0.5, 2.), "log2 fold change": (-1, 1), "t-test": (-2, 2), "t-test p-value": (0.01, 0.01), } self.oneTailTestHi = oneTailTestHi = lambda array, low, hi: array >= hi self.oneTailTestLow = oneTailTestLow = lambda array, low, hi: array <= low self.twoTailTest = twoTailTest = lambda array, low, hi: (array >= hi) | (array <= low) self.middleTest = middleTest = lambda array, low, hi: (array <= hi) | (array >= low) self.histType = {oneTailTestHi:"hiTail", oneTailTestLow:"lowTail", twoTailTest:"twoTail", middleTest:"middle"} # [(name, func, tail test, two sample test), ...] self.score_methods = [("fold change", ExpressionSignificance_FoldChange, twoTailTest, True), ("log2 fold change", ExpressionSignificance_Log2FoldChange, twoTailTest, True), ("t-test", ExpressionSignificance_TTest_T, twoTailTest, True), ("t-test p-value", ExpressionSignificance_TTest_PValue, oneTailTestLow, True), ("anova", ExpressionSignificance_ANOVA_F, oneTailTestHi, False), ("anova p-value", ExpressionSignificance_ANOVA_PValue, oneTailTestLow, False), ("signal to noise ratio", ExpressionSignificance_SignalToNoise, twoTailTest, True), ("info gain", ExpressionSignificance_Info, oneTailTestHi, True), ("chi-square", ExpressionSignificance_ChiSquare, oneTailTestHi, True), ("mann-whitney", ExpressionSignigicance_MannWhitneyu_U, oneTailTestLow, True)] boxHistogram = OWGUI.widgetBox(self.mainArea) self.histogram = ScoreHist(self, boxHistogram) boxHistogram.layout().addWidget(self.histogram) self.histogram.show() box = OWGUI.widgetBox(self.controlArea, "Info") self.dataInfoLabel = OWGUI.widgetLabel(box, "\n\n") self.dataInfoLabel.setWordWrap(True) self.selectedInfoLabel = OWGUI.widgetLabel(box, "") box1 = OWGUI.widgetBox(self.controlArea, "Scoring Method") self.testRadioBox = OWGUI.comboBox(box1, self, "method_index", items=[sm[0] for sm in self.score_methods], callback=[self.on_scoring_method_changed, self.update_scores]) box = OWGUI.widgetBox(self.controlArea, "Target Labels") self.label_selection_widget = LabelSelectionWidget(self) self.label_selection_widget.setMaximumHeight(150) box.layout().addWidget(self.label_selection_widget) self.connect(self.label_selection_widget, SIGNAL("selection_changed()"), self.on_target_changed) self.connect(self.label_selection_widget, SIGNAL("label_activated(int)"), self.on_label_activated) self.genes_in_columns_check = OWGUI.checkBox(box, self, "genes_in_columns", "Genes in columns", callback=self.on_genes_in_columns_change) box = OWGUI.widgetBox(self.controlArea, "Selection") box.layout().setSpacing(0) self.upperBoundarySpin = OWGUI.doubleSpin(box, self, "histogram.upperBoundary", min=-1e6, max=1e6, step= 1e-6, label="Upper threshold:", callback=self.update_boundary, callbackOnReturn=True) self.lowerBoundarySpin = OWGUI.doubleSpin(box, self, "histogram.lowerBoundary", min=-1e6, max=1e6, step= 1e-6, label="Lower threshold:", callback=self.update_boundary, callbackOnReturn=True) check = OWGUI.checkBox(box, self, "compute_null", "Compute null distribution", callback=self.update_scores) check.disables.append(OWGUI.spin(box, self, "permutations_count", min=1, max=10, label="Permutations:", callback=self.update_scores, callbackOnReturn=True)) box1 = OWGUI.widgetBox(box, orientation='horizontal') check.disables.append(OWGUI.doubleSpin(box1, self, "selectPValue", min=2e-7, max=1.0, step=1e-7, label="P-value:")) check.disables.append(OWGUI.button(box1, self, "Select", callback=self.select_p_best)) check.makeConsistent() box1 = OWGUI.widgetBox(box, orientation='horizontal') OWGUI.spin(box1, self, "selectNBest", 0, 10000, step=1, label="Best Ranked:") OWGUI.button(box1, self, "Select", callback=self.select_n_best) box = OWGUI.widgetBox(self.controlArea, "Output") b = OWGUI.button(box, self, "&Commit", callback=self.commit) cb = OWGUI.checkBox(box, self, "auto_commit", "Commit on change") OWGUI.setStopper(self, b, cb, "data_changed_flag", self.commit) OWGUI.checkBox(box, self, "add_scores_to_output", "Add gene scores to output", callback=self.commit_if) OWGUI.rubber(self.controlArea) self.connect(self.graphButton, SIGNAL("clicked()"), self.histogram.saveToFile) self.loadSettings() self.data = None self.discData = None self.scoreCache = {} self.nullDistCache = {} self.cuts = {} self.null_dist = [] self.targets = [] self.scores = {} self.genes_in_columns = True self.target_selections = None self.on_scoring_method_changed() self.resize(800, 600)
def __init__(self, parent=None, signalManager=None, name="Gene selection"): OWWidget.__init__(self, parent, signalManager, name, wantGraph=True, showSaveGraph=True) self.inputs = [("Examples", ExampleTable, self.set_data)] self.outputs = [("Example table with selected genes", ExampleTable), ("Example table with remaining genes", ExampleTable), ("Selected genes", ExampleTable)] self.method_index = 0 self.genes_in_columns = False self.compute_null = False self.permutations_count = 10 self.auto_commit = False self.selectNBest = 20 self.selectPValue = 0.01 self.data_changed_flag = False self.add_scores_to_output = True self.thresholds = { "fold change": (0.5, 2.), "log2 fold change": (-1, 1), "t-test": (-2, 2), "t-test p-value": (0.01, 0.01), } self.oneTailTestHi = oneTailTestHi = lambda array, low, hi: array >= hi self.oneTailTestLow = oneTailTestLow = lambda array, low, hi: array <= low self.twoTailTest = twoTailTest = lambda array, low, hi: ( array >= hi) | (array <= low) self.middleTest = middleTest = lambda array, low, hi: (array <= hi) | ( array >= low) self.histType = { oneTailTestHi: "hiTail", oneTailTestLow: "lowTail", twoTailTest: "twoTail", middleTest: "middle" } # [(name, func, tail test, two sample test), ...] self.score_methods = [ ("fold change", ExpressionSignificance_FoldChange, twoTailTest, True), ("log2 fold change", ExpressionSignificance_Log2FoldChange, twoTailTest, True), ("t-test", ExpressionSignificance_TTest_T, twoTailTest, True), ("t-test p-value", ExpressionSignificance_TTest_PValue, oneTailTestLow, True), ("anova", ExpressionSignificance_ANOVA_F, oneTailTestHi, False), ("anova p-value", ExpressionSignificance_ANOVA_PValue, oneTailTestLow, False), ("signal to noise ratio", ExpressionSignificance_SignalToNoise, twoTailTest, True), ("info gain", ExpressionSignificance_Info, oneTailTestHi, True), ("chi-square", ExpressionSignificance_ChiSquare, oneTailTestHi, True), ("mann-whitney", ExpressionSignigicance_MannWhitneyu_U, oneTailTestLow, True) ] boxHistogram = OWGUI.widgetBox(self.mainArea) self.histogram = ScoreHist(self, boxHistogram) boxHistogram.layout().addWidget(self.histogram) self.histogram.show() box = OWGUI.widgetBox(self.controlArea, "Info") self.dataInfoLabel = OWGUI.widgetLabel(box, "\n\n") self.dataInfoLabel.setWordWrap(True) self.selectedInfoLabel = OWGUI.widgetLabel(box, "") box1 = OWGUI.widgetBox(self.controlArea, "Scoring Method") self.testRadioBox = OWGUI.comboBox( box1, self, "method_index", items=[sm[0] for sm in self.score_methods], callback=[self.on_scoring_method_changed, self.update_scores]) box = OWGUI.widgetBox(self.controlArea, "Target Labels") self.label_selection_widget = LabelSelectionWidget(self) self.label_selection_widget.setMaximumHeight(150) box.layout().addWidget(self.label_selection_widget) self.connect(self.label_selection_widget, SIGNAL("selection_changed()"), self.on_target_changed) self.connect(self.label_selection_widget, SIGNAL("label_activated(int)"), self.on_label_activated) self.genes_in_columns_check = OWGUI.checkBox( box, self, "genes_in_columns", "Genes in columns", callback=self.on_genes_in_columns_change) box = OWGUI.widgetBox(self.controlArea, "Selection") box.layout().setSpacing(0) self.upperBoundarySpin = OWGUI.doubleSpin( box, self, "histogram.upperBoundary", min=-1e6, max=1e6, step=1e-6, label="Upper threshold:", callback=self.update_boundary, callbackOnReturn=True) self.lowerBoundarySpin = OWGUI.doubleSpin( box, self, "histogram.lowerBoundary", min=-1e6, max=1e6, step=1e-6, label="Lower threshold:", callback=self.update_boundary, callbackOnReturn=True) check = OWGUI.checkBox(box, self, "compute_null", "Compute null distribution", callback=self.update_scores) check.disables.append( OWGUI.spin(box, self, "permutations_count", min=1, max=10, label="Permutations:", callback=self.update_scores, callbackOnReturn=True)) box1 = OWGUI.widgetBox(box, orientation='horizontal') check.disables.append( OWGUI.doubleSpin(box1, self, "selectPValue", min=2e-7, max=1.0, step=1e-7, label="P-value:")) check.disables.append( OWGUI.button(box1, self, "Select", callback=self.select_p_best)) check.makeConsistent() box1 = OWGUI.widgetBox(box, orientation='horizontal') OWGUI.spin(box1, self, "selectNBest", 0, 10000, step=1, label="Best Ranked:") OWGUI.button(box1, self, "Select", callback=self.select_n_best) box = OWGUI.widgetBox(self.controlArea, "Output") b = OWGUI.button(box, self, "&Commit", callback=self.commit) cb = OWGUI.checkBox(box, self, "auto_commit", "Commit on change") OWGUI.setStopper(self, b, cb, "data_changed_flag", self.commit) OWGUI.checkBox(box, self, "add_scores_to_output", "Add gene scores to output", callback=self.commit_if) OWGUI.rubber(self.controlArea) self.connect(self.graphButton, SIGNAL("clicked()"), self.histogram.saveToFile) self.loadSettings() self.data = None self.discData = None self.scoreCache = {} self.nullDistCache = {} self.cuts = {} self.null_dist = [] self.targets = [] self.scores = {} self.genes_in_columns = True self.target_selections = None self.on_scoring_method_changed() self.resize(800, 600)
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="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