Models of entities involved in SamSifter workflows.
This package includes classes modeling entities such as
that are used as data models for the SamSifter GUI.
Abstraction of filters and other tools usable in POSIX pipelines.
Bases: PyQt4.QtGui.QStandardItem
Representation of filter tool in item-based views.
This class can abstract any tool that takes line-based input from STDIN, logs messages to STDERR and writes output to STDOUT. It is used to represent this tool in item-based views by means of an icon and descriptive text.
Each item has a list of parameters as well as input and output requirements in terms file format, sort order and compression.
Append parameter to list of parameters.
Parameters: | parameter (FilterParameter) – Parameter to be added to this filter. |
---|
Creates new instance with identical settings.
Returns: | Exact clone of this filter item. |
---|---|
Return type: | FilterItem |
Prints full bash command line for filter with all parameters.
Parameters: | basenames (bool) – Shorten file paths to filename only, defaults to False. |
---|---|
Returns: | Command to execute filter with all parameters. |
Return type: | str |
Creates a FilterWidget visualizing all parameters of this filter.
Returns: | Qt4 widget visualizing all parameters of this filter. |
---|---|
Return type: | FilterWidget |
Set command executed by filter.
Parameters: | command (str) – Command of tool in PATH, absolute path to binary or Python entry point to main method. |
---|
Set description of filter shown in GUI.
Parameters: | description (str) – Longer description of tool, should explain basic functionality. |
---|
Set resource path to icon representing the filter.
Parameters: | icon_path (str) – Path to icon in resource file. Use any of the FilterItem constants ICON_FILTER, ICON_ANALYZER, ICON_CONVERTER or ICON_SORTER. |
---|
Set the expected input compression.
Parameters: | compression (str) – Expected input compression. Use any of the compressions supported by FilterItem (‘uncompressed’, ‘gzip’, ‘any’). |
---|
Set the expected input format.
Parameters: | fileformat (str) – Expected file format. Use any of the formats supported by FilterItem (‘SAM’, ‘BAM’, ‘any’). |
---|
Set the expected input sort order.
Parameters: | sorting (str) – Expected read sort order. Use any of the sort orders supported by FilterItem (‘unsorted’, ‘queryname’, ‘coordinate’, ‘any’). |
---|
Set the provided output compression.
Parameters: | compression (str) – Provided output compression. Use any of the compressions supported by FilterItem (‘uncompressed’, ‘gzip’, ‘as_input’). |
---|
Set the provided output format.
Parameters: | fileformat (str) – Provided file format. Use any of the formats supported by FilterItem (‘SAM’, ‘BAM’, ‘as_input’). |
---|
Filter models for trees and lists.
Implementations of the standard Qt4 item-based models for trees (2 dimensions) and lists (1 dimension).
Warning
Drag&Drop is not fully implemented due to restrictions on the binary encoding of C++ objects using Python’s pickle. Pickling support is required to encode filter items to MIME on initiation of a drag event as well as to decode an item from MIME at the end of a drop event. However this would require the implementation of (de)serialization methods for the entire hierarchy of PyQt-wrapped C++ classes that are used in this project and currently don’t support pickle.
Thus, I have decided to simply override the double-click behaviour on filter items to emulate the drag&drop action with a similarly intuitive click&clone action. See samsifter.models.filter.FilterItem.clone() and samsifter.samsifter.MainWindow.init_ui() for details.
Bases: PyQt4.QtCore.QAbstractListModel
One-dimensional list model for filter items.
Represents data as a simple non-hierarchical sequence of items.
Supplies item data to views and delegates.
Generally, models only need to supply data for Qt.DisplayRole and any application-specific Qt.AccessibleTextRole, and Qt.AccessibleDescriptionRole. See the Qt.ItemDataRole enum documentation for information about the types associated with each role.
Implements abstract Qt4 base method.
Parameters: |
|
---|---|
Returns: |
|
Provides view with Qt flags for item at given index.
Must return an appropriate combination of flags for each item. In particular, the value returned by this function must include Qt::ItemIsEditable in addition to the values applied to items in a read-only model.
Used by other components to obtain information about each item provided by the model. In many models, the combination of flags should include Qt::ItemIsEnabled and Qt::ItemIsSelectable.
Implements abstract Qt4 method.
Parameters: | index (QModelIndex) – Model index of requested item. |
---|---|
Returns: | Combination of bit flags for item properties. |
Return type: | int |
Returns the index of the specified model item.
Implements abstract Qt4 base method.
Parameters: |
|
---|---|
Returns: | Model index of specified item (invalid if non-existant). |
Return type: | QModelIndex |
Insert filter item at specified position or append at end.
Implements abstract Qt4 base method.
Parameters: |
|
---|---|
Returns: | True on success. |
Return type: | bool |
Provides a lazy iterator over all filter items.
Yields: | FilterItem – The next filter item in the model. |
---|
Remove all rows.
Implements abstract Qt4 base method.
Parameters: | parent (QModelIndex, optional) – Parent of the item to be removed, defaults to invalid index. |
---|---|
Returns: | True on success. |
Return type: | bool |
Remove a single row.
Implements abstract Qt4 base method.
Parameters: |
|
---|---|
Returns: | True on success, False on valid index or invalid row number. |
Return type: | bool |
Remove several rows at once.
Used to remove rows and the items of data they contain from all types of model. Implementations must call beginRemoveRows() before inserting new columns into any underlying data structures, and call endRemoveRows() immediately afterwards.
Implements abstract Qt4 base method.
Parameters: | |
---|---|
Returns: | True on success, False on valid index or invalid row number. |
Return type: | bool |
Provides the number of rows of data exposed by the model.
Implements abstract Qt4 base method.
Returns: | Number of items (= rows) in model. |
---|---|
Return type: | int |
Drag actions supported by the model.
Used to return a combination of drop actions, indicating the types of drag and drop operations that the model accepts.
Overrides Qt4 base method.
Returns: | Combination of Qt drag actions (bit flags). |
---|---|
Return type: | int |
Drop actions supported by the model.
Used to return a combination of drop actions, indicating the types of drop operations that the model accepts.
Overrides Qt4 base method.
Returns: | Combination of Qt drop actions (bit flags). |
---|---|
Return type: | int |
Retrieves item and remove corresponding row.
Implements abstract Qt4 base method.
Parameters: | row (int, optional) – Target row, defaults to None resulting in deletion from the end. |
---|---|
Returns: |
|
Bases: PyQt4.QtGui.QStandardItemModel
Item-based two-dimensional model for filter items.
Can represent hierarchical and sequential data by implementing the QAbstractItemModel.
Different types of command line parameters.
Bases: samsifter.models.parameter.FilterParameter
Parameter setting filepath for input or output file.
Extends parameter base class with a list of supported file extensions and requirements for read and write access.
Representation of this parameter for debugging.
Extends base method with additional attributes.
Representation of this parameter on command line interface.
Overrides base method to handle option for shortened filepaths.
Parameters: | basenames (bool, optional) – Shorten file paths to filename only, defaults to False. |
---|---|
Returns: | Full command line argument for this parameter with optionally shortened filenames. |
Return type: | str |
Create new instance with identical settings.
Returns: | An exact copy of this instance. |
---|---|
Return type: | FilterParameter |
Bases: builtins.object
Abstraction of a general command line argument for standalone filters.
Serves as base class for thresholds and filepath arguments.
Create new instance with identical settings.
Returns: | Exact clone of this parameter. |
---|---|
Return type: | FilterParameter |
Activate parameter to force showing it on the commandline.
Parameters: | active (bool, optional) – Is parameter activated? Defaults to True. |
---|
Set the CLI name of the parameter, eg. --foo or -f.
Parameters: | cli_name (str) – Name of parameter in CLI, eg. --foo. |
---|
Set the default value used when no value is specified.
Parameters: | default (str) – Default value, required for GUI widget presets. |
---|
Set descriptive text of parameter.
Parameters: | desc (str) – Longer description of parameter in GUI, should explain details of usage. |
---|
Bases: samsifter.models.parameter.FilterParameter
Command line switch for a list of exclusive options.
Extends base class with a list of selectable options. Defaults to a simple binary switch between True and False.
Representation of this parameter for debugging.
Extends base method with additional attributes.
Representation of this parameter on command line interface.
Overrides base method to handle unset values.
Create new instance with identical settings.
Returns: | An exact copy of this instance. |
---|---|
Return type: | FilterSwitch |
Get specific option out of the available options.
Parameters: | index (int) – Index of option in list of options. |
---|---|
Returns: | Desired option (or None on invalid index) |
Return type: | str |
Bases: samsifter.models.parameter.FilterParameter
Abstraction of a numerical command line parameter used as treshold.
Extends filter parameter by minimum and maximum of permitted value range with variable precision and optional unit.
Representation of this parameter for debugging.
Extends base method with additional attributes.
Representation of this parameter on command line interface.
Overrides base method to handle unset values.
Create new instance with identical settings.
Returns: | Exact clone of this parameter. |
---|---|
Return type: | FilterThreshold |
Representation of this parameter in form layouts.
Overrides base method and provides additional information on unit.
Set maximum of value range.
Parameters: | maximum (float) – Maximum of permitted value range |
---|
Set minimum of value range.
Parameters: | minimum (float) – Minimum of permitted value range |
---|
Set precision of threshold.
Precision corresponds to the required number of decimals.
Parameters: | precision (int) – Number of required decimals for threshold. |
---|
Abstraction of workflows with input, tool pipeline and output.
Bases: PyQt4.QtCore.QObject
Container object for workflow related data.
Takes care of serialization and validation using specialized objects.
String representation of workflow.
Returns: | Hyphenated multiline commandline to run workflow. |
---|---|
Return type: | str |
Creates Bash-compatible commandline for entire workflow.
Parameters: |
|
---|---|
Returns: | Commandline to be run in Bash or subprocess. |
Return type: | str |
Lists supported file formats for saving and loading.
Returns: | List of file extensions with leading asterisk, eg. *.ssx. |
---|---|
Return type: | list of str |
Load from file using XML deserialization.
Parameters: | filename (str, optional) – Readable path to existing workflow file. |
---|---|
Returns: |
|
Saves file and picks filetype depending on extension.
Note
Currently redundant as only XML output is supported since binary output was dropped.
Parameters: | filename (str, optional) – Writable path of new workflow file. |
---|---|
Returns: |
|
Save to file using XML serialization.
Returns: |
|
---|
Write Bash script with optional batch processing capability.
The batch variants take filenames as arguments while the standard call processes only the explicitly set input file.
Parameters: |
|
---|
Represent workflow as XML tree.
Returns: | Pretty XML string representing entire workflow structure. |
---|---|
Return type: | str |