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.

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)[source]

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)[source]

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)[source]

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)[source]

Adds a filename to the list of recently used files.

Parameters:filename (str) – Path of file to be added to list.
closeEvent(event)[source]

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()[source]

Opens modal dialog to set options for exported bash script.

configure_sam2rma()[source]

Opens modal dialog to set options for sam2rma conversion.

delete_item()[source]

Delete currently selected item from model.

Returns:Success of delete operation.
Return type:bool
export_bash(options)[source]

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

init_ui()[source]

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

load_file(filename=None)[source]

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()[source]

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

move_current(positions)[source]

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()[source]

Move currently selected item down by one position.

Returns:Success of moving operation.
Return type:bool
move_current_up()[source]

Move currently selected item up by one position.

Returns:Success of moving operation.
Return type:bool
new_file()[source]

Handles pressing of the ‘New’ button.

ok_to_continue()[source]

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()[source]

Handles signal when statistics compilation has finished.

on_list_item_doubleclick()[source]

Toggle settings dock to inspect settings of doubleclicked item.

on_postprocessing_finished()[source]

Handles signal when post-processing has finished.

on_settings_change()[source]

Handle changes in the settings dialog.

Indicates unsaved settings and re-validates the workflow.

on_stderr()[source]

Handles STDERR output from subprocess.

on_stdout()[source]

Handles STDOUT output from subprocess.

on_stdout_stats()[source]

Handles STDOUT output from statistics file compilation.

on_tree_item_doubleclick()[source]

Clone doubleclicked item in tree view into the list.

on_validity_change(message=None)[source]

Show hints to resolve errors and prevent running invalid workflows.

Parameters:message (str, optional) – Message to be displayed in message dock.
on_workflow_finished()[source]

Starts post-processing after end of workflow process.

open_file()[source]

Handles pressing of the ‘Open’ button.

populate_file_menu()[source]

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

populate_filter_menu()[source]

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

populate_filters()[source]

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()[source]

Print current workflow command to console (debugging).

print_wf()[source]

Print current workflow to console (debugging).

print_xml()[source]

Print current workflow XML to console (debugging).

run_compile_stats_command()[source]

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

run_sam2rma_command()[source]

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

run_workflow_command()[source]

Runs the workflow.

save_file()[source]

Save workflow under current filename.

save_file_as()[source]

Saves workflow under a new filename.

show_about()[source]

Show an informative About dialog.

show_help()[source]

Open browser to show the online help.

stop_command()[source]

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)[source]

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)[source]

Updates window title and status bar.

Parameters:message (str, optional) – Message to be displayed in status bar.
validate_wf()[source]

Validate current workflow (debugging).

main()[source]

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)[source]

Handler for the SIGINT signal (Ctrl+C).

version module

Program version of SamSifter

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

Table Of Contents

Previous topic

pmdtools package

Next topic

samsifter.tools package

This Page