Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
TOPPASToolVertex.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2017.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Johannes Veit $
32 // $Authors: Johannes Junker, Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_VISUAL_TOPPASTOOLVERTEX_H
36 #define OPENMS_VISUAL_TOPPASTOOLVERTEX_H
37 
38 // OpenMS_GUI config
39 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
40 
43 
44 #include <QtCore/QVector>
45 
46 namespace OpenMS
47 {
48  class TOPPASScene;
49 
60  class OPENMS_GUI_DLLAPI TOPPASToolVertex :
61  public TOPPASVertex
62  {
63  Q_OBJECT
64 
65 public:
67  enum TOOLSTATUS {TOOL_READY, TOOL_SCHEDULED, TOOL_RUNNING, TOOL_SUCCESS, TOOL_CRASH, TOOLSTATUS_SIZE};
68 
70  struct IOInfo
71  {
73  IOInfo() :
74  type(IOT_FILE),
75  param_name(),
76  valid_types()
77  {
78  }
79 
81  IOInfo(const IOInfo& rhs) :
82  type(rhs.type),
83  param_name(rhs.param_name),
84  valid_types(rhs.valid_types)
85  {
86  }
87 
89  enum IOType
90  {
92  IOT_LIST
93  };
94 
96  bool operator<(const IOInfo& rhs) const
97  {
98  if (type != rhs.type)
99  {
100  return type == IOT_FILE;
101  }
102  else
103  {
104  return param_name.compare(rhs.param_name) < 0;
105  }
106  }
107 
109  IOInfo& operator=(const IOInfo& rhs)
110  {
111  type = rhs.type;
112  param_name = rhs.param_name;
113  valid_types = rhs.valid_types;
114 
115  return *this;
116  }
117 
119  static bool isAnyList(const QVector<IOInfo>& params)
120  {
121  for (QVector<IOInfo>::const_iterator it = params.begin();
122  it != params.end(); ++it)
123  {
124  if (it->type == IOT_LIST) return true;
125  }
126  return false;
127  }
128 
135  };
136 
140  TOPPASToolVertex(const String& name, const String& type = "");
144  virtual ~TOPPASToolVertex();
146  TOPPASToolVertex& operator=(const TOPPASToolVertex& rhs);
147 
149  virtual String getName() const;
151  const String& getType() const;
153  void getInputParameters(QVector<IOInfo>& input_infos) const;
155  void getOutputParameters(QVector<IOInfo>& output_infos) const;
156  // documented in base class
157  virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
158  // documented in base class
159  virtual QRectF boundingRect() const;
160  // documented in base class
161  virtual QPainterPath shape() const;
162  // documented in base class
163  virtual void setTopoNr(UInt nr);
164  // documented in base class
165  virtual void reset(bool reset_all_files = false);
167  void setParam(const Param& param);
169  const Param& getParam();
171  void run();
175  bool updateCurrentOutputFileNames(const RoundPackages& pkg, String& error_message);
177  TOOLSTATUS getStatus() const;
179  void editParam();
181  int numIterations();
183  String getFullOutputDirectory() const;
185  String getOutputDir() const;
187  void createDirs();
189  void openContainingFolder();
191  void openInTOPPView();
193  bool refreshParameters();
195  bool isToolReady() const;
197  void toggleBreakpoint();
199  virtual void emitToolStarted();
201  virtual bool invertRecylingMode();
202 
203 public slots:
204 
206  void executionFinished(int ec, QProcess::ExitStatus es);
208  void forwardTOPPOutput();
210  void toolStartedSlot();
212  void toolFinishedSlot();
214  void toolCrashedSlot();
216  void toolFailedSlot();
218  virtual void toolScheduledSlot();
220  virtual void inEdgeHasChanged();
222  virtual void outEdgeHasChanged();
223 
224 signals:
225 
227  void toolStarted();
229  void toolFinished();
231  void toolCrashed();
233  void toolFailed(const QString& message = "");
235  void toppOutputReady(const QString& out);
236 
237 protected:
238 
240 
241  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* e);
243 
244 
246  TOPPASScene* getScene_() const;
247 
249  bool doesParamChangeInvalidate_();
251  bool renameOutput_();
253  bool initParam_(const QString& old_ini_file = "");
255  void getParameters_(QVector<IOInfo>& io_infos, bool input_params) const;
257  void writeParam_(const Param& param, const QString& ini_file);
259  QString toolnameWithWhitespacesForFancyWordWrapping_(QPainter* painter, const QString& str);
260 
273 
276 
279  void smartFileNames_(std::vector<QStringList>& filenames);
280 
281  };
282 }
283 
284 #endif
A container for all visual items of a TOPPAS workflow.
Definition: TOPPASScene.h:86
A more convenient string class.
Definition: String.h:57
A vertex representing a TOPP tool.
Definition: TOPPASToolVertex.h:60
Stores the information for input/output files/lists.
Definition: TOPPASToolVertex.h:70
The base class of the different vertex classes.
Definition: TOPPASVertex.h:101
Param param_
The parameters of the tool.
Definition: TOPPASToolVertex.h:268
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
String tmp_path_
The temporary path.
Definition: TOPPASToolVertex.h:266
static bool isAnyList(const QVector< IOInfo > &params)
Is any of the input/output parameters a list?
Definition: TOPPASToolVertex.h:119
bool tool_ready_
tool initialization status: if C&#39;tor was successful in finding the TOPP tool, this is set to &#39;true&#39; ...
Definition: TOPPASToolVertex.h:272
Definition: TOPPASToolVertex.h:91
String type_
The type of the tool, or "" if it does not have a type.
Definition: TOPPASToolVertex.h:264
std::vector< RoundPackage > RoundPackages
all information a node needs to process all rounds
Definition: TOPPASVertex.h:173
IOInfo & operator=(const IOInfo &rhs)
Assignment operator.
Definition: TOPPASToolVertex.h:109
IOInfo(const IOInfo &rhs)
Copy constructor.
Definition: TOPPASToolVertex.h:81
IOInfo()
Standard constructor.
Definition: TOPPASToolVertex.h:73
bool breakpoint_set_
Breakpoint set?
Definition: TOPPASToolVertex.h:275
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:74
Management and storage of parameters / INI files.
Definition: Param.h:75
String param_name
The name of the parameter.
Definition: TOPPASToolVertex.h:132
IOType
The type.
Definition: TOPPASToolVertex.h:89
IOType type
The type of the parameter.
Definition: TOPPASToolVertex.h:130
TOOLSTATUS
current status of the vertex
Definition: TOPPASToolVertex.h:67
TOOLSTATUS status_
current status of the tool
Definition: TOPPASToolVertex.h:270
bool operator<(const IOInfo &rhs) const
Comparison operator.
Definition: TOPPASToolVertex.h:96
String name_
The name of the tool.
Definition: TOPPASToolVertex.h:262
StringList valid_types
The valid file types for this parameter.
Definition: TOPPASToolVertex.h:134

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:04 using doxygen 1.8.13