def add_field(self, cond_name, pre_path): widget = QWidget() widget_layout = QHBoxLayout() widget.setLayout(widget_layout) line_edit = LabelledLineEdit(self, cond_name) if pre_path: line_edit.setText(pre_path) button = QPushButton("...", self) line_edit.field.setMinimumWidth(250) button.setMaximumWidth(25) button.clicked.connect(partial(self.raise_file_dialog, line_edit)) widget.layout().addWidget(line_edit) widget.layout().addWidget(button) widget_items = (line_edit, button) self.cond_widget_dict[cond_name] = widget_items self.layout().addWidget(widget) return
class DeltaPREPlotPopup(BasePopup): """ A popup for setting Delta PRE Plot specific settings in the Farseer-NMR configuration. Parameters: parent(QWidget): parent widget for popup. Methods: .get_defaults() .get_values() .set_values() """ def __init__(self, parent=None, **kw): BasePopup.__init__(self, parent, title="DPRE Plot", settings_key=["DPRE_plot_settings"]) self.DPRE_plot_rows = LabelledSpinBox(self, "Number of Rows", minimum=1, step=1) self.DPRE_plot_width = LabelledSpinBox(self, "Scale Factor for Width") self.DPRE_plot_y_label = LabelledLineEdit(self, "Y Label") self.DPRE_plot_y_label_fs = LabelledSpinBox(self, "Y Label Font Size", minimum=0, step=1) self.DPRE_plot_ymax = LabelledDoubleSpinBox(self, "Y Maximum", minimum=0, step=0.1) self.DPRE_plot_dpre_ms = LabelledSpinBox(self, "Marker Size", minimum=0, step=1) self.DPRE_plot_dpre_alpha = LabelledDoubleSpinBox( self, "Marker Transparency", minimum=0, maximum=1, step=0.1) self.DPRE_plot_smooth_lw = LabelledSpinBox(self, "Smoothed DPRE Line Width", minimum=0, step=1) self.DPRE_plot_ref_color = ColourBox(self, "Reference Data Colour") self.DPRE_plot_color_init = ColourBox(self, "Grad Start Colour") self.DPRE_plot_color_end = ColourBox(self, "Grad End Colour") self.DPRE_plot_x_ticks_fn = FontComboBox(self, "X Tick Font") self.DPRE_plot_x_ticks_fs = LabelledSpinBox(self, "X Tick Font Size", minimum=0, step=1) self.DPRE_plot_x_ticks_pad = LabelledDoubleSpinBox(self, "X Tick Padding", minimum=-100, maximum=100, step=0.1) self.DPRE_plot_x_ticks_weight = LabelledCombobox(self, text="X Font Weight", items=font_weights) self.DPRE_plot_grid_color = ColourBox(self, "Grid Colour") self.DPRE_plot_res_highlight = LabelledCheckbox( self, "Highlight Residues?") self.DPRE_plot_res_highlight_list = LabelledLineEdit( self, "Residues to Highlight") self.DPRE_plot_shade = LabelledCheckbox(self, "Shade Residues?") self.DPRE_plot_regions = LabelledLineEdit(self, "Regions to Shade") self.DPRE_plot_rh_fs = LabelledSpinBox(self, "Highlight Font Size ", minimum=0, step=1) self.DPRE_plot_rh_y = LabelledDoubleSpinBox(self, "Residue Label Scale", minimum=0, maximum=1, step=0.01) self.layout().addWidget(self.DPRE_plot_rows, 0, 0) self.layout().addWidget(self.DPRE_plot_width, 1, 0) self.layout().addWidget(self.DPRE_plot_y_label, 2, 0) self.layout().addWidget(self.DPRE_plot_ref_color, 3, 0) self.layout().addWidget(self.DPRE_plot_color_init, 4, 0) self.layout().addWidget(self.DPRE_plot_color_end, 5, 0) self.layout().addWidget(self.DPRE_plot_x_ticks_fs, 6, 0) self.layout().addWidget(self.DPRE_plot_x_ticks_fn, 7, 0) self.layout().addWidget(self.DPRE_plot_x_ticks_pad, 8, 0) self.layout().addWidget(self.DPRE_plot_x_ticks_weight, 9, 0) self.layout().addWidget(self.DPRE_plot_grid_color, 10, 0) self.layout().addWidget(self.DPRE_plot_dpre_ms, 0, 1) self.layout().addWidget(self.DPRE_plot_dpre_alpha, 1, 1) self.layout().addWidget(self.DPRE_plot_y_label_fs, 2, 1) self.layout().addWidget(self.DPRE_plot_smooth_lw, 3, 1) self.layout().addWidget(self.DPRE_plot_res_highlight, 4, 1) self.layout().addWidget(self.DPRE_plot_res_highlight_list, 5, 1) self.layout().addWidget(self.DPRE_plot_shade, 6, 1) self.layout().addWidget(self.DPRE_plot_regions, 7, 1) self.layout().addWidget(self.DPRE_plot_rh_fs, 8, 1) self.layout().addWidget(self.DPRE_plot_rh_y, 9, 1) self.layout().addWidget(self.DPRE_plot_ymax, 10, 1) self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel | QDialogButtonBox.RestoreDefaults) self.buttonBox.accepted.connect(self.set_values) self.buttonBox.rejected.connect(self.reject) self.buttonBox.button( QDialogButtonBox.RestoreDefaults).clicked.connect( self.get_defaults) self.layout().addWidget(self.buttonBox, 11, 0, 2, 2) self.get_values() def set_ranges(self, field_value): ll = field_value.split(',') return [[int(x.split('-')[0]), int(x.split('-')[1])] for x in ll] def get_ranges(self, ranges): return ','.join(["%s-%s" % (x[0], x[1]) for x in ranges]) def get_defaults(self): # value self.DPRE_plot_rows.setValue(self.defaults["rows"]) self.DPRE_plot_width.setValue(self.defaults["width"]) self.DPRE_plot_y_label_fs.setValue(self.defaults["y_label_fs"]) self.DPRE_plot_dpre_ms.setValue(self.defaults["dpre_ms"]) self.DPRE_plot_dpre_alpha.setValue(self.defaults["dpre_alpha"]) self.DPRE_plot_smooth_lw.setValue(self.defaults["smooth_lw"]) self.DPRE_plot_x_ticks_fs.setValue(self.defaults["x_ticks_fs"]) self.DPRE_plot_x_ticks_pad.setValue(self.defaults["x_ticks_pad"]) self.DPRE_plot_rh_fs.setValue(self.defaults["res_highlight_fs"]) self.DPRE_plot_rh_y.setValue(self.defaults["res_highlight_y"]) self.DPRE_plot_ymax.setValue(self.defaults["ymax"]) # text self.DPRE_plot_y_label.setText(self.defaults["y_label"]) self.DPRE_plot_regions.setText( self.get_ranges(self.defaults["shade_regions"])) # colour self.DPRE_plot_ref_color.get_colour(self.defaults["ref_color"]) self.DPRE_plot_color_init.get_colour(self.defaults["color_init"]) self.DPRE_plot_color_end.get_colour(self.defaults["color_end"]) self.DPRE_plot_grid_color.get_colour(self.defaults["grid_color"]) # dropdown self.DPRE_plot_x_ticks_fn.select(self.defaults["x_ticks_fn"]) self.DPRE_plot_x_ticks_weight.select(self.defaults["x_ticks_weight"]) # check self.DPRE_plot_shade.setChecked(self.defaults["shade"]) self.DPRE_plot_res_highlight.setChecked(self.defaults["res_highlight"]) # list self.DPRE_plot_res_highlight_list.field.setText(','.join( list(map(str, self.defaults["res_hl_list"])))) def set_values(self): # value self.local_variables["rows"] = self.DPRE_plot_rows.field.value() self.local_variables["width"] = self.DPRE_plot_width.field.value() self.local_variables[ "y_label_fs"] = self.DPRE_plot_y_label_fs.field.value() self.local_variables["dpre_ms"] = self.DPRE_plot_dpre_ms.field.value() self.local_variables[ "dpre_alpha"] = self.DPRE_plot_dpre_alpha.field.value() self.local_variables[ "smooth_lw"] = self.DPRE_plot_smooth_lw.field.value() self.local_variables[ "x_ticks_fs"] = self.DPRE_plot_x_ticks_fs.field.value() self.local_variables[ "x_ticks_pad"] = self.DPRE_plot_x_ticks_pad.field.value() self.local_variables[ "res_highlight_fs"] = self.DPRE_plot_rh_fs.field.value() self.local_variables[ "res_highlight_y"] = self.DPRE_plot_rh_y.field.value() self.local_variables["ymax"] = self.DPRE_plot_ymax.field.value() # text self.local_variables["y_label"] = self.DPRE_plot_y_label.field.text() self.local_variables["shade_regions"] = self.set_ranges( self.DPRE_plot_regions.field.text()) self.local_variables["res_hl_list"] = \ list(map(int, self.DPRE_plot_res_highlight_list.field.text().split(','))) # dropdown self.local_variables[ "ref_color"] = self.DPRE_plot_ref_color.fields.currentText() self.local_variables[ "x_ticks_fn"] = self.DPRE_plot_x_ticks_fn.fields.currentText() self.local_variables[ "x_ticks_weight"] = self.DPRE_plot_x_ticks_weight.fields.currentText( ) # colour self.local_variables["color_init"] = colours[ self.DPRE_plot_color_init.fields.currentText()] self.local_variables["color_end"] = colours[ self.DPRE_plot_color_end.fields.currentText()] self.local_variables[ "grid_color"] = self.DPRE_plot_grid_color.fields.currentText() # checkbox self.local_variables["shade"] = self.DPRE_plot_shade.isChecked() self.local_variables[ "res_highlight"] = self.DPRE_plot_res_highlight.isChecked() self.accept() def get_values(self): # value self.DPRE_plot_rows.setValue(self.local_variables["rows"]) self.DPRE_plot_width.setValue(self.local_variables["width"]) self.DPRE_plot_y_label_fs.setValue(self.local_variables["y_label_fs"]) self.DPRE_plot_dpre_ms.setValue(self.local_variables["dpre_ms"]) self.DPRE_plot_dpre_alpha.setValue(self.local_variables["dpre_alpha"]) self.DPRE_plot_smooth_lw.setValue(self.local_variables["smooth_lw"]) self.DPRE_plot_x_ticks_fs.setValue(self.local_variables["x_ticks_fs"]) self.DPRE_plot_x_ticks_pad.setValue( self.local_variables["x_ticks_pad"]) self.DPRE_plot_rh_fs.setValue(self.local_variables["res_highlight_fs"]) self.DPRE_plot_rh_y.setValue(self.local_variables["res_highlight_y"]) self.DPRE_plot_ymax.setValue(self.local_variables["ymax"]) # text self.DPRE_plot_y_label.setText(self.local_variables["y_label"]) self.DPRE_plot_res_highlight_list.field.setText(','.join( list(map(str, self.local_variables["res_hl_list"])))) self.DPRE_plot_regions.setText( self.get_ranges(self.local_variables["shade_regions"])) # colour self.DPRE_plot_ref_color.get_colour(self.local_variables["ref_color"]) self.DPRE_plot_color_init.get_colour( self.local_variables["color_init"]) self.DPRE_plot_color_end.get_colour(self.local_variables["color_end"]) self.DPRE_plot_grid_color.get_colour( self.local_variables["grid_color"]) # dropdown self.DPRE_plot_x_ticks_fn.select(self.local_variables["x_ticks_fn"]) self.DPRE_plot_x_ticks_weight.select( self.local_variables["x_ticks_weight"]) # checked self.DPRE_plot_shade.setChecked(self.local_variables["shade"]) self.DPRE_plot_res_highlight.setChecked( self.local_variables["res_highlight"])
class Settings(BaseWidget): def __init__(self, parent=None, gui_settings=None, footer=None): BaseWidget.__init__(self, parent=parent, gui_settings=gui_settings, footer=footer) # grid = QGridLayout() grid2 = QGridLayout() self.setLayout(grid2) new_widget = QWidget(self) new_widget.setObjectName("SettingsWidget") new_widget.setLayout(grid) self.layout().addWidget(new_widget) # grid.setAlignment(QtCore.Qt.AlignTop) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) paths_group_box = QGroupBox() paths_groupbox_layout = QGridLayout() paths_groupbox_layout.setSpacing(2) paths_group_box.setLayout(paths_groupbox_layout) # self.spectrum_path = LabelledLineEdit( self, "Peaklists Dataset Folder", callback=self.set_spectrum_path_text) self.output_path = LabelledLineEdit(self, "Calculation Output Folder", callback=self.set_output_path) self.spectrum_path_browse = QPushButton("...", self) self.output_path_browse = QPushButton("...", self) self.spectrum_path_browse.clicked.connect(self.set_spectrum_path) self.output_path_browse.clicked.connect(self.set_output_path) # layout paths_group_box.layout().addWidget(self.spectrum_path, 0, 0, 1, 12) paths_group_box.layout().addWidget(self.output_path, 1, 0, 1, 12) paths_group_box.layout().addWidget(self.spectrum_path_browse, 0, 13, 1, 1) paths_group_box.layout().addWidget(self.output_path_browse, 1, 13, 1, 1) # boxes self.ext_bar_checkbox = LabelledCheckbox(self, "Extended Bar") self.comp_bar_checkbox = LabelledCheckbox(self, "Compact Bar") self.vert_bar_checkbox = LabelledCheckbox(self, "Vertical Bar") self.res_evo_checkbox = LabelledCheckbox(self, "Residue Evolution") self.scatter_checkbox = LabelledCheckbox(self, "CS Scatter") self.dpre_checkbox = LabelledCheckbox(self, "Delta PRE Plot") self.heat_map_checkbox = LabelledCheckbox(self, "Heat Map") self.scatter_flower_checkbox = LabelledCheckbox( self, " CS Scatter Flower") self.tplot_button = QPushButton("General Settings", self) self.tplot_button.clicked.connect( partial(self.show_popup, SeriesPlotPopup)) self.revo_button = QPushButton("General Evolution Settings", self) self.revo_button.clicked.connect( partial(self.show_popup, GeneralResidueEvolution)) self.bar_button = QPushButton("Bar Settings", self) self.bar_button.clicked.connect(partial(self.show_popup, BarPlotPopup)) self.ext_bar_button = QPushButton("Settings", self) self.ext_bar_button.clicked.connect( partial(self.show_popup, ExtendedBarPopup)) self.comp_bar_button = QPushButton("Settings", self) self.comp_bar_button.clicked.connect( partial(self.show_popup, CompactBarPopup)) self.vert_bar_button = QPushButton("Settings", self) self.vert_bar_button.clicked.connect( partial(self.show_popup, VerticalBarPopup)) self.res_evo_button = QPushButton("Settings", self) self.res_evo_button.clicked.connect( partial(self.show_popup, ResidueEvolutionPopup)) self.scatter_button = QPushButton("Settings", self) self.scatter_button.clicked.connect( partial(self.show_popup, ScatterPlotPopup)) self.scatter_flower_button = QPushButton("Settings", self) self.scatter_flower_button.clicked.connect( partial(self.show_popup, ScatterFlowerPlotPopup)) self.heat_map_button = QPushButton("Settings", self) self.heat_map_button.clicked.connect( partial(self.show_popup, HeatMapPopup)) self.dpre_button = QPushButton("Settings", self) self.dpre_button.clicked.connect( partial(self.show_popup, DeltaPREPlotPopup)) self.fasta_button = QPushButton("Select FASTA Files", self) self.fasta_button.clicked.connect( partial(self.show_popup, FastaSelectionPopup)) self.has_sidechains_checkbox = LabelledCheckbox( self, "Are Sidechain Peaks Present?") self.use_sidechains_checkbox = LabelledCheckbox( self, "Analyse Sidechains?") self.perform_comparisons_checkbox = LabelledCheckbox( self, "Perform Comparisons?") self.apply_fasta_checkbox = LabelledCheckbox( self, "Apply FASTA?", callback=self.activate_fasta) self.fasta_start = LabelledSpinBox(self, "Fasta start", maximum=10000, step=1) self.expand_missing_yy = LabelledCheckbox( self, "Search missing residues along Y axis?") self.expand_missing_zz = LabelledCheckbox( self, "Search missing residues along Z axis?") self.figure_width = LabelledDoubleSpinBox(self, "Figure Width", minimum=0.1, maximum=100, step=0.1) self.figure_height = LabelledDoubleSpinBox(self, "Figure Height", minimum=0.1, maximum=100, step=0.1) self.figure_dpi = LabelledSpinBox(self, "Figure DPI", minimum=0, maximum=10000, step=10) self.figure_format = LabelledCombobox( self, "Figure Format", items=['pdf', 'png', 'ps', 'svg']) sidechains_groupbox = QGroupBox() sidechains_groupbox.setTitle("Sidechains") sidechains_groupbox_layout = QVBoxLayout() sidechains_groupbox.setLayout(sidechains_groupbox_layout) sidechains_groupbox.layout().addWidget(self.has_sidechains_checkbox) sidechains_groupbox.layout().addWidget(self.use_sidechains_checkbox) fasta_groupbox = QGroupBox() fasta_groupbox.setTitle("FASTA") fasta_groupbox_layout = QGridLayout() fasta_groupbox.setLayout(fasta_groupbox_layout) fasta_groupbox.layout().addWidget(self.apply_fasta_checkbox, 0, 0) fasta_groupbox.layout().addWidget(self.fasta_start, 0, 1) fasta_groupbox.layout().addWidget(self.fasta_button, 1, 0, 1, 2) self.x_checkbox = LabelledCheckbox(self, "Along X Axis") self.y_checkbox = LabelledCheckbox(self, "Along Y Axis") self.z_checkbox = LabelledCheckbox(self, "Along Z Axis") series_groupbox = QGroupBox() series_groupbox.setTitle("Experimental Series Analysis") series_groupbox_layout = QVBoxLayout() series_groupbox.setLayout(series_groupbox_layout) series_groupbox.layout().addWidget(self.x_checkbox) series_groupbox.layout().addWidget(self.y_checkbox) series_groupbox.layout().addWidget(self.z_checkbox) series_groupbox.layout().addWidget(self.perform_comparisons_checkbox) figure_groupbox = QGroupBox() figure_groupbox.setTitle("Figure") figure_groupbox_layout = QVBoxLayout() figure_groupbox.setLayout(figure_groupbox_layout) figure_groupbox.layout().addWidget(self.figure_width) figure_groupbox.layout().addWidget(self.figure_height) figure_groupbox.layout().addWidget(self.figure_dpi) figure_groupbox.layout().addWidget(self.figure_format) self.cs_correction = LabelledCheckbox(self, "CS Correction?") self.cs_correction_res_ref = LabelledSpinBox(self, text="Correction Residue") cs_norm_groupbox = QGroupBox() cs_norm_groupbox.setTitle("Chemical Shift Normalisation") cs_groupbox_layout = QVBoxLayout() cs_norm_groupbox.setLayout(cs_groupbox_layout) cs_norm_groupbox.layout().addWidget(self.cs_correction) cs_norm_groupbox.layout().addWidget(self.cs_correction_res_ref) missing_analysis_groupbox = QGroupBox() missing_analysis_groupbox.setTitle( "Search missing residues across axes") missing_analysis_groupbox_layout = QVBoxLayout() missing_analysis_groupbox.setLayout(missing_analysis_groupbox_layout) missing_analysis_groupbox.layout().addWidget(self.expand_missing_yy) missing_analysis_groupbox.layout().addWidget(self.expand_missing_zz) cs_groupbox = QGroupBox() cs_groupbox.setTitle("CSP Specific") cs_groupbox_layout = QVBoxLayout() cs_groupbox.setLayout(cs_groupbox_layout) self.csp_alpha = LabelledDoubleSpinBox(self, text="CSP Alpha", minimum=0.01, maximum=1, step=0.01) self.csp_missing = LabelledCombobox(self, text="Show Missing Residues", items=['prev', 'full', 'zero']) self.csp_exceptions = QPushButton("Alpha by residue", self) self.csp_exceptions.clicked.connect( partial(self.show_popup, CSPExceptionsPopup)) cs_groupbox.layout().addWidget(self.csp_alpha) cs_groupbox.layout().addWidget(self.csp_missing) cs_groupbox.layout().addWidget(self.csp_exceptions) restraint_groupbox = QGroupBox() restraint_groupbox.setTitle("Parameter Calculation") restraint_groupbox_layout = QGridLayout() restraint_groupbox.setLayout(restraint_groupbox_layout) self.plot_F1_data = LabelledCheckbox(self, text="F1 data") self.plot_F2_data = LabelledCheckbox(self, text="F2 data") self.plot_CSP = LabelledCheckbox(self, text="CSPs") self.plot_height_ratio = LabelledCheckbox(self, text="Height Ratio", callback=self.activate_pre) self.plot_volume_ratio = LabelledCheckbox(self, text="Volume Ratio", callback=self.activate_pre) self.plot_F1_y_label = LabelledLineEdit(self, text='') self.plot_F2_y_label = LabelledLineEdit(self, text='') self.plot_CSP_y_label = LabelledLineEdit(self, text='') self.plot_height_y_label = LabelledLineEdit(self, text='') self.plot_volume_y_label = LabelledLineEdit(self, text='') self.plot_F1_calccol = LabelledLineEdit(self, text="") self.plot_F2_calccol = LabelledLineEdit(self, text="") self.plot_CSP_calccol = LabelledLineEdit(self, text="") self.plot_height_calccol = LabelledLineEdit(self, text="") self.plot_volume_calccol = LabelledLineEdit(self, text="") self.plot_F1_y_scale = LabelledDoubleSpinBox(self, text="", minimum=0, step=0.1) self.plot_F2_y_scale = LabelledDoubleSpinBox(self, text="", minimum=0, step=0.1) self.plot_CSP_y_scale = LabelledDoubleSpinBox(self, text="", minimum=0, step=0.1) self.plot_height_y_scale = LabelledDoubleSpinBox(self, text="", minimum=0, step=0.1) self.plot_volume_y_scale = LabelledDoubleSpinBox(self, text="", minimum=0, step=0.1) restraint_label = QLabel("Y Axis Label") axis_label = QLabel("Parameter Name") scale_label = QLabel("Y Axis Scale") restraint_label.setAlignment(QtCore.Qt.AlignHCenter) axis_label.setAlignment(QtCore.Qt.AlignHCenter) scale_label.setAlignment(QtCore.Qt.AlignHCenter) restraint_groupbox.layout().addWidget(restraint_label, 0, 2) restraint_groupbox.layout().addWidget(axis_label, 0, 1) restraint_groupbox.layout().addWidget(scale_label, 0, 3) restraint_groupbox.layout().addWidget(self.plot_F1_data, 1, 0) restraint_groupbox.layout().addWidget(self.plot_F2_data, 2, 0) restraint_groupbox.layout().addWidget(self.plot_CSP, 3, 0) restraint_groupbox.layout().addWidget(self.plot_height_ratio, 4, 0) restraint_groupbox.layout().addWidget(self.plot_volume_ratio, 5, 0) restraint_groupbox.layout().addWidget(self.plot_F1_y_label, 1, 2) restraint_groupbox.layout().addWidget(self.plot_F2_y_label, 2, 2) restraint_groupbox.layout().addWidget(self.plot_CSP_y_label, 3, 2) restraint_groupbox.layout().addWidget(self.plot_height_y_label, 4, 2) restraint_groupbox.layout().addWidget(self.plot_volume_y_label, 5, 2) restraint_groupbox.layout().addWidget(self.plot_F1_calccol, 1, 1) restraint_groupbox.layout().addWidget(self.plot_F2_calccol, 2, 1) restraint_groupbox.layout().addWidget(self.plot_CSP_calccol, 3, 1) restraint_groupbox.layout().addWidget(self.plot_height_calccol, 4, 1) restraint_groupbox.layout().addWidget(self.plot_volume_calccol, 5, 1) restraint_groupbox.layout().addWidget(self.plot_F1_y_scale, 1, 3) restraint_groupbox.layout().addWidget(self.plot_F2_y_scale, 2, 3) restraint_groupbox.layout().addWidget(self.plot_CSP_y_scale, 3, 3) restraint_groupbox.layout().addWidget(self.plot_height_y_scale, 4, 3) restraint_groupbox.layout().addWidget(self.plot_volume_y_scale, 5, 3) pre_groupbox = QGroupBox() pre_groupbox.setTitle("PRE Analysis") pre_groupbox_layout = QGridLayout() pre_groupbox.setLayout(pre_groupbox_layout) self.do_pre_checkbox = LabelledCheckbox(self, "Do PRE Analysis") self.do_pre_checkbox.setEnabled(False) self.heat_map_checkbox.setEnabled(False) self.dpre_checkbox.setEnabled(False) self.pre_settings = QPushButton("PRE Settings", self) self.pre_settings.clicked.connect( partial(self.show_popup, PreAnalysisPopup)) self.pretheo_button = QPushButton("Select theo. PRE Files", self) self.pretheo_button.clicked.connect( partial(self.show_popup, PRETheoreticalSelectionPopup)) pre_groupbox.layout().addWidget(self.do_pre_checkbox, 0, 0) pre_groupbox.layout().addWidget(self.pre_settings, 0, 1) pre_groupbox.layout().addWidget(self.dpre_checkbox, 1, 0) pre_groupbox.layout().addWidget(self.dpre_button, 1, 1) pre_groupbox.layout().addWidget(self.heat_map_checkbox, 2, 0) pre_groupbox.layout().addWidget(self.heat_map_button, 2, 1) pre_groupbox.layout().addWidget(self.pretheo_button) series_plotting_groupbox = QGroupBox() series_plotting_groupbox.setTitle("Series Plotting") series_plotting_groupbox_layout = QGridLayout() series_plotting_groupbox.setLayout(series_plotting_groupbox_layout) series_plotting_groupbox.layout().addWidget(self.tplot_button, 0, 0, 1, 1) series_plotting_groupbox.layout().addWidget(self.bar_button, 0, 1, 1, 1) series_plotting_groupbox.layout().addWidget(self.ext_bar_checkbox, 1, 0, 1, 1) series_plotting_groupbox.layout().addWidget(self.ext_bar_button, 1, 1, 1, 1) series_plotting_groupbox.layout().addWidget(self.comp_bar_checkbox, 2, 0, 1, 1) series_plotting_groupbox.layout().addWidget(self.comp_bar_button, 2, 1, 1, 1) series_plotting_groupbox.layout().addWidget(self.vert_bar_checkbox, 3, 0, 1, 1) series_plotting_groupbox.layout().addWidget(self.vert_bar_button, 3, 1, 1, 1) res_evo_groupbox = QGroupBox() res_evo_groupbox.setTitle("Residue Evolution Plot") res_evo_groupbox_layout = QGridLayout() res_evo_groupbox.setLayout(res_evo_groupbox_layout) res_evo_groupbox.layout().addWidget(self.revo_button, 0, 0, 1, 2) res_evo_groupbox.layout().addWidget(self.res_evo_checkbox, 1, 0, 1, 1) res_evo_groupbox.layout().addWidget(self.res_evo_button, 1, 1, 1, 1) res_evo_groupbox.layout().addWidget(self.scatter_checkbox, 2, 0, 1, 1) res_evo_groupbox.layout().addWidget(self.scatter_button, 2, 1, 1, 1) res_evo_groupbox.layout().addWidget(self.scatter_flower_checkbox, 3, 0, 1, 1) res_evo_groupbox.layout().addWidget(self.scatter_flower_button, 3, 1, 1, 1) grid.layout().addWidget(paths_group_box, 0, 0, 3, 16) grid.layout().addWidget(fasta_groupbox, 7, 4, 4, 4) grid.layout().addWidget(sidechains_groupbox, 3, 4, 4, 4) grid.layout().addWidget(cs_norm_groupbox, 7, 0, 4, 4) grid.layout().addWidget(missing_analysis_groupbox, 3, 0, 4, 4) grid.layout().addWidget(series_groupbox, 3, 8, 6, 4) grid.layout().addWidget(figure_groupbox, 3, 12, 6, 4) grid.layout().addWidget(figure_groupbox, 3, 12, 6, 4) grid.layout().addWidget(restraint_groupbox, 11, 0, 10, 8) grid.layout().addWidget(cs_groupbox, 9, 8, 5, 4) grid.layout().addWidget(pre_groupbox, 9, 12, 5, 4) grid.layout().addWidget(series_plotting_groupbox, 14, 8, 7, 4) grid.layout().addWidget(res_evo_groupbox, 14, 12, 7, 4) grid.layout().addWidget(self.tab_footer, 21, 0, 2, 16) # self.load_variables() def activate_fasta(self, value): self.variables["fasta_settings"]["applyFASTA"] = value print(self.variables["fasta_settings"]["applyFASTA"]) def activate_pre(self): if self.plot_height_ratio.isChecked( ) or self.plot_volume_ratio.isChecked(): self.do_pre_checkbox.setEnabled(True) self.dpre_checkbox.setEnabled(True) self.heat_map_checkbox.setEnabled(True) else: self.do_pre_checkbox.setEnabled(False) self.dpre_checkbox.setEnabled(False) self.heat_map_checkbox.setEnabled(False) def set_spectrum_path_text(self, path=None): self.spectrum_path.setText(path) self.variables["general_settings"]["spectra_path"] = path self.parent().parent().parent().load_peak_lists(path) def set_output_path_text(self, path=None): self.output_path.setText(path) self.variables["general_settings"]["output_path"] = path def set_spectrum_path(self, path=None): if not path: path = str( QFileDialog.getExistingDirectory(None, 'Select Directory', os.getcwd())) self.set_spectrum_path_text(path) def set_output_path(self, path=None): if not path: path = str( QFileDialog.getExistingDirectory(None, 'Select Directory', os.getcwd())) self.output_path.setText(path) self.variables["general_settings"]["output_path"] = path def load_config(self): msg = QMessageBox() msg.setIcon(QMessageBox.Warning) msg.setText("Load Configuration") msg.setInformativeText("This will overwrite all existing " "settings and data points!") msg.setWindowTitle("Reset Experimental Series") msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) retval = msg.exec_() if retval == QMessageBox.Ok: self.variables = self.parent().parent().parent().load_config() self.load_variables() else: return def save_config(self): general = self.variables["general_settings"] fitting = self.variables["fitting_settings"] cs = self.variables["cs_settings"] csp = self.variables["csp_settings"] fasta = self.variables["fasta_settings"] plots_f1 = self.variables["PosF1_settings"] plots_f2 = self.variables["PosF2_settings"] plots_height = self.variables["Height_ratio_settings"] plots_volume = self.variables["Volume_ratio_settings"] # General Settings general["spectra_path"] = self.spectrum_path.field.text() general["output_path"] = self.output_path.field.text() general["has_sidechains"] = self.has_sidechains_checkbox.isChecked() general["use_sidechains"] = self.use_sidechains_checkbox.isChecked() general["fig_height"] = self.figure_height.field.value() general["fig_width"] = self.figure_width.field.value() general["fig_dpi"] = self.figure_dpi.field.value() general["fig_file_type"] = self.figure_format.fields.currentText() # Fitting Settings fitting["expand_missing_yy"] = self.expand_missing_yy.isChecked() fitting["expand_missing_zz"] = self.expand_missing_zz.isChecked() fitting[ "perform_comparisons"] = self.perform_comparisons_checkbox.isChecked( ) fitting["do_along_x"] = self.x_checkbox.isChecked() fitting["do_along_y"] = self.y_checkbox.isChecked() fitting["do_along_z"] = self.z_checkbox.isChecked() # CS Settings cs["perform_cs_correction"] = self.cs_correction.isChecked() cs["cs_correction_res_ref"] = self.cs_correction_res_ref.field.value() # CSP Settings csp["csp_res4alpha"] = round(self.csp_alpha.field.value(), 2) csp["cs_missing"] = self.csp_missing.fields.currentText() # FASTA Settings fasta["applyFASTA"] = self.apply_fasta_checkbox.checkBox.isChecked() fasta["FASTAstart"] = self.fasta_start.field.value() self.variables["pre_settings"][ "apply_PRE_analysis"] = self.do_pre_checkbox.isChecked() # Plot F1 Settings plots_f1["calcs_PosF1_delta"] = self.plot_F1_data.isChecked() plots_f1["yy_label_PosF1_delta"] = self.plot_F1_y_label.field.text() plots_f1["yy_scale_PosF1_delta"] = self.plot_F1_y_scale.field.value() plots_f1["calccol_name_PosF1_delta"] = self.plot_F1_calccol.field.text( ) # Plot F2 Settings plots_f2["calcs_PosF2_delta"] = self.plot_F2_data.isChecked() plots_f2["yy_label_PosF2_delta"] = self.plot_F2_y_label.field.text() plots_f2["yy_scale_PosF2_delta"] = self.plot_F2_y_scale.field.value() plots_f2["calccol_name_PosF2_delta"] = self.plot_F2_calccol.field.text( ) # Plot CSP Settings csp["calcs_CSP"] = self.plot_CSP.isChecked() csp["yy_label_CSP"] = self.plot_CSP_y_label.field.text() csp["yy_scale_CSP"] = self.plot_CSP_y_scale.field.value() csp["calccol_name_CSP"] = self.plot_CSP_calccol.field.text() # Plot Height Settings plots_height["calcs_Height_ratio"] = self.plot_height_ratio.isChecked() plots_height[ "yy_label_Height_ratio"] = self.plot_height_y_label.field.text() plots_height[ "yy_scale_Height_ratio"] = self.plot_height_y_scale.field.value() plots_height[ "calccol_name_Height_ratio"] = self.plot_height_calccol.field.text( ) # Plot Volume Settings plots_volume["calcs_Volume_ratio"] = self.plot_volume_ratio.isChecked() plots_volume[ "yy_label_Volume_ratio"] = self.plot_volume_y_label.field.text() plots_volume[ "yy_scale_Volume_ratio"] = self.plot_volume_y_scale.field.value() plots_volume[ "calccol_name_Volume_ratio"] = self.plot_volume_calccol.field.text( ) # Plot Booleans self.variables["plotting_flags"][ "do_ext_bar"] = self.ext_bar_checkbox.isChecked() self.variables["plotting_flags"][ "do_comp_bar"] = self.comp_bar_checkbox.isChecked() self.variables["plotting_flags"][ "do_vert_bar"] = self.vert_bar_checkbox.isChecked() self.variables["plotting_flags"][ "do_res_evo"] = self.res_evo_checkbox.isChecked() self.variables["plotting_flags"][ "do_cs_scatter"] = self.scatter_checkbox.isChecked() self.variables["plotting_flags"]["do_cs_scatter_flower"] = \ self.scatter_flower_checkbox.isChecked() self.variables["plotting_flags"][ "do_heat_map"] = self.heat_map_checkbox.isChecked() self.variables["plotting_flags"][ "do_DPRE_plot"] = self.dpre_checkbox.isChecked() def run_farseer_calculation(self): self.parent().parent().parent().run_farseer_calculation() def load_variables(self): general = self.variables["general_settings"] fitting = self.variables["fitting_settings"] cs = self.variables["cs_settings"] csp = self.variables["csp_settings"] fasta = self.variables["fasta_settings"] plots_f1 = self.variables["PosF1_settings"] plots_f2 = self.variables["PosF2_settings"] plots_height = self.variables["Height_ratio_settings"] plots_volume = self.variables["Volume_ratio_settings"] # General Settings if os.path.exists(general["spectra_path"]): self.spectrum_path.field.setText(general["spectra_path"]) else: self.spectrum_path.field.setText(os.getcwd()) if os.path.exists(general["output_path"]): self.output_path.field.setText(general["output_path"]) else: self.output_path.field.setText(os.getcwd()) self.has_sidechains_checkbox.setChecked(general["has_sidechains"]) self.use_sidechains_checkbox.setChecked(general["use_sidechains"]) self.figure_height.setValue(general["fig_height"]) self.figure_width.setValue(general["fig_width"]) self.figure_dpi.setValue(general["fig_dpi"]) self.figure_format.select(general["fig_file_type"]) # Fitting Settings self.expand_missing_yy.setChecked(fitting["expand_missing_yy"]) self.expand_missing_zz.setChecked(fitting["expand_missing_zz"]) self.perform_comparisons_checkbox.setChecked( fitting["perform_comparisons"]) self.x_checkbox.setChecked(fitting["do_along_x"]) self.y_checkbox.setChecked(fitting["do_along_y"]) self.z_checkbox.setChecked(fitting["do_along_z"]) # CS Settings self.cs_correction.setChecked(cs["perform_cs_correction"]) self.cs_correction_res_ref.setValue(cs["cs_correction_res_ref"]) # CSP Settings self.csp_alpha.setValue(csp["csp_res4alpha"]) self.csp_missing.select(csp["cs_missing"]) # FASTA Settings self.apply_fasta_checkbox.checkBox.setChecked(fasta["applyFASTA"]) self.fasta_start.setValue(fasta["FASTAstart"]) # PRE settings self.do_pre_checkbox.setChecked( self.variables["pre_settings"]["apply_PRE_analysis"]) # Plot F1 Settings self.plot_F1_data.setChecked(plots_f1["calcs_PosF1_delta"]) self.plot_F1_y_label.field.setText(plots_f1["yy_label_PosF1_delta"]) self.plot_F1_y_scale.setValue(plots_f1["yy_scale_PosF1_delta"]) self.plot_F1_calccol.field.setText( plots_f1["calccol_name_PosF1_delta"]) # Plot F2 Settings self.plot_F2_data.setChecked(plots_f2["calcs_PosF2_delta"]) self.plot_F2_y_label.field.setText(plots_f2["yy_label_PosF2_delta"]) self.plot_F2_y_scale.setValue(plots_f2["yy_scale_PosF2_delta"]) self.plot_F2_calccol.field.setText( plots_f2["calccol_name_PosF2_delta"]) # Plot CSP Settings self.plot_CSP.setChecked(csp["calcs_CSP"]) self.plot_CSP_y_label.field.setText(csp["yy_label_CSP"]) self.plot_CSP_y_scale.setValue(csp["yy_scale_CSP"]) self.plot_CSP_calccol.field.setText(csp["calccol_name_CSP"]) # Plot Height Settings self.plot_height_ratio.setChecked(plots_height["calcs_Height_ratio"]) self.plot_height_y_label.field.setText( plots_height["yy_label_Height_ratio"]) self.plot_height_y_scale.setValue( plots_height["yy_scale_Height_ratio"]) self.plot_height_calccol.field.setText( plots_height["calccol_name_Height_ratio"]) # Plot Volume Settings self.plot_volume_ratio.setChecked(plots_volume["calcs_Volume_ratio"]) self.plot_volume_y_label.field.setText( plots_volume["yy_label_Volume_ratio"]) self.plot_volume_y_scale.setValue( plots_volume["yy_scale_Volume_ratio"]) self.plot_volume_calccol.field.setText( plots_volume["calccol_name_Volume_ratio"]) # Plot Booleans self.ext_bar_checkbox.setChecked( self.variables["plotting_flags"]["do_ext_bar"]) self.comp_bar_checkbox.setChecked( self.variables["plotting_flags"]["do_comp_bar"]) self.vert_bar_checkbox.setChecked( self.variables["plotting_flags"]["do_vert_bar"]) self.res_evo_checkbox.setChecked( self.variables["plotting_flags"]["do_res_evo"]) self.scatter_checkbox.setChecked( self.variables["plotting_flags"]["do_cs_scatter"]) self.scatter_flower_checkbox.setChecked( self.variables["plotting_flags"]["do_cs_scatter_flower"]) self.heat_map_checkbox.setChecked( self.variables["plotting_flags"]["do_heat_map"]) self.dpre_checkbox.setChecked( self.variables["plotting_flags"]["do_DPRE_plot"]) def show_popup(self, popup): popup(self).launch()