def subset_dfs(self,which):
		'''
		Subsets dfs if certain columns should not be included within
		the new merged data frame. 
		
		Parameters 
		=============
		which - data frame id. 
		
		
		Output
		=============
		None
		
		'''
		columnKey = '{} data frame'.format(which)
		if columnKey not in self.dfColumns:
			return
		else:
			columns = list(self.dfColumns[columnKey].values())
			
			
		dialog = simpleListboxSelection('Selected columns will be \nused for merging.',
										columns)
		selection = dialog.selection
		self.dfSelection[columnKey] = selection
示例#2
0
    def define_features(self, id):

        dfString = self.blocks[id]['dataFrame'].get()
        if dfString not in self.blockIdtoDfId:
            tk.messagebox.showinfo('Error..',
                                   'Please select a data frame.',
                                   parent=self.toplevel)
            return

        dfID = self.blockIdtoDfId[dfString]
        numColumns = self.dfClass.get_numeric_columns_by_id(dfID)

        if self.blocks[id]['featureInCols'].instate(['selected']):

            pass

        else:
            catColumns = self.dfClass.get_categorical_columns_by_id(dfID)
            featureNamesDialog = simple_dialog.simpleUserInputDialog(
                ['Feature Names'], [catColumns[0]], catColumns,
                'Select feature names column',
                'Please select Column that holds feature names (Gene names, Lipid names)'
            )

            if len(featureNamesDialog.selectionOutput) == 0:
                return

        dialog = simple_dialog.simpleListboxSelection(
            'Select feature columns.', numColumns, 'Feature Selection')

        if len(dialog.selection) > 0:

            featureColumns = dialog.selection

            blockDF = self.dfClass.dfs[dfID][featureColumns]

            if self.blocks[id]['featureInCols'].instate(['selected']):

                self.blocks[id]['blockDF'] = blockDF
                self.blocks[id][
                    'featureNames'] = blockDF.columns.values.tolist()

            else:

                self.blocks[id]['blockDF'] = blockDF.transpose().values
                self.blocks[id][
                    'featureNames'] = featureNamesDialog.selectionOutput[
                        'Feature Names']

        if self.blocks[id]['scaleData'].instate(['selected']):

            self.blocks[id]['blockDF'] = StandardScaler().fit_transform(
                self.blocks[id]['blockDF'])

        self.blocks[id]['featureButton'].configure(text="\u221A")
示例#3
0
    def column_selection(self, event=None):
        '''
		'''
        selection = self.get_selected_groups()
        if len(selection) == 0:
            return
        groupName = selection[0]
        columns = self.get_columns()
        selectionDialog = simpleListboxSelection('Select columns for Group ..',
                                                 data=columns)

        if len(selectionDialog.selection) != 0:

            iids = self.delete_group_member(groupName)
            self.add_column_to_group(groupName,
                                     selectionDialog.selection,
                                     update=True)
    def custom_column_select(self, file):
        '''
		'''
        dialog = simpleListboxSelection(
            'Select columns for upload. Please note that if you want to' +
            ' upload always the same column index (e.g. at the same position of each file'
            + ' you can also just enter the index in the main window.',
            self.fileColumns[file])
        selection = dialog.selection
        if len(selection) != 0:
            index = [self.fileColumns[file].index(x) + 1 for x in selection]
            if len(index) == 1:
                indexStr = index[0]
            else:
                indexStr = get_elements_from_list_as_string(
                    index, addString='', newLine=False, maxStringLength=None)
            self.fileWidgets[file]['columnIndex'].delete(0, tk.END)
            self.fileWidgets[file]['columnIndex'].insert(0, indexStr)