| OpenMS 2.5.0

Classes | Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TOPPASToolVertex Class Reference
Visual » TOPPAS

A vertex representing a TOPP tool. More...

`#include <OpenMS/VISUAL/TOPPASToolVertex.h>`

Inheritance diagram for TOPPASToolVertex:

## Classes

struct | IOInfo
| Stores the information for input/output files/lists. More...

## Public Types

enum | TOOLSTATUS { TOOL_READY, TOOL_SCHEDULED, TOOL_RUNNING, TOOL_SUCCESS, TOOL_CRASH, TOOLSTATUS_SIZE }
| current status of the vertex More...
Public Types inherited from TOPPASVertex
enum | DFS_COLOR { DFS_WHITE, DFS_GRAY, DFS_BLACK }
| The color of a vertex during depth-first search. More...
enum | SUBSTREESTATUS { TV_ALLFINISHED, TV_UNFINISHED, TV_UNFINISHED_INBRANCH }
| The color of a vertex during depth-first search. More...
typedef QList< TOPPASEdge * > | EdgeContainer
| The container for in/out edges. More...
typedef EdgeContainer::iterator | EdgeIterator
| A mutable iterator for in/out edges. More...
typedef EdgeContainer::const_iterator | ConstEdgeIterator
| A const iterator for in/out edges. More...
typedef std::map< Int, VertexRoundPackage > | RoundPackage
typedef RoundPackage::const_iterator | RoundPackageConstIt
typedef RoundPackage::iterator | RoundPackageIt
typedef std::vector< RoundPackage > | RoundPackages
| all information a node needs to process all rounds More...

## Public Slots

void | executionFinished (int ec, QProcess::ExitStatus es)
| Called when the execution of this tool has finished. More...
void | forwardTOPPOutput ()
| Called when the running TOPP tool produces output. More...
void | toolStartedSlot ()
| Called when the tool is started. More...
void | toolFinishedSlot ()
| Called when the tool has finished. More...
void | toolCrashedSlot ()
| Called when the tool has crashed. More...
void | toolFailedSlot ()
| Called when the tool has failed. More...
virtual void | toolScheduledSlot ()
| Called when the tool was scheduled for running. More...
void | inEdgeHasChanged () override
| Called by an incoming edge when it has changed. More...
void | outEdgeHasChanged () override
| Called by an outgoing edge when it has changed. More...
Public Slots inherited from TOPPASVertex
virtual void | inEdgeHasChanged ()
| Called by an incoming edge when it has changed. More...
virtual void | outEdgeHasChanged ()
| Called by an outgoing edge when it has changed. More...

## Signals

void | toolStarted ()
| Emitted when the tool is started. More...
void | toolFinished ()
| Emitted when the tool is finished. More...
void | toolCrashed ()
| Emitted when the tool crashes. More...
void | toolFailed (const QString &message="")
| Emitted when the tool execution fails. More...
void | toppOutputReady (const QString &out)
| Emitted from forwardTOPPOutput() to forward the signal outside. More...
Signals inherited from TOPPASVertex
void | clicked ()
| Emitted when this item is clicked. More...
void | released ()
| Emitted when this item is released. More...
void | hoveringEdgePosChanged (const QPointF &new_pos)
| Emitted when the position of the hovering edge changes. More...
void | newHoveringEdge (const QPointF &pos)
| Emitted when a new out edge is supposed to be created. More...
void | finishHoveringEdge ()
| Emitted when the mouse is released after having dragged a new edge somewhere. More...
void | somethingHasChanged ()
| Emitted when something has changed. More...
void | itemDragged (qreal dx, qreal dy)
| Emitted when the item is dragged. More...
void | parameterChanged (const bool invalidates_running_pipeline)

## Public Member Functions

| TOPPASToolVertex ()
| Default constructor. More...
| TOPPASToolVertex (const String &name, const String &type="")
| Constructor. More...
| TOPPASToolVertex (const TOPPASToolVertex &rhs)
| Copy constructor. More...
| ~TOPPASToolVertex () override=default
| Destructor. More...
TOPPASToolVertex & | operator= (const TOPPASToolVertex &rhs)
| Assignment operator. More...
String | getName () const override
| returns the name of the TOPP tool More...
const String & | getType () const
| Returns the type of the tool. More...
void | getInputParameters (QVector< IOInfo > &input_infos) const
| Fills `input_infos` with the required input file/list parameters together with their valid types. More...
void | getOutputParameters (QVector< IOInfo > &output_infos) const
| Fills `output_infos` with the required output file/list parameters together with their valid types. More...
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
QRectF | boundingRect () const override
| Returns the bounding rectangle of this item. More...
void | setTopoNr (UInt nr) override
| Sets the topological sort number (overridden in tool and output vertices) More...
void | reset (bool reset_all_files=false) override
void | setParam (const Param &param)
| Sets the Param object of this tool. More...
const Param & | getParam ()
| Returns the Param object of this tool. More...
void | run () override
| Checks if all parent nodes have finished the tool execution and, if so, runs the tool. More...
bool | updateCurrentOutputFileNames (const RoundPackages &pkg, String &error_message)
TOOLSTATUS | getStatus () const
| return if tool failed or is ready etc. More...
void | editParam ()
| Lets the user edit the parameters of the tool. More...
int | numIterations ()
| Returns the number of iterations this tool has to perform. More...
String | getFullOutputDirectory () const
| Returns the full directory (including preceding tmp path) More...
String | getOutputDir () const
| Returns the directory where this tool stores its output files. More...
void | createDirs ()
| Creates all necessary directories. More...
void | openContainingFolder ()
| Opens the folder where the file is contained. More...
void | openInTOPPView ()
| Opens the files in TOPPView. More...
bool | refreshParameters ()
| Refreshes the parameters of this tool, returns if their has been a change. More...
bool | isToolReady () const
| underlying TOPP tool found and parameters fetched?! (done in C'Tor) More...
void | toggleBreakpoint ()
| Toggle breakpoint. More...
virtual void | emitToolStarted ()
| Called when the QProcess in the queue is called: emits 'toolStarted()'. More...
bool | invertRecylingMode () override
| invert status of recycling (overriding base class) More...
Public Member Functions inherited from TOPPASVertex
| TOPPASVertex ()
| Default Constructor. More...
| TOPPASVertex (const TOPPASVertex &rhs)
| Copy constructor. More...
| ~TOPPASVertex () override=default
| Destructor. More...
TOPPASVertex & | operator= (const TOPPASVertex &rhs)
| Assignment operator. More...
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *, bool round_shape=true)
| base paint method for all derived classes. should be called first in child-class paint More...
bool | buildRoundPackages (RoundPackages &pkg, String &error_msg)
bool | isUpstreamFinished () const
| check if all upstream nodes are ready to go ( 'finished_' is true) More...
QPainterPath | shape () const final
| Returns a more precise shape. More...
ConstEdgeIterator | outEdgesBegin () const
| Returns begin() iterator of outgoing edges. More...
ConstEdgeIterator | outEdgesEnd () const
| Returns end() iterator of outgoing edges. More...
ConstEdgeIterator | inEdgesBegin () const
| Returns begin() iterator of incoming edges. More...
ConstEdgeIterator | inEdgesEnd () const
| Returns end() iterator of incoming edges. More...
Size | incomingEdgesCount ()
| Returns the number of incoming edges. More...
Size | outgoingEdgesCount ()
| Returns the number of outgoing edges. More...
void | addInEdge (TOPPASEdge *edge)
| Adds an incoming edge. More...
void | addOutEdge (TOPPASEdge *edge)
| Adds an outgoing edge. More...
void | removeInEdge (TOPPASEdge *edge)
| Removes an incoming edge. More...
void | removeOutEdge (TOPPASEdge *edge)
| Removes an outgoing edge. More...
DFS_COLOR | getDFSColor ()
| Returns the DFS color of this node. More...
void | setDFSColor (DFS_COLOR color)
| Sets the DFS color of this node. More...
TOPPASVertex::SUBSTREESTATUS | getSubtreeStatus () const
| Checks if all tools in the subtree below this node are finished. More...
bool | isTopoSortMarked ()
| Returns whether the vertex has been marked already (during topological sort) More...
void | setTopoSortMarked (bool b)
| (Un)marks the vertex (during topological sort) More...
UInt | getTopoNr ()
| Returns the topological sort number. More...
virtual void | markUnreachable ()
| Marks this node (and everything further downstream) as unreachable. Overridden behavior in mergers. More...
bool | isReachable ()
| Returns whether this node is reachable. More...
bool | isFinished () const
| Returns whether this node has already been processed during the current pipeline execution. More...
bool | isRecyclingEnabled () const
| get status of recycling More...
void | setRecycling (const bool is_enabled)
| set status of recycling More...
QStringList | getFileNames (int param_index, int round) const
| gets filenames for a certain output parameter (from this vertex), for a certain TOPPAS round More...
QStringList | getFileNames () const
| get all output files for all parameters for all rounds More...
const RoundPackages & | getOutputFiles () const
bool | allInputsReady ()
| check if all upstream nodes are finished More...

## Protected Member Functions

TOPPASScene * | getScene_ () const
| get parent Scene More...
bool | doesParamChangeInvalidate_ ()
| determines if according to current status_, a parameter change would invalidate the pipeline status (e.g., because this node was already processed) More...
bool | renameOutput_ ()
| renames SUFFICES of the output files created by the TOPP tool by inspecting file content More...
bool | initParam_ (const QString &old_ini_file="")
| Initializes the parameters with standard values (from -write_ini), uses the parameters from the old_ini_file if given, returns if parameters have changed (if old_ini_file was given) More...
void | getParameters_ (QVector< IOInfo > &io_infos, bool input_params) const
| Fills `io_infos` with the required input/output file/list parameters. If `input_params` is true, input params are returned, otherwise output params. More...
void | writeParam_ (const Param &param, const QString &ini_file)
| Writes `param` to the `ini_file`. More...
QString | toolnameWithWhitespacesForFancyWordWrapping_ (QPainter *painter, const QString &str)
| Helper method for finding good boundaries for wrapping the tool name. Returns a string with whitespaces at the preferred boundaries. More...
void | smartFileNames_ (std::vector< QStringList > &filenames)
reimplemented Qt events
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *e) override
Protected Member Functions inherited from TOPPASVertex
virtual void | moveNewEdgeTo_ (const QPointF &pos)
| Moves the target pos of the edge which is just being created to `pos`. More...
String | get3CharsNumber_ (UInt number) const
| Returns a three character string (i.e. 001 instead of 1) for the given `number`. More...
void | debugOut_ (const String &) const
| Displays the debug output `message`, if TOPPAS_DEBUG is defined. More...
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *e) override
void | mousePressEvent (QGraphicsSceneMouseEvent *e) override
void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *e) override
void | mouseMoveEvent (QGraphicsSceneMouseEvent *e) override
void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event) override

## Protected Attributes

String | name_
| The name of the tool. More...
String | type_
| The type of the tool, or "" if it does not have a type. More...
String | tmp_path_
| The temporary path. More...
Param | param_
| The parameters of the tool. More...
TOOLSTATUS | status_ {TOOL_READY}
| current status of the tool More...
bool | tool_ready_ {true}
| tool initialization status: if C'tor was successful in finding the TOPP tool, this is set to 'true' More...
bool | breakpoint_set_ {false}
| Breakpoint set? More...
Protected Attributes inherited from TOPPASVertex
EdgeContainer | in_edges_
| The list of incoming edges. More...
EdgeContainer | out_edges_
| The list of outgoing edges. More...
bool | edge_being_created_ {false}
| Indicates whether a new out edge is currently being created. More...
QColor | pen_color_ {Qt::black}
| The color of the pen. More...
QColor | brush_color_ { Qt::lightGray}
| The color of the brush. More...
DFS_COLOR | dfs_color_ {DFS_WHITE}
| The DFS color of this node. More...
bool | topo_sort_marked_ {false}
| "marked" flag for topological sort More...
UInt | topo_nr_
| The number in a topological sort of the entire graph. More...
RoundPackages | output_files_
| Stores the current output file names for each output parameter. More...
int | round_total_ {-1}
| number of rounds this node will do ('Merge All' nodes will pass everything, thus do only one round) More...
int | round_counter_ {0}
| currently finished number of rounds (TODO: do we need that?) More...
bool | finished_ {false}
| Stores whether this node has already been processed during the current pipeline execution. More...
bool | reachable_ {true}
| Indicates whether this node is reachable (i.e. there is an input node somewhere further upstream) More...
bool | allow_output_recycling_ {false}
| shall subsequent tools be allowed to recycle the output of this node to match the number of rounds imposed by other parent nodes? More...

## Detailed Description

A vertex representing a TOPP tool.

Besides TOPPASScene, this class contains most of the remaining functionality of TOPPAS regarding the execution of pipelines. Once a pipeline run is started from TOPPASScene, the execution is propagated from tool to tool and the TOPP tools are actually called from here.

## Member Enumeration Documentation

## ◆ TOOLSTATUS

enum TOOLSTATUS

current status of the vertex

Enumerator
TOOL_READY |
TOOL_SCHEDULED |
TOOL_RUNNING |
TOOL_SUCCESS |
TOOL_CRASH |
TOOLSTATUS_SIZE |

## Constructor & Destructor Documentation

## ◆ TOPPASToolVertex() [1/3]

TOPPASToolVertex | ( |  | ) |

Default constructor.

## ◆ TOPPASToolVertex() [2/3]

TOPPASToolVertex | ( | const String & | name,
|  | const String & | type = `""`
| ) |  |

Constructor.

## ◆ TOPPASToolVertex() [3/3]

TOPPASToolVertex | ( | const TOPPASToolVertex & | rhs | ) |

Copy constructor.

## ◆ ~TOPPASToolVertex()

~TOPPASToolVertex | ( |  | ) |

override default

Destructor.

## Member Function Documentation

## ◆ boundingRect()

QRectF boundingRect | ( |  | ) | const

override virtual

Returns the bounding rectangle of this item.

Implements TOPPASVertex.

## ◆ createDirs()

void createDirs | ( |  | ) |

Creates all necessary directories.

## ◆ doesParamChangeInvalidate_()

bool doesParamChangeInvalidate_ | ( |  | ) |

protected

determines if according to current status_, a parameter change would invalidate the pipeline status (e.g., because this node was already processed)

## ◆ editParam()

void editParam | ( |  | ) |

Lets the user edit the parameters of the tool.

## ◆ emitToolStarted()

virtual void emitToolStarted | ( |  | ) |

virtual

Called when the QProcess in the queue is called: emits 'toolStarted()'.

## ◆ executionFinished

void executionFinished | ( | int | ec,
|  | QProcess::ExitStatus | es
| ) |  |

slot

Called when the execution of this tool has finished.

## ◆ forwardTOPPOutput

void forwardTOPPOutput | ( |  | ) |

slot

Called when the running TOPP tool produces output.

## ◆ getFullOutputDirectory()

String getFullOutputDirectory | ( |  | ) | const

Returns the full directory (including preceding tmp path)

## ◆ getInputParameters()

void getInputParameters | ( | QVector< IOInfo > & | input_infos | ) | const

Fills `input_infos` with the required input file/list parameters together with their valid types.

## ◆ getName()

String getName | ( |  | ) | const

override virtual

returns the name of the TOPP tool

Implements TOPPASVertex.

Referenced by TOPPASBase::toolCrashed(), TOPPASBase::toolFailed(), TOPPASBase::toolFinished(), and TOPPASBase::toolStarted().

## ◆ getOutputDir()

String getOutputDir | ( |  | ) | const

Returns the directory where this tool stores its output files.

## ◆ getOutputParameters()

void getOutputParameters | ( | QVector< IOInfo > & | output_infos | ) | const

Fills `output_infos` with the required output file/list parameters together with their valid types.

## ◆ getParam()

const Param& getParam | ( |  | ) |

Returns the Param object of this tool.

## ◆ getParameters_()

void getParameters_ | ( | QVector< IOInfo > & | io_infos,
|  | bool | input_params
| ) |  | const

protected

Fills `io_infos` with the required input/output file/list parameters. If `input_params` is true, input params are returned, otherwise output params.

## ◆ getScene_()

TOPPASScene* getScene_ | ( |  | ) | const

protected

get parent Scene

## ◆ getStatus()

TOOLSTATUS getStatus | ( |  | ) | const

return if tool failed or is ready etc.

## ◆ getType()

const String& getType | ( |  | ) | const

Returns the type of the tool.

Referenced by TOPPASBase::toolCrashed(), TOPPASBase::toolFailed(), TOPPASBase::toolFinished(), and TOPPASBase::toolStarted().

## ◆ inEdgeHasChanged

void inEdgeHasChanged | ( |  | ) |

override slot

Called by an incoming edge when it has changed.

## ◆ initParam_()

bool initParam_ | ( | const QString & | old_ini_file = `""` | ) |

protected

Initializes the parameters with standard values (from -write_ini), uses the parameters from the old_ini_file if given, returns if parameters have changed (if old_ini_file was given)

## ◆ invertRecylingMode()

bool invertRecylingMode | ( |  | ) |

override virtual

invert status of recycling (overriding base class)

Reimplemented from TOPPASVertex.

## ◆ isToolReady()

bool isToolReady | ( |  | ) | const

underlying TOPP tool found and parameters fetched?! (done in C'Tor)

Referenced by TOPPASBase::insertNewVertex_().

## ◆ mouseDoubleClickEvent()

void mouseDoubleClickEvent | ( | QGraphicsSceneMouseEvent * | e | ) |

override protected

## ◆ numIterations()

int numIterations | ( |  | ) |

Returns the number of iterations this tool has to perform.

## ◆ openContainingFolder()

void openContainingFolder | ( |  | ) |

Opens the folder where the file is contained.

## ◆ openInTOPPView()

void openInTOPPView | ( |  | ) |

Opens the files in TOPPView.

## ◆ operator=()

TOPPASToolVertex& operator= | ( | const TOPPASToolVertex & | rhs | ) |

Assignment operator.

## ◆ outEdgeHasChanged

void outEdgeHasChanged | ( |  | ) |

override slot

Called by an outgoing edge when it has changed.

## ◆ paint()

void paint | ( | QPainter * | painter,
|  | const QStyleOptionGraphicsItem * | option,
|  | QWidget * | widget
| ) |  |

override

## ◆ refreshParameters()

bool refreshParameters | ( |  | ) |

Refreshes the parameters of this tool, returns if their has been a change.

## ◆ renameOutput_()

bool renameOutput_ | ( |  | ) |

protected

renames SUFFICES of the output files created by the TOPP tool by inspecting file content

## ◆ reset()

void reset | ( | bool | reset_all_files = `false` | ) |

override virtual

Resets the status

Parameters

  reset_all_files | Not used in this implementation, but in derived classes

Reimplemented from TOPPASVertex.

## ◆ run()

void run | ( |  | ) |

override virtual

Checks if all parent nodes have finished the tool execution and, if so, runs the tool.

Reimplemented from TOPPASVertex.

## ◆ setParam()

void setParam | ( | const Param & | param | ) |

Sets the Param object of this tool.

## ◆ setTopoNr()

void setTopoNr | ( | UInt | nr | ) |

override virtual

Sets the topological sort number (overridden in tool and output vertices)

Reimplemented from TOPPASVertex.

## ◆ smartFileNames_()

void smartFileNames_ | ( | std::vector< QStringList > & | filenames | ) |

protected

smart naming of round-based filenames when basename is not unique we take the preceding directory name

## ◆ toggleBreakpoint()

void toggleBreakpoint | ( |  | ) |

Toggle breakpoint.

## ◆ toolCrashed

void toolCrashed | ( |  | ) |

signal

Emitted when the tool crashes.

## ◆ toolCrashedSlot

void toolCrashedSlot | ( |  | ) |

slot

Called when the tool has crashed.

## ◆ toolFailed

void toolFailed | ( | const QString & | message = `""` | ) |

signal

Emitted when the tool execution fails.

## ◆ toolFailedSlot

void toolFailedSlot | ( |  | ) |

slot

Called when the tool has failed.

## ◆ toolFinished

void toolFinished | ( |  | ) |

signal

Emitted when the tool is finished.

## ◆ toolFinishedSlot

void toolFinishedSlot | ( |  | ) |

slot

Called when the tool has finished.

## ◆ toolnameWithWhitespacesForFancyWordWrapping_()

QString toolnameWithWhitespacesForFancyWordWrapping_ | ( | QPainter * | painter,
|  | const QString & | str
| ) |  |

protected

Helper method for finding good boundaries for wrapping the tool name. Returns a string with whitespaces at the preferred boundaries.

## ◆ toolScheduledSlot

virtual void toolScheduledSlot | ( |  | ) |

virtual slot

Called when the tool was scheduled for running.

## ◆ toolStarted

void toolStarted | ( |  | ) |

signal

Emitted when the tool is started.

## ◆ toolStartedSlot

void toolStartedSlot | ( |  | ) |

slot

Called when the tool is started.

## ◆ toppOutputReady

void toppOutputReady | ( | const QString & | out | ) |

signal

Emitted from forwardTOPPOutput() to forward the signal outside.

## ◆ updateCurrentOutputFileNames()

bool updateCurrentOutputFileNames | ( | const RoundPackages & | pkg,
|  | String & | error_message
| ) |  |

Updates the vector containing the lists of current output files for all output parameters using the input files as guidance Returns true on success, on failure the error_message is filled

## ◆ writeParam_()

void writeParam_ | ( | const Param & | param,
|  | const QString & | ini_file
| ) |  |

protected

Writes `param` to the `ini_file`.

## Member Data Documentation

## ◆ breakpoint_set_

bool breakpoint_set_ {false}

protected

Breakpoint set?

## ◆ name_

String name_

protected

The name of the tool.

## ◆ param_

Param param_

protected

The parameters of the tool.

## ◆ status_

TOOLSTATUS status_ {TOOL_READY}

protected

current status of the tool

## ◆ tmp_path_

String tmp_path_

protected

The temporary path.

## ◆ tool_ready_

bool tool_ready_ {true}

protected

tool initialization status: if C'tor was successful in finding the TOPP tool, this is set to 'true'

## ◆ type_

String type_

protected

The type of the tool, or "" if it does not have a type.