### Navigation

- index
- modules |
- next |
- previous |
- SamSifter 0.5.6 documentation »
- SamSifter API documentation »

# samsifter package

SamSifter - A Workflow Editor for Metagenomic Analysis.

SamSifter helps you create filter workflows for next-generation sequencing data. It is primarily used to process SAM files generated by MALT prior to metagenomic analysis in MEGAN.

Next to the module `samsifter.samsifter`, which runs the actual SamSifter GUI, and the small `samsifter.version`, which specifies the current release number in a central place, this package also contains several subpackages with all classes and functions the program relies on:

- tools contains the filters and tools that can be used in workflows,
- gui contains the basic building blocks for the GUI,
- models and views handle the underlying data structures,
- resources bundles icons and other data files,
- util contains useful shared classes and functions, and
- stats contains scripts for post-processing of workflow statistics.

## Subpackages

- samsifter.tools package
  - bam_2_sam module
  - calculate_pmds module
  - compress module
  - count_taxon_reads module
  - decompress module
  - filter_read_conservation module
  - filter_read_identity module
  - filter_read_list module
  - filter_read_pmds module
  - filter_ref_coverage module
  - filter_ref_identity module
  - filter_ref_list module
  - filter_ref_pmds module
  - filter_taxon_list module
  - filter_taxon_pmds module
  - remove_duplicates module
  - sam_2_bam module
  - sort_by_coordinates module
  - sort_by_names module
- samsifter.gui package
  - composites module
  - dialogs module
  - widgets module
- samsifter.models package
  - filter module
  - filter_model module
  - parameter module
  - workflow module
- samsifter.resources package
- samsifter.stats package
  - compile_stats module
  - summarize_stats module
- samsifter.util package
  - arg_sanitation module
  - genetics module
  - papertrail module
  - sam module
  - serialize module
  - validation module
  - filters module
- samsifter.views package
  - filterviews module

## samsifter module

SamSifter helps you create filter workflows for NGS data.

It is primarily used to process SAM files generated by MALT prior to metagenomic analysis in MEGAN.

class `MainWindow`(verbose=False, debug=False)

  Bases: `PyQt4.QtGui.QMainWindow`

  Main window of SamSifter GUI interface.

  Provides a central list view of filter items and freely arrangeable docks for filter settings, toolbox and log messages.

  `addActions`(target, actions)

    Adds actions in list to target menu.

    Overrides Qt4 base method to also insert separators for ‘None’ entries.

    Parameters: | target (QMenu) – Target menu. actions (list of QAction) – List of actions to be inserted into menu.

  `add_filter`(item)

    Insert cloned copy of filter item into the list model.

    Note

    C++ QWidgets do NOT support pythonic copy/deepcopy/pickle! Thus they can not be easily encoded to/decoded from MIME for standard Qt4 drag&drop support and have to be cloned instead.

  `add_recent_file`(filename)

    Adds a filename to the list of recently used files.

    Parameters: | filename (str) – Path of file to be added to list.

  `closeEvent`(event)

    Confirm before exiting and save settings for next launch.

    Overrides parent QT class method to ask for confirmation and save window settings, unsaved files and preferences.

    Parameters: | event (QEvent) – Close event triggered by closing the main window or kernel signals.

  `configure_bash`()

    Opens modal dialog to set options for exported bash script.

  `configure_sam2rma`()

    Opens modal dialog to set options for sam2rma conversion.

  `debug` = None

    data models

  `delete_item`()

    Delete currently selected item from model.

    Returns: | Success of delete operation.
    Return type: | bool

  `export_bash`(options)

    Opens ‘Save as...’ dialogue and exports workflow to bash script.

  `init_ui`()

    Initialize GUI components (widgets, actions, menus and toolbars).

  `load_file`(filename=None)

    Open workflow data from file.

    Retrieves filename from user data of QAction when called from list of recently used files (signal emits a boolean).

    Parameters: | filename (str, optional) – Path of file to be opened.

  `load_initial_file`()

    Restore workflow from previous session, greet user on first use.

  `move_current`(positions)

    Move item in model.

    Parameters: | positions (int) – number of positions to move currently selected item (negative = up, positive = down)
    Returns: | Success of moving operation.
    Return type: | bool

  `move_current_down`()

    Move currently selected item down by one position.

    Returns: | Success of moving operation.
    Return type: | bool

  `move_current_up`()

    Move currently selected item up by one position.

    Returns: | Success of moving operation.
    Return type: | bool

  `new_file`()

    Handles pressing of the ‘New’ button.

  `ok_to_continue`()

    Asks user for confirmation to save any unsaved changes.

    Returns: | True if ok to continue, False if unsaved changes still exist.
    Return type: | bool

  `on_compilation_finished`()

    Handles signal when statistics compilation has finished.

  `on_list_item_doubleclick`()

    Toggle settings dock to inspect settings of doubleclicked item.

  `on_postprocessing_finished`()

    Handles signal when post-processing has finished.

  `on_settings_change`()

    Handle changes in the settings dialog.

    Indicates unsaved settings and re-validates the workflow.

  `on_stderr`()

    Handles STDERR output from subprocess.

  `on_stdout`()

    Handles STDOUT output from subprocess.

  `on_stdout_stats`()

    Handles STDOUT output from statistics file compilation.

  `on_tree_item_doubleclick`()

    Clone doubleclicked item in tree view into the list.

  `on_validity_change`(message=None)

    Show hints to resolve errors and prevent running invalid workflows.

    Parameters: | message (str, optional) – Message to be displayed in message dock.

  `on_workflow_finished`()

    Starts post-processing after end of workflow process.

  `open_file`()

    Handles pressing of the ‘Open’ button.

  `pid` = None

    viewers and controllers

  `populate_file_menu`()

    Fills the ‘File’ menu with actions and recently used files.

  `populate_filter_menu`()

    Creates entries in the ‘Edit > Add filter...’ menu.

  `populate_filters`()

    Compiles available filters to group them into named categories.

    Note

    To add a new filter or tool to the menu of available items simply choose a category and append your `samsifter.models.filter.FilterItem` to the corresponding list. This is usually done by calling the `item()` method of your module in package `samsifter.tools`. Entries will be sorted by category name and item name prior to display in the GUI so the order within the list does not matter.

    In order to call the `item()` method of your new module you will also have to import it in the header of this module.

  `print_command`()

    Print current workflow command to console (debugging).

  `print_wf`()

    Print current workflow to console (debugging).

  `print_xml`()

    Print current workflow XML to console (debugging).

  `run_compile_stats_command`()

    Runs command to compile temp statistics files into one CSV file.

  `run_sam2rma_command`()

    Runs command to create RMA file from (zipped) SAM file.

  `run_workflow_command`()

    Runs the workflow.

  `save_file`()

    Save workflow under current filename.

  `save_file_as`()

    Saves workflow under a new filename.

  `show_about`()

    Show an informative About dialog.

  `show_help`()

    Open browser to show the online help.

  `stop_command`()

    Terminates current process and all child processes.

    Default termination of QProcess won’t work here because bash spawns independent children that will continue to run. TODO: Use POSIX command ‘kill $(ps -o pid= –ppid $PID)’ where pkill is not available

  `update_settings_view`(current_idx, previous_idx)

    Updates filter settings view upon change of focus in workflow.

    Parameters: | current_idx (QModelIndex) – Model index of currently focussed filter item. previous_idx (QModelIndex) – Model index of previously focussed filter item.

  `update_status`(message=None)

    Updates window title and status bar.

    Parameters: | message (str, optional) – Message to be displayed in status bar.

  `validate_wf`()

    Validate current workflow (debugging).

`main`()

  Executable for SamSifter GUI.

  See `--help` for details on expected arguments. Takes no input from STDIN but logs errors and messages to STDERR.

`sigint_handler`(*args)

  Handler for the SIGINT signal (Ctrl+C).

## version module

Program version of SamSifter

Follows the semantic versioning style as described at http://semver.org/.

### Navigation

- index
- modules |
- next |
- previous |
- SamSifter 0.5.6 documentation »
- SamSifter API documentation »