### Navigation

- index
- modules |
- next |
- previous |
- SamSifter 1.0.0 documentation »
- SamSifter API documentation »
- samsifter package »

# samsifter.gui package

Widgets, dialogs and corresponding data containers for the SamSifter GUI.

## composites module

Composed widgets used to visualize filter parameters in a vertical form layout.

class `FileChooser`(parent=None, suffix_string='CSV files (*.csv *.CSV)')

  Bases: `PyQt4.QtGui.QWidget`

  Combined LineEdit and Pushbutton for standard file dialog to select a file.

  `get_filename`()
  `get_suffix_string`()
  `highlight`(boolean=True)

    Indicates errors or pending actions by changing background color.

    Parameters: | boolean (bool, optional) – Enable highlighting of the QlineEdit widget, defaults to True.

  `set_filename`(filename)

    Sets a new filename.

    Maintains cursor position and validates the input on the fly. Tooltips and highlights of the QLineEdit widget are set to help resolving potential errors.

    Parameters: | filename (str) – Path to existing and readable input file.

  `set_suffix_string`(suffix_string)
  `show_dialog`()

    Opens OS-specific file selection dialog in user’s home directory.

class `OptionSwitcher`(parent=None, options=(True, False))

  Bases: `PyQt4.QtGui.QWidget`

  Group of coupled radio buttons to choose between exclusive options.

  Defaults to a simple True or False switch but arbitrary lists of options are supported and their options internally referenced by list indices. The first option in a list is considered the default value.

  `get_current_index`()
  `get_options`()
  `set_current_index`(index)
  `set_options`(options)

class `SliderSpinboxCombo`(parent=None, minimum=0.0, maximum=100.0, default=0.0, precision=2)

  Bases: `PyQt4.QtGui.QWidget`

  Slider coupled with Spinbox for setting numerical values between a minimum and maximum.

  `denormalize`(value)

    Translates normalized slider values to absolute spinbox values.

    Parameters: | value (float) – Current value of slider widget.

  `get_value`()
  `normalize`(value)

    Translates absolute spinbox values to normalized slider values.

    Parameters: | value (float) – Current value of spinbox widget.

  `on_slider_value_change`(value)

    Handle changes to the slider value.

    Parameters: | value (float) – New value of slider widget.

  `on_spinner_value_change`(value)

    Handle changes to the spinbox value.

    Parameters: | value (float) – New value of spinbox widget.

  `set_value`(value)

## dialogs module

Dialogs to configure options for Bash script export and SAM2RMA.

This module also includes container objects for the specified options.

class `BashOptions`(use_basenames=True, processing_mode=3, print_commands=False, stop_on_error=True)

  Bases: `builtins.object`

  Options for the export of a workflow to a bash script.

  `PARALLEL_MODE` = 3
  `SEQUENTIAL_MODE` = 2
  `SINGLE_MODE` = 1
  `get_print_commands`()
  `get_processing_mode`()
  `get_stop_on_error`()
  `get_use_basenames`()
  `set_print_commands`(boolean=True)
  `set_processing_mode`(mode=3)
  `set_stop_on_error`(boolean=True)
  `set_use_basenames`(boolean=False)

class `BashOptionsDialog`(parent=None)

  Bases: `PyQt4.QtGui.QDialog`

  Modal dialog to set Bash script export options.

  Switches between three types of processing modes and sets the Bash options to print executed commands and/or stop on errors.

  The available processing modes are:

  1. Single Mode processes only the specified input file and produces the specified output file similar to running the workflow in the GUI. This mode should be used with unmodified filenames unless all input files are located in the same directory as the exported bash script.
  2. Sequential Mode processes a list of arbitrary input files one file after another and saves the output to files renamed with the filename extension `sifted`. This mode should be used with shortened filenames unless all of the required list files (CSV) are available at identical paths from all machines that this script is deployed to.
  3. Parallel Mode speeds up the process by distributing jobs across all available CPU cores and running them in parallel. This requires the installation of GNU `parallel`. Similar to sequential mode above it should be used with shortened filenames unless all of the required list files (CSV) are available at identical paths from all machines that this script is deployed to.
  `get_options`()

    Shows dialog and returns options unless user decides to cancel.

    Returns: | New Bash export settings.
    Return type: | BashOptions

  `save_options`()

    Stores current settings in BashOptions object to be returned.

    Closes the dialog when done.

class `RmaOptions`(sam2rma_path='/usr/local/megan/tools/sam2rma', top_percent=1, max_expected=0.01, min_score=50, min_support_percent=0.05, min_support=1)

  Bases: `builtins.object`

  Options for the conversion of SAM to RMA files.

  Based on the command line arguments of SAM2RMA released with MEGAN 5.8.3. Sets default options as used by the Krause Lab in February 2015.

  `get_max_expected`()
  `get_min_score`()
  `get_min_support`()
  `get_min_support_percent`()
  `get_sam2rma_path`()
  `get_top_percent`()
  `set_max_expected`(max_expected)
  `set_min_score`(min_score)
  `set_min_support`(min_support)
  `set_min_support_percent`(min_support_percent)
  `set_sam2rma_path`(sam2rma_path)
  `set_top_percent`(top_percent)

class `RmaOptionsDialog`(saved_options=None, parent=None)

  Bases: `PyQt4.QtGui.QDialog`

  Modal dialog to set SAM2RMA conversion settings.

  `get_options`()

    Shows dialog and returns options unless user decides to cancel.

    Returns: | New SAM2RMA settings.
    Return type: | RmaOptions

  `reset_form`()

    Resets all form elements to defaults.

  `save_options`()

    Stores current settings in BashOptions object to be returned.

    Closes the dialog when done.

## widgets module

Widgets for the main component of the SamSifter GUI representing workflows.

class `FilterWidget`(item, parent=None)

  Bases: `PyQt4.QtGui.QWidget`

  Representation of a filter action in GUI.

  Shows name, description and input/output requirements for filter items. Further provides a simple way to edit settings for all parameters of a tool or filter. Parameters are divided between two tabs for a) required and b) optional parameters and the focus is set on the required parameters.

  `add_parameter`(parameter)

    Adds specific composite widget to the parameter form.

    Chooses the widget based on type of parameter and divides them between the required and the optional tab depending on parameter settings.

    Parameters: | parameter (FilterParameter) – Filter parameter to be displayed.

  `on_value_change`(value)

    Handles changes to editor values by emitting another signal.

  `value_changed`

class `InputWidget`(parent=None)

  Bases: `PyQt4.QtGui.QWidget`

  Representation of file input action in GUI.

  Provides a way to specify the input file for the workflow.

  `highlight`(boolean=True)

    Indicates errors or pending actions by changing background color.

    Parameters: | boolean (bool) – Activate highlighting of errors, defaults to True.

  `set_filename`(filename)

    Update filename in text box.

    Retains current cursor position despite updates.

    Parameters: | filename (str) – Readable path to an existing directory for the existing input file.

  `show_dialog`()

    Opens OS-specific file selection dialog to set the input file.

class `OutputWidget`(parent=None)

  Bases: `PyQt4.QtGui.QWidget`

  Representation of file output action in GUI.

  Provides a way to specify an output file for the workflow and set options for post-processing, eg. the compilation of statistics files and creation of an RMA file.

  `highlight`(boolean=True)

    Indicates errors or pending actions by changing background color.

    Parameters: | boolean (bool) – Activate highlighting of errors, defaults to True.

  `set_filename`(filename)

    Updates filename in text box.

    Retains current cursor position despite updates.

    Parameters: | filename (str) – Writable path to an existing directory for the new output file.

  `show_dialog`()

    Opens OS-specific file selection dialog to specify output file.

### Navigation

- index
- modules |
- next |
- previous |
- SamSifter 1.0.0 documentation »
- SamSifter API documentation »
- samsifter package »