コード例 #1
0
ファイル: RedRscale.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["scale"])
        self.data = {}
        self.RFunctionParam_x = ''
        self.inputs.addInput('id0', _('Input Data'), redRDataFrame,
                             self.processx)

        self.outputs.addOutput('id0', _('scale Output'), redRDataFrame)

        self.roworcol = radioButtons(self.controlArea,
                                     label=_('Apply Scaling To:'),
                                     buttons=[_('Rows'),
                                              _('Columns')],
                                     setChecked=_('Columns'),
                                     orientation='horizontal')
        self.RFunctionParamscale_radioButtons = radioButtons(
            self.controlArea,
            label=_("Scale:"),
            buttons=[_('Yes'), _('No')],
            setChecked=_('No'),
            orientation='horizontal')
        self.RFunctionParamcenter_radioButtons = radioButtons(
            self.controlArea,
            label=_("Center:"),
            buttons=[_('Yes'), _('No')],
            setChecked=_('No'),
            orientation='horizontal')
        redRCommitButton(self.bottomAreaRight,
                         _("Commit"),
                         callback=self.commitFunction)
コード例 #2
0
ファイル: RedReigen.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["eigen"])
        self.data = {}
        self.RFunctionParam_x = ''
        self.inputs.addInput('id0', _('Input Data'), redRRMatrix,
                             self.processx)

        self.outputs.addOutput('id0', _('Eigen Output'), redRRList)

        self.RFunctionParamsymmetric_radioButtons = radioButtons(
            self.controlArea,
            label=_("symmetric:"),
            buttons=[_('Yes'), _('No')],
            setChecked=_('Yes'))
        self.RFunctionParamonly_values_radioButtons = radioButtons(
            self.controlArea,
            label=_("only_values:"),
            buttons=[_('Yes'), _('No')],
            setChecked=_('Yes'))
        self.RFunctionParamEISPACK_radioButtons = radioButtons(
            self.controlArea,
            label=_("EISPACK:"),
            buttons=[_('Yes'), _('No')],
            setChecked=_('Yes'))
        button(self.bottomAreaRight, _("Commit"), callback=self.commitFunction)
コード例 #3
0
    def loadCustomSettings(self, settings):
        # import pprint
        # pp = pprint.PrettyPrinter(indent=4)
        # pp.pprint(settings)
        # print settings['colClasses']['pythonObject']
        # self.colClasses = settings['colClasses']['pythonObject']
        # self.colNames = settings['colNames']['pythonObject']
        # self.myColClasses = settings['myColClasses']['list']
        if not self.filecombo.getCurrentFile():
            widgetLabel(
                self.browseBox,
                label=
                _('The loaded file is not found on your computer.\nBut the data saved in the Red-R session is still available.'
                  ))
        # print '#############################', self.colClasses
        # print '#############################', self.colNames
        # print '#############################', self.myColClasses #, settings['myColClasses']['list']
        for i in range(len(self.colClasses)):
            s = radioButtons(self.columnTypes,
                             label=self.colNames[i],
                             displayLabel=False,
                             buttons=[
                                 'factor', 'numeric', 'character', 'integer',
                                 'logical'
                             ],
                             orientation='horizontal',
                             callback=self.updateColClasses)

            s.setChecked(self.myColClasses[i])
            if not self.filecombo.getCurrentFile():
                s.setEnabled(False)
            q = widgetLabel(self.columnTypes, label=self.colNames[i])
            self.columnTypes.layout().addWidget(s.controlArea, i, 1)
            self.columnTypes.layout().addWidget(q.controlArea, i, 0)
コード例 #4
0
ファイル: RedRplsr.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["plsr"])
        self.data = {}
        self.RFunctionParam_data = ''
        self.inputs.addInput('id0', 'data', redRRDataFrame, self.processdata)

        self.outputs.addOutput('id0', 'plsr Output', redRRModelFit)

        self.RFunctionParamformula_lineEdit = lineEdit(self.controlArea,
                                                       label="formula:",
                                                       text='')
        self.RFunctionParamscale_radioButtons = radioButtons(
            self.controlArea,
            label="Scale the data:",
            buttons=['TRUE', 'FALSE'],
            setChecked='FALSE',
            orientation='horizontal')
        self.RFunctionParammethod_lineEdit = lineEdit(self.controlArea,
                                                      label="method:",
                                                      text='')
        self.RFunctionParamncomp_lineEdit = lineEdit(self.controlArea,
                                                     label="ncomp:",
                                                     text='10')
        self.RFunctionParamvalidation_comboBox = comboBox(
            self.controlArea, label="validation:", items=["none", "CV", "LOO"])
        redRCommitButton(self.bottomAreaRight,
                         "Commit",
                         callback=self.commitFunction)
コード例 #5
0
ファイル: rownames.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["rownames"])
        self.data = {}

        self.RFunctionParam_x = ''
        self.inputs.addInput('id0', _('Input Data'), redRRDataFrame,
                             self.processx)

        self.outputs.addOutput('id0', _('Row or Column Names'), redRRVector)

        box = widgetBox(self.controlArea)
        self.controlArea.layout().setAlignment(box, Qt.AlignTop | Qt.AlignLeft)
        widgetLabel(box, _('Get row or column names from input object.'))
        separator(box, height=10)
        self.function = radioButtons(
            box,
            label=_('Row or Column'),
            displayLabel=False,
            buttons=[_('Row Names'), _('Column Names')],
            setChecked=_('Row Names'),
            orientation='horizontal')
        separator(box, height=10)

        self.RFunctionParamprefix_lineEdit = lineEdit(
            box,
            label=_("prefix:"),
            toolTip=_('Prepend prefix to simple numbers when creating names.'))
        separator(box, height=10)

        self.doNullButton = radioButtons(
            box,
            label=_("do.NULL:"),
            toolTips=[
                _('logical. Should this create names if they are NULL?')
            ] * 2,
            buttons=[_('TRUE'), _('FALSE')],
            setChecked=_('TRUE'),
            orientation='horizontal')
        buttonBox = widgetBox(box, orientation='horizontal')
        redRCommitButton(buttonBox, _("Commit"), callback=self.commitFunction)
        self.autoCommit = checkBox(buttonBox,
                                   label=_('commit'),
                                   displayLabel=False,
                                   buttons=[_('Commit on Input')],
                                   setChecked=[_('Commit on Input')])
コード例 #6
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["strsplit", "dataframe"])
        self.data = {}
        self.RFunctionParam_x = ''
        self.inputs.addInput('id0', _('Input Data'), redRRVector,
                             self.processx)

        self.outputs.addOutput('id0', _('strsplit Output'), redRRList)
        self.outputs.addOutput('id1', _('strsplit Vector'), redRRVector)
        self.outputs.addOutput('dataframe', _('Data Table'), redRDataFrame)

        self.RFunctionParamsplit_lineEdit = lineEdit(
            self.controlArea, label=_("Split Text Using:"), text='')
        self.RFunctionParamfixed_radioButtons = radioButtons(
            self.controlArea,
            label=_("fixed:"),
            buttons=[
                _('Use text exactly'),
                _('Use text as expression (Advanced)')
            ],
            setChecked=_('Use text exactly'),
            orientation='horizontal')
        self.RFunctionParamextended_radiButtons = radioButtons(
            self.controlArea,
            label=_("Extend Expressions:"),
            buttons=[_('Yes'), _('No')],
            setChecked=_('No'),
            orientation='horizontal')
        self.RFunctionParamperl_radioButtons = radioButtons(
            self.controlArea,
            label=_("Use Perl Expressions:"),
            buttons=[_('Yes'), _('No')],
            setChecked=_('No'),
            orientation='horizontal')
        self.RFunctionParamunlist_radioButtons = radioButtons(
            self.controlArea,
            label=_('Convert to RVector'),
            buttons=[_('Send only the list'),
                     _('Send list and vector')],
            setChecked=_('Send list and vector'),
            orientation='horizontal')
        redRCommitButton(self.bottomAreaRight,
                         _("Commit"),
                         callback=self.commitFunction)
コード例 #7
0
ファイル: heatmap2.py プロジェクト: MatthewASimonson/r-orange
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        
        self.setRvariableNames(['heatsubset'])
        self.plotOnConnect = 0
        self.plotdata = ''
        self.rowvChoice = None
        
        self.inputs.addInput('id0', 'Expression Matrix', redRRMatrix, self.processMatrix)

        
        #GUI
        mainArea = widgetBox(self.controlArea,orientation='horizontal')
        #mainArea.setMaximumWidth(300)
        options = widgetBox(mainArea,orientation='vertical')
        options.setMaximumWidth(175)
        options.setMinimumWidth(175)
        dendrogramsBox = groupBox(options, label='Calculate dendrogram ', orientation='vertical')
        self.notice = widgetLabel(dendrogramsBox,label='The data set has > 1000 rows.\nClustering on rows will likely fail.')
        self.notice.setHidden(True)
        self.dendrogramOptions = checkBox(dendrogramsBox,
        buttons = ['Rows', 'Columns'], setChecked=['Rows', 'Columns'], orientation='horizontal',
        callback=self.dendrogramChanged)
        
        functions = widgetBox(dendrogramsBox,orientation='vertical')
        self.distOptions = lineEdit(functions,label='Distance Function:', text='dist', orientation='vertical')
        self.hclustOptions = lineEdit(functions,label='Clustering Function:',text='hclust', 
        orientation='vertical')
        #self.reorderOptions = lineEdit(functions,label='Reorder Function:', text='reorder.dendrogram')
        
        
        self.scaleOptions = radioButtons(options,label='Scale',  buttons=['row','column','none'],
        setChecked='row',orientation='horizontal')
        
        otherOptions = groupBox(options,label='Other Options')
        self.narmOptions = checkBox(otherOptions, buttons = ['Remove NAs'], setChecked=['Remove NAs'])
        # self.showDendroOptions = checkBox(otherOptions,buttons=['Show dendrogram '], setChecked=['Show dendrogram '])
        
        self.colorTypeCombo = comboBox(otherOptions, label = 'Color Type:', 
        items = ['rainbow', 'heat.colors', 'terrain.colors', 'topo.colors', 'cm.colors'],callback=self.colorTypeChange)
        self.startSaturation = spinBox(otherOptions, label = 'Starting Saturation', min = 0, max = 100)
        self.endSaturation = spinBox(otherOptions, label = 'Ending Saturation', min = 0, max = 100)
        self.endSaturation.setValue(30)
        separator(otherOptions,height=10)

        self.imageWidth = spinBox(otherOptions, label = 'Image Width', min = 1, max = 1000)
        self.imageWidth.setValue(4)
        self.imageHeight = spinBox(otherOptions, label = 'Image Height', min = 1, max = 1000)
        self.imageHeight.setValue(4)
        
        
        self.notice2 = widgetLabel(options,label='The input matrix is not numeric.')
        self.notice2.setHidden(True)
        self.buttonsBox = widgetBox(options,orientation='horizontal')
        self.buttonsBox.layout().setAlignment(Qt.AlignRight)
        self.plotOnConnect = checkBox(self.buttonsBox, buttons=['Plot on Connect'])
        button(self.buttonsBox, label = "Plot", callback=self.makePlot)
コード例 #8
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["apply"])
        self.numDims = 2
        self.data = None
        self.inputs.addInput('id0', _('X'), redRRMatrix, self.processX)

        self.outputs.addOutput('id0', _('apply Output'), redRRDataFrame)

        area = widgetBox(self.controlArea, orientation='horizontal')

        box = widgetBox(area)
        box.setMinimumWidth(200)
        area.layout().setAlignment(box, Qt.AlignLeft)

        self.functions = listBox(
            box,
            label=_("Select Function"),
            items=['mean', 'median', 'max', 'min', 'sum', 'log2', 'log10'],
            callback=self.functionSelect)
        self.functions.setSelectionMode(QAbstractItemView.SingleSelection)

        separator(box, height=10)
        self.functionText = redRTextEdit(box,
                                         label=_('Function:'),
                                         orientation='vertical')
        self.parameters = redRLineEdit(box,
                                       label=_('Additional Parameters:'),
                                       orientation='vertical')

        self.demension = radioButtons(box,
                                      label=_("To:"),
                                      buttons=[_('Rows'),
                                               _('Columns'),
                                               _('')],
                                      setChecked=_('Rows'),
                                      orientation='horizontal',
                                      callback=lambda: self.dimensionChange(1))
        self.indexSpinBox = RedRSpinBox(
            self.demension.box,
            label=_('Demension'),
            displayLabel=False,
            min=1,
            value=1,
            callback=lambda: self.dimensionChange(2))
        buttonBox = widgetBox(box, orientation='horizontal')

        self.commit = redRCommitButton(buttonBox,
                                       _("Commit"),
                                       alignment=Qt.AlignLeft,
                                       callback=self.commitFunction,
                                       processOnInput=True,
                                       processOnChange=True)

        self.outputTable = redRFilterTable(area,
                                           label=_('Results of Apply'),
                                           sortable=True)
コード例 #9
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["intersect"])
        self.dataA = None
        self.dataB = None

        self.inputs.addInput('id0', _('Input Data A'), redRRList,
                             self.processA)
        self.inputs.addInput('id1', _('Input Data B'), redRRList,
                             self.processB)

        self.outputs.addOutput('id0', _('intersect Output'), redRRVector)

        box = widgetBox(self.controlArea, orientation='vertical')
        dataSetBox = widgetBox(box, orientation='horizontal')
        #pickA = groupBox(dataSetBox, "Dataset A:")
        self.colA = listBox(dataSetBox,
                            label=_('Input Data A'),
                            callback=self.onSelect)

        #pickB = groupBox(dataSetBox, "Dataset B:")
        self.colB = listBox(dataSetBox,
                            label=_('Input Data B'),
                            callback=self.onSelect)

        self.resultInfo = textEdit(box,
                                   label=_('Results'),
                                   displayLabel=False,
                                   includeInReports=False,
                                   editable=False,
                                   alignment=Qt.AlignHCenter)
        self.resultInfo.setMaximumWidth(170)
        self.resultInfo.setMaximumHeight(25)
        self.resultInfo.setMinimumWidth(170)
        self.resultInfo.setMinimumHeight(25)
        #box.layout().setAlignment(self.resultInfo,Qt.AlignHCenter)
        self.resultInfo.hide()
        self.type = radioButtons(self.bottomAreaLeft,
                                 label=_("Perform"),
                                 buttons=[
                                     _('Intersect'),
                                     _('Union'),
                                     _('Set Difference'),
                                     _('Set Equal')
                                 ],
                                 setChecked=_('Intersect'),
                                 orientation='horizontal',
                                 callback=self.onTypeSelect)

        commitBox = widgetBox(self.bottomAreaRight, orientation='horizontal')
        self.bottomAreaRight.layout().setAlignment(commitBox, Qt.AlignBottom)

        self.commit = redRCommitButton(commitBox,
                                       _("Commit"),
                                       callback=self.commitFunction,
                                       processOnChange=True,
                                       processOnInput=True)
コード例 #10
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        
        # self.dataParentA = {}
        # self.dataParentB = {}
        self.dataA = ''
        self.dataB = ''
        
        
        self.inputs.addInput('id0', _('Dataset A'), redRRDataFrame, self.processA)
        self.inputs.addInput('id1', _('Dataset B'), redRRDataFrame, self.processB)

        self.outputs.addOutput('id0', _('Merged'), redRRDataFrame)

        #default values        
        self.colAsel = None
        self.colBsel = None
        #self.forceMergeAll = 0 #checkbox value for forcing merger on all data, default is to remove instances from the rows or cols.
        
        #set R variable names
        self.setRvariableNames(['merged'])
                
        #GUI
        box = widgetBox(self.controlArea,orientation='horizontal')
    
        self.colA = listBox(box, label=_('Columns to Merge From A'), callback = self.setcolA)
        self.colB = listBox(box, label=_('Columns to Merge From B'),  callback = self.setcolB)
        

        self.sortOption = checkBox(self.bottomAreaLeft, label=_('Sort by Selected Column'), displayLabel=False, 
        buttons = [_('Sort by Selected Column')], 
        toolTips = [_('logical. Should the results be sorted on the by columns?')])
        self.rownamesOption = checkBox(self.bottomAreaLeft, label = _('Include Row Names in Merge'), displayLabel = False, buttons = [_('Include Row in Merge')], toolTips = [_('This will include the row names in the data after merge.')], setChecked = [_('Include Row in Merge')])
        self.sortOption.layout().setAlignment(Qt.AlignLeft)
        
        self.mergeOptions = radioButtons(self.bottomAreaCenter,label=_('Type of merge'), displayLabel=False,
        buttons=['A+B','B+A','AB'],setChecked='A+B',
        orientation='horizontal')
        
        self.mergeOptions.layout().setAlignment(Qt.AlignCenter) 
        
        self.commit = redRCommitButton(self.bottomAreaRight, _('Commit'), callback = self.run, 
        processOnChange=True,processOnInput=True)
コード例 #11
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["fft"])
        self.data = {}
        self.RFunctionParam_z = ''
        self.isNumeric = False
        self.inputs.addInput('id0', 'z', redRRMatrix, self.processz)

        self.outputs.addOutput('id0', 'fft Output', redRRMatrix)

        self.RFunctionParaminverse_radioBox = radioButtons(
            self.controlArea,
            label="inverse:",
            buttons=["Yes", "No"],
            setChecked="No")

        self.commit = redRCommitButton(self.bottomAreaRight,
                                       "Commit",
                                       callback=self.commitFunction,
                                       processOnInput=True)
コード例 #12
0
ファイル: heatmap2.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)

        self.setRvariableNames(['heatsubset'])
        self.plotOnConnect = 0
        self.plotdata = ''
        self.rowvChoice = None

        self.inputs.addInput('id0', 'Expression Matrix', redRRMatrix,
                             self.processMatrix)

        #GUI
        mainArea = widgetBox(self.controlArea, orientation='horizontal')
        #mainArea.setMaximumWidth(300)
        options = widgetBox(mainArea, orientation='vertical')
        options.setMaximumWidth(175)
        options.setMinimumWidth(175)
        dendrogramsBox = groupBox(options,
                                  label='Calculate dendrogram ',
                                  orientation='vertical')
        self.notice = widgetLabel(
            dendrogramsBox,
            label=
            'The data set has > 1000 rows.\nClustering on rows will likely fail.'
        )
        self.notice.setHidden(True)
        self.dendrogramOptions = checkBox(dendrogramsBox,
                                          buttons=['Rows', 'Columns'],
                                          setChecked=['Rows', 'Columns'],
                                          orientation='horizontal',
                                          callback=self.dendrogramChanged)

        functions = widgetBox(dendrogramsBox, orientation='vertical')
        self.distOptions = lineEdit(functions,
                                    label='Distance Function:',
                                    text='dist',
                                    orientation='vertical')
        self.hclustOptions = lineEdit(functions,
                                      label='Clustering Function:',
                                      text='hclust',
                                      orientation='vertical')
        #self.reorderOptions = lineEdit(functions,label='Reorder Function:', text='reorder.dendrogram')

        self.scaleOptions = radioButtons(options,
                                         label='Scale',
                                         buttons=['row', 'column', 'none'],
                                         setChecked='row',
                                         orientation='horizontal')

        otherOptions = groupBox(options, label='Other Options')
        self.narmOptions = checkBox(otherOptions,
                                    buttons=['Remove NAs'],
                                    setChecked=['Remove NAs'])
        # self.showDendroOptions = checkBox(otherOptions,buttons=['Show dendrogram '], setChecked=['Show dendrogram '])

        self.colorTypeCombo = comboBox(otherOptions,
                                       label='Color Type:',
                                       items=[
                                           'rainbow', 'heat.colors',
                                           'terrain.colors', 'topo.colors',
                                           'cm.colors'
                                       ],
                                       callback=self.colorTypeChange)
        self.startSaturation = spinBox(otherOptions,
                                       label='Starting Saturation',
                                       min=0,
                                       max=100)
        self.endSaturation = spinBox(otherOptions,
                                     label='Ending Saturation',
                                     min=0,
                                     max=100)
        self.endSaturation.setValue(30)
        separator(otherOptions, height=10)

        self.imageWidth = spinBox(otherOptions,
                                  label='Image Width',
                                  min=1,
                                  max=1000)
        self.imageWidth.setValue(4)
        self.imageHeight = spinBox(otherOptions,
                                   label='Image Height',
                                   min=1,
                                   max=1000)
        self.imageHeight.setValue(4)

        self.notice2 = widgetLabel(options,
                                   label='The input matrix is not numeric.')
        self.notice2.setHidden(True)
        self.buttonsBox = widgetBox(options, orientation='horizontal')
        self.buttonsBox.layout().setAlignment(Qt.AlignRight)
        self.plotOnConnect = checkBox(self.buttonsBox,
                                      buttons=['Plot on Connect'])
        button(self.buttonsBox, label="Plot", callback=self.makePlot)
コード例 #13
0
    def updateScan(self):
        if self.rowNamesCombo.count() == 0:
            self.colNames = self.R('colnames(' +
                                   self.Rvariables['dataframe_org'] + ')',
                                   wantType='list')
            self.rowNamesCombo.clear()
            self.rowNamesCombo.addItem('NULL', 'NULL')
            for x in self.colNames:
                self.rowNamesCombo.addItem(x, x)
        self.scanarea.clear()
        # print self.R(self.Rvariables['dataframe_org'])
        # return

        data = self.R('rbind(colnames(' + self.Rvariables['dataframe_org'] +
                      '), as.matrix(' + self.Rvariables['dataframe_org'] +
                      '))',
                      wantType='list')
        rownames = self.R('rownames(' + self.Rvariables['dataframe_org'] + ')',
                          wantType='list')
        #print data
        txt = self.html_table(data, rownames)
        # print 'paste(capture.output(' + self.Rvariables['dataframe_org'] +'),collapse="\n")'
        # try:
        #txt = self.R('paste(capture.output(' + self.Rvariables['dataframe_org'] +'),collapse="\n")',processingNotice=True, showException=False)
        # txt = self.R(self.Rvariables['dataframe_org'],processingNotice=True, showException=False)

        self.scanarea.setText(txt)
        # except:
        # QMessageBox.information(self,'R Error', _("Try selected a different Column Seperator."),
        # QMessageBox.Ok + QMessageBox.Default)
        # return

        try:
            if len(self.colClasses) == 0:
                self.colClasses = self.R('as.vector(sapply(' +
                                         self.Rvariables['dataframe_org'] +
                                         ',class))',
                                         wantType='list')
                self.myColClasses = self.colClasses
                # print '@@@@@@@@@@@@@@@@@@@@@@@@@', self.myColClasses
            if len(self.dataTypes) == 0:
                types = [
                    'factor', 'numeric', 'character', 'integer', 'logical'
                ]
                self.dataTypes = []

                for k, i, v in zip(range(len(self.colNames)), self.colNames,
                                   self.myColClasses):
                    s = radioButtons(self.columnTypes,
                                     label=i,
                                     displayLabel=False,
                                     buttons=types,
                                     orientation='horizontal',
                                     callback=self.updateColClasses)

                    # print k,i,unicode(v)
                    if unicode(v) in types:
                        s.setChecked(unicode(v))
                    else:
                        s.addButton(unicode(v))
                        s.setChecked(unicode(v))
                    label = widgetLabel(None, label=i)
                    self.columnTypes.layout().addWidget(
                        label.controlArea, k, 0)
                    self.columnTypes.layout().addWidget(s.controlArea, k, 1)

                    self.dataTypes.append([i, s])
        except:
            import redRLog
            redRLog.log(redRLog.REDRCORE, redRLog.ERROR,
                        redRLog.formatException())
            self.scanarea.clear()
            self.scanarea.setText(
                _('Problem reading or scanning the file.  Please check the file integrity and try again.'
                  ))
コード例 #14
0
    def __init__(self, parent=None, signalManager=None):

        OWRpy.__init__(self)
        self.path = os.path.abspath('/')
        self.colClasses = []
        self.myColClasses = []
        self.colNames = []
        self.dataTypes = []
        self.useheader = 1

        #set R variable names
        self.setRvariableNames(
            ['dataframe_org', 'dataframe_final', 'filename', 'parent'])

        #signals
        self.outputs.addOutput(
            'od1', _('Output Data'),
            rdf.RDataFrame)  #[("data.frame", rdf.RDataFrame)]
        #GUI
        area = widgetBox(self.controlArea,
                         orientation='horizontal',
                         alignment=Qt.AlignTop)
        #area.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding ,QSizePolicy.MinimumExpanding))
        #area.layout().setAlignment(Qt.AlignTop)
        options = widgetBox(area, orientation='vertical')
        options.setMaximumWidth(300)
        # options.setMinimumWidth(300)
        options.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        #area.layout().setAlignment(options,Qt.AlignTop)

        self.browseBox = groupBox(options,
                                  label=_("Load File"),
                                  addSpace=True,
                                  orientation='vertical')
        box = widgetBox(self.browseBox, orientation='horizontal')
        self.filecombo = fileNamesComboBox(box,
                                           label=_('Files'),
                                           displayLabel=False,
                                           orientation='horizontal',
                                           callback=self.scanNewFile)
        self.filecombo.setSizePolicy(QSizePolicy.MinimumExpanding,
                                     QSizePolicy.Minimum)
        button(box, label=_('Browse'), callback=self.browseFile)

        self.fileType = radioButtons(options,
                                     label=_('File Type'),
                                     buttons=[_('Text'), _('Excel')],
                                     setChecked=_('Text'),
                                     callback=self.scanNewFile,
                                     orientation='horizontal')
        self.fileType.setSizePolicy(QSizePolicy.MinimumExpanding,
                                    QSizePolicy.Minimum)
        self.fileType.hide()

        self.delimiter = radioButtons(
            options,
            label=_('Column Seperator'),
            buttons=[_('Tab'), _('Comma'),
                     _('Space'), _('Other')],
            setChecked=_('Tab'),
            callback=self.scanNewFile,
            orientation='horizontal')

        self.otherSepText = lineEdit(self.delimiter.box,
                                     label=_('Seperator'),
                                     displayLabel=False,
                                     text=';',
                                     width=20,
                                     orientation='horizontal')
        QObject.connect(self.otherSepText,
                        SIGNAL('textChanged(const QString &)'), self.otherSep)

        self.headersBox = groupBox(options,
                                   label=_("Row and Column Names"),
                                   addSpace=True,
                                   orientation='horizontal')

        self.hasHeader = checkBox(
            self.headersBox,
            label=_('Column Header'),
            displayLabel=False,
            buttons=[_('Column Headers')],
            setChecked=[_('Column Headers')],
            toolTips=[
                _('a logical value indicating whether the file contains the names of the variables as its first line. If missing, the value is determined from the file format: header is set to TRUE if and only if the first row contains one fewer field than the number of columns.'
                  )
            ],
            orientation='vertical',
            callback=self.scanNewFile)

        self.rowNamesCombo = comboBox(self.headersBox,
                                      label=_('Select Row Names'),
                                      orientation='vertical',
                                      callback=self.scanFile)
        #self.rowNamesCombo.setMaximumWidth(250)

        self.otherOptionsBox = groupBox(options,
                                        label=_("Other Options"),
                                        addSpace=True,
                                        orientation='vertical')
        # box.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        split = widgetBox(self.otherOptionsBox, orientation='horizontal')
        # split.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)

        self.otherOptions = checkBox(
            split,
            label=_('Options'),
            displayLabel=False,
            buttons=[
                'fill', 'strip.white', 'blank.lines.skip', 'allowEscapes',
                'StringsAsFactors'
            ],
            setChecked=['blank.lines.skip'],
            toolTips=[
                _('logical. If TRUE then in case the rows have unequal length, blank fields are implicitly added.'
                  ),
                _('logical. Used only when sep has been specified, and allows the unicodeipping of leading and trailing white space from character fields (numeric fields are always unicodeipped). '
                  ),
                _('logical: if TRUE blank lines in the input are ignored.'),
                _('logical. Should C-style escapes such as \n be processed or read verbatim (the default)? '
                  ),
                _('logical: should character vectors be converted to factors?')
            ],
            orientation='vertical',
            callback=self.scanFile)
        # box.layout().addWidget(self.otherOptions,1,1)
        box2 = widgetBox(split, orientation='vertical')
        #box2.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed)
        split.layout().setAlignment(box2, Qt.AlignTop)
        self.quote = lineEdit(box2,
                              text='"',
                              label=_('Quote:'),
                              width=50,
                              orientation='horizontal')
        self.decimal = lineEdit(
            box2,
            text='.',
            label=_('Decimal:'),
            width=50,
            orientation='horizontal',
            toolTip=_(
                'Decimal sign, some countries may want to use the \'.\''))

        self.numLinesScan = lineEdit(
            box2,
            text='10',
            label=_('# Lines to Preview:'),
            toolTip=
            _('The maximum number of rows to read in while previewing the file. Negative values are ignored.'
              ),
            width=50,
            orientation='horizontal')
        self.numLinesReads = lineEdit(
            box2,
            text='-1',
            label=_('# Lines to Read:'),
            toolTip=
            _('Number of lines to read from file. Read whole file if 0 or negative values.'
              ),
            width=50,
            orientation='horizontal')

        self.numLinesSkip = lineEdit(
            box2,
            text='0',
            label=_('# Lines to Skip:'),
            toolTip=
            _("The number of lines of the data file to skip before beginning to read data."
              ),
            width=50,
            orientation='horizontal')

        holder = widgetBox(options, orientation='horizontal')
        clipboard = button(
            holder,
            label=_('Load Clipboard'),
            toolTip=
            _('Load the file from the clipboard, you can do this if\ndata has been put in the clipboard using the copy command.'
              ),
            callback=self.loadClipboard)
        rescan = button(holder,
                        label=_('Rescan File'),
                        toolTip=_("Preview a small portion of the file"),
                        callback=self.scanNewFile)
        load = button(holder,
                      label=_('Load File'),
                      toolTip=_("Load the file into Red-R"),
                      callback=self.loadFile)
        holder.layout().setAlignment(Qt.AlignRight)

        self.FileInfoBox = groupBox(options,
                                    label=_("File Info"),
                                    addSpace=True)
        self.infob = widgetLabel(self.FileInfoBox, label='')
        self.infob.setWordWrap(True)
        self.infoc = widgetLabel(self.FileInfoBox, label='')
        self.FileInfoBox.setHidden(True)

        self.tableArea = widgetBox(area)
        self.tableArea.setMinimumWidth(500)
        #self.tableArea.setHidden(True)
        self.tableArea.setSizePolicy(QSizePolicy.MinimumExpanding,
                                     QSizePolicy.MinimumExpanding)

        self.scanarea = textEdit(self.tableArea,
                                 label=_('File Preview'),
                                 includeInReports=False)
        self.scanarea.setLineWrapMode(QTextEdit.NoWrap)
        self.scanarea.setReadOnly(True)
        self.scroll = scrollArea(self.tableArea)

        self.columnTypes = widgetBox(self,
                                     orientation=QGridLayout(),
                                     margin=10)
        self.scroll.setWidget(self.columnTypes)
        #self.columnTypes.layout().setSizeConstraint(QLayout.SetMinAndMaxSize)
        self.columnTypes.setMinimumWidth(460)
        self.columnTypes.layout().setSizeConstraint(QLayout.SetMinimumSize)
        self.columnTypes.setSizePolicy(
            QSizePolicy(QSizePolicy.MinimumExpanding,
                        QSizePolicy.MinimumExpanding))
        self.columnTypes.layout().setAlignment(Qt.AlignTop | Qt.AlignLeft)
        #self.setFileList()
        import sys
        if sys.platform == "win32":
            self.require_librarys(['RODBC'])
            self.setForExcel()
コード例 #15
0
    def __init__(self, parent=None, signalManager=None):
        #Here we init the parent class of our widget OWRpy.
        OWRpy.__init__(self)

        #create a R variable cor in the R session.  These variables will be in the R session to track the ouputs of functions that run in R.
        #the cor variable will not conflict with some other widgets cor function
        self.setRvariableNames(["cor"])

        # declare some variables we will use later
        self.RFunctionParam_y = None
        self.RFunctionParam_x = None

        # Define the inputs that this widget will accept
        # When data is received the three element in the tuple which is a function will be executed
        self.inputs.addInput('id0', 'x', redRRDataFrame, self.processx)
        self.inputs.addInput('id1', 'y', redRRDataFrame, self.processy)

        # Define the outputs of this widget
        self.outputs.addOutput('id0', 'cor Output', redRRMatrix)

        #START THE GUI LAYOUT
        area = widgetBox(self.controlArea, orientation='horizontal')

        options = widgetBox(area, orientation='vertical')
        area.layout().setAlignment(options, Qt.AlignTop)

        # radioButtons are a type of qtWidget from the base package.  This widget will show radioButtons in a group.  Only one radio button may be selected at one time.  Buttons are declared using buttons = , the callback is the function that will be executed when the button selection changes.  setChecked sets a button to be checked by default.
        self.type = radioButtons(
            options,
            label="Perform",
            buttons=['Variance', 'Correlation', 'Covariance'],
            setChecked='Correlation',
            orientation='vertical',
            callback=self.changeType)

        self.methodButtons = radioButtons(
            options,
            label="Method",
            buttons=['pearson', 'kendall', 'spearman'],
            setChecked='pearson',
            orientation='vertical')

        self.useButtons = radioButtons(options,
                                       label='Handing Missing Values',
                                       setChecked='everything',
                                       buttons=[
                                           "everything", "all.obs",
                                           "complete.obs",
                                           "pairwise.complete.obs"
                                       ],
                                       orientation='vertical')

        # the commit button is a special button that can be set to process on data input.  Widgets must be aware of these selections.  Clicking the commit button executes the callback which in this case executes the commitFunction.
        self.commit = redRCommitButton(self.bottomAreaRight,
                                       "Commit",
                                       callback=self.commitFunction,
                                       processOnInput=True)

        # this is a filter table designed to hold R data.  The name is Cor/Var for the report generation but the user will not see this label because displayLabel is set to False.
        self.RoutputWindow = redRfilterTable(area,
                                             label='Cor/Var',
                                             displayLabel=False,
                                             sortable=True,
                                             filterable=False)
コード例 #16
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)

        self.setRvariableNames(['heatsubset', 'hclust', 'heatvect'])
        self.plotOnConnect = 0
        self.plotdata = ''
        self.rowvChoice = None
        self.colvChoice = None
        self.listOfColors = ['"red"', '"white"', '"blue"']

        self.inputs.addInput('id0', 'Expression Matrix', redRRDataFrame,
                             self.processMatrix)
        self.inputs.addInput('id1', 'Classes Data', redRRVector,
                             self.processClasses)

        #self.outputs.addOutput('id0', 'Cluster Subset List', redRRVector)
        self.outputs.addOutput('id1', 'Cluster Classes', redRRVector)

        #GUI
        infobox = groupBox(self.controlArea, label="Options")

        self.commit = redRCommitButton(self.bottomAreaRight,
                                       label="Replot",
                                       callback=self.makePlot,
                                       width=200,
                                       processOnInput=True)

        button(infobox, label='Identify', callback=self.identify, width=200)
        self.groupOrHeight = radioButtons(infobox,
                                          label='Identify by:',
                                          buttons=['Groups', 'Height'],
                                          setChecked='Groups',
                                          orientation='horizontal')
        self.groupOrHeightSpin = spinBox(infobox,
                                         label='Identify Value:',
                                         min=1,
                                         value=5)
        self.startSaturation = spinBox(infobox,
                                       label='Starting Saturation:',
                                       min=0,
                                       max=100)
        self.endSaturation = spinBox(infobox,
                                     label='Ending Saturation:',
                                     min=0,
                                     max=100)
        self.endSaturation.setValue(30)
        redRButton(self.controlArea,
                   label='Reset Colors',
                   callback=self.resetColors)
        #self.classesDropdown = comboBox(infobox, label = 'Classes:', toolTip = 'If classes data is connected you may select columns in the data to represent classes of your columns in the plotted data')

        self.rowDendrogram = checkBox(
            infobox,
            label='Dendrogram Options',
            displayLabel=False,
            buttons=['Plot Row Dendrogram', 'Plot Column Dendrogram'],
            setChecked=['Plot Row Dendrogram', 'Plot Column Dendrogram'])

        self.showClasses = checkBox(infobox,
                                    label='Show Classes',
                                    displayLabel=False,
                                    buttons=['Show Classes'])
        self.showClasses.setEnabled(False)
        #OWGUI.checkBox(infobox, self, )
        self.infoa = widgetLabel(infobox, label="Nothing to report")
        self.gview1 = graphicsView(self.controlArea,
                                   label='Heatmap',
                                   displayLabel=False)
        self.gview1.image = 'heatmap1_' + self.widgetID
コード例 #17
0
ファイル: RedRsave.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.path = os.path.abspath('/')

        self.data = None
        self.inputs.addInput("list", _("R Data"), signals.RVariable.RVariable,
                             self.processlist)

        self.fileType = radioButtons(self.controlArea,
                                     label=_('Save File Type'),
                                     buttons=[_('Text'),
                                              _('R Data File')],
                                     setChecked=_('Text'),
                                     orientation='horizontal',
                                     callback=self.selectFileType)

        self.rDataFileOptions = widgetBox(self.controlArea,
                                          orientation='vertical')
        self.varName = redRlineEdit(self.rDataFileOptions,
                                    label=_("Variable Name"))
        self.textFileOptions = widgetBox(self.controlArea,
                                         orientation='vertical')
        self.rDataFileOptions.setDisabled(True)
        self.delimiter = radioButtons(self.textFileOptions,
                                      label=_('Column Seperator'),
                                      buttons={
                                          '\t': _('Tab'),
                                          ' ': _('Space'),
                                          ',': _('Comma'),
                                          '?': _('Other')
                                      },
                                      setChecked='\t',
                                      orientation='horizontal')
        self.otherSepText = redRlineEdit(self.delimiter.box,
                                         label=_('Seperator'),
                                         displayLabel=False,
                                         text=';',
                                         width=20,
                                         orientation='horizontal')
        QObject.connect(self.otherSepText,
                        SIGNAL('textChanged(const QString &)'),
                        lambda: self.delimiter.setChecked('Other'))

        twoColHolder = groupBox(self.textFileOptions,
                                label=_('File Options'),
                                orientation='horizontal')
        colOne = widgetBox(twoColHolder)
        colTwo = widgetBox(twoColHolder)

        self.fileOptions = redRcheckBox(
            colOne,
            label=_('Options'),
            displayLabel=False,
            buttons=[_('append'),
                     _('quote'),
                     _('row.names'),
                     _('col.names')],
            setChecked=[_('quote'), _('col.names')],
            toolTips=[
                _('If TRUE, the output is appended to the file.'),
                _(' If TRUE, any character or factor columns will be surrounded by double quotes.'
                  ),
                _('a logical value indicating whether the row names of data are to be written.'
                  ),
                _('a logical value indicating whether the column names of data are to be written.'
                  )
            ],
            orientation='vertical')

        self.eolChr = redRlineEdit(colTwo,
                                   label=_('End of line Chr:'),
                                   text='\\n',
                                   width=50)
        self.naStr = redRlineEdit(colTwo,
                                  label=_('Missing Value String:'),
                                  text='NA',
                                  width=50)
        self.decStr = redRlineEdit(colTwo,
                                   label=_('Decimel point Chr:'),
                                   text='.',
                                   width=50)

        self.qmethod = radioButtons(
            self.textFileOptions,
            label=_('Deal with embedded double quote characters '),
            buttons=[_('escape'), _('double')],
            setChecked=_('escape'),
            orientation='horizontal')

        self.browseBox = groupBox(self.controlArea,
                                  label=_("Save File"),
                                  addSpace=True,
                                  orientation='vertical')

        box = widgetBox(self.browseBox, orientation='horizontal')
        self.fileLocation = redRlineEdit(box,
                                         label=_('File Location'),
                                         displayLabel=False,
                                         orientation='horizontal')

        redRbutton(box, label=_('Browse'), callback=self.browseFile)

        self.commit = commitButton(self.bottomAreaRight,
                                   _("Save"),
                                   callback=self.commitFunction,
                                   processOnInput=True)
コード例 #18
0
ファイル: rowcolPicker.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)  #initialize the widget
        self.dataClass = None
        self.dataParent = None
        self.setRvariableNames(['rowcolSelector', 'rowcolSelectorNot'])
        self.SubsetByAttached = 0

        self.inputs.addInput('id0', _('Data Table'), redRRDataFrame,
                             self.setWidget)
        self.inputs.addInput('id1', _('Subsetting Vector'), redRRList,
                             self.setSubsettingVector)

        self.outputs.addOutput('id0', _('Selected Items'), redRRDataFrame)
        self.outputs.addOutput('id1', _('Non-selected Items'), redRRDataFrame)

        #set the gui

        area = widgetBox(self.controlArea, orientation='horizontal')
        options = widgetBox(area, orientation='vertical')

        self.rowcolBox = radioButtons(options,
                                      label=_('Select On'),
                                      buttons=[_('Column'),
                                               _('Row')],
                                      setChecked=_('Column'),
                                      callback=self.rowcolButtonSelected,
                                      orientation='horizontal')

        self.sendSection = checkBox(options,
                                    label=_('Create subset from:'),
                                    displayLabel=True,
                                    buttons=[_('Selected'),
                                             _('Not Selected')],
                                    setChecked=[_('Selected')],
                                    orientation='horizontal')

        # toolTips = [_("Select True to send data from the Data slot where the selections that you made are True."),
        # _("Select False to send data from the Not Data slot that are not the selections you made.")])

        self.invertButton = button(options,
                                   _("Invert Selection"),
                                   callback=self.invertSelection)

        separator(options, height=15)

        self.subsetBox = groupBox(options, label=_('Subset by'))
        self.subsetColumn = comboBox(self.subsetBox,
                                     label=_("Column:"),
                                     orientation='vertical',
                                     items=[_('Select')])
        self.subOnAttachedButton = button(self.subsetBox,
                                          _("Subset by column"),
                                          callback=self.subOnAttached)
        self.subsetBox.setDisabled(True)

        separator(options, height=20)

        info = widgetBox(options)
        options.layout().setAlignment(info, Qt.AlignBottom)
        self.infoBox = widgetLabel(info)
        separator(info, height=15)
        self.selectionInfoBox = widgetLabel(info)
        mainArea = widgetBox(area, orientation='vertical')
        self.attributes = listBox(mainArea,
                                  label=_('Select'),
                                  callback=self.onSelect)
        self.attributes.setSelectionMode(QAbstractItemView.ExtendedSelection)

        self.subsetButton = commitButton(mainArea,
                                         _("Subset on Selection"),
                                         callback=self.subset,
                                         processOnChange=True,
                                         processOnInput=True,
                                         alignment=Qt.AlignRight)