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-2013.
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 Junker $
32 // $Authors: Johannes Junker, Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_VISUAL_TOPPASTOOLVERTEX_H
36 #define OPENMS_VISUAL_TOPPASTOOLVERTEX_H
37 
40 
41 #include <QtCore/QVector>
42 
43 namespace OpenMS
44 {
55  class OPENMS_GUI_DLLAPI TOPPASToolVertex :
56  public TOPPASVertex
57  {
58  Q_OBJECT
59 
60 public:
62  enum TOOLSTATUS {TOOL_READY, TOOL_SCHEDULED, TOOL_RUNNING, TOOL_SUCCESS, TOOL_CRASH, TOOLSTATUS_SIZE};
63 
65  struct IOInfo
66  {
68  IOInfo() :
69  type(IOT_FILE),
70  param_name(),
71  valid_types()
72  {
73  }
74 
76  IOInfo(const IOInfo & rhs) :
77  type(rhs.type),
78  param_name(rhs.param_name),
79  valid_types(rhs.valid_types)
80  {
81  }
82 
84  enum IOType
85  {
87  IOT_LIST
88  };
89 
91  bool operator<(const IOInfo & rhs) const
92  {
93  if (type != rhs.type)
94  {
95  return type == IOT_FILE;
96  }
97  else
98  {
99  return param_name.compare(rhs.param_name) < 0;
100  }
101  }
102 
104  IOInfo & operator=(const IOInfo & rhs)
105  {
106  type = rhs.type;
107  param_name = rhs.param_name;
108  valid_types = rhs.valid_types;
109 
110  return *this;
111  }
112 
119  };
120 
124  TOPPASToolVertex(const String & name, const String & type = "");
126  TOPPASToolVertex(const TOPPASToolVertex & rhs);
128  virtual ~TOPPASToolVertex();
130  TOPPASToolVertex & operator=(const TOPPASToolVertex & rhs);
131 
133  virtual String getName() const;
135  const String & getType() const;
137  void getInputParameters(QVector<IOInfo> & input_infos) const;
139  void getOutputParameters(QVector<IOInfo> & output_infos) const;
140  // documented in base class
141  virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
142  // documented in base class
143  virtual QRectF boundingRect() const;
144  // documented in base class
145  virtual QPainterPath shape() const;
146  // documented in base class
147  virtual void setTopoNr(UInt nr);
148  // documented in base class
149  virtual void reset(bool reset_all_files = false);
151  void setParam(const Param & param);
153  const Param & getParam();
155  void run();
159  bool updateCurrentOutputFileNames(const RoundPackages & pkg, String & error_message);
161  TOOLSTATUS getStatus() const;
163  void editParam();
165  int numIterations();
167  String getFullOutputDirectory() const;
169  String getOutputDir() const;
171  void createDirs();
173  void openContainingFolder();
175  void openInTOPPView();
177  bool refreshParameters();
179  bool isToolReady() const;
181  void toggleBreakpoint();
183  virtual void emitToolStarted();
185  virtual bool invertRecylingMode();
186 
187 public slots:
188 
190  void executionFinished(int ec, QProcess::ExitStatus es);
192  void forwardTOPPOutput();
194  void toolStartedSlot();
196  void toolFinishedSlot();
198  void toolCrashedSlot();
200  void toolFailedSlot();
202  virtual void toolScheduledSlot();
204  virtual void inEdgeHasChanged();
206  virtual void outEdgeHasChanged();
207 
208 signals:
209 
211  void toolStarted();
213  void toolFinished();
215  void toolCrashed();
217  void toolFailed(const QString & message = "");
219  void toppOutputReady(const QString & out);
220 
221 protected:
222 
224 
225  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * e);
227 
229  bool doesParamChangeInvalidate_();
231  bool renameOutput_();
233  bool initParam_(const QString & old_ini_file = "");
235  void getParameters_(QVector<IOInfo> & io_infos, bool input_params) const;
237  void writeParam_(const Param & param, const QString & ini_file);
239  QString toolnameWithWhitespacesForFancyWordWrapping_(QPainter * painter, const QString & str);
240 
253 
255  static UInt uid_;
256 
259 
262  void smartFileNames_(std::vector< QStringList >& filenames);
263 
264  };
265 }
266 
267 #endif
bool operator<(const IOInfo &rhs) const
Comparison operator.
Definition: TOPPASToolVertex.h:91
A more convenient string class.
Definition: String.h:56
A vertex representing a TOPP tool.
Definition: TOPPASToolVertex.h:55
Stores the information for input/output files/lists.
Definition: TOPPASToolVertex.h:65
The base class of the different vertex classes.
Definition: TOPPASVertex.h:98
Param param_
The parameters of the tool.
Definition: TOPPASToolVertex.h:248
String tmp_path_
The temporary path.
Definition: TOPPASToolVertex.h:246
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:252
Definition: TOPPASToolVertex.h:86
String type_
The type of the tool, or &quot;&quot; if it does not have a type.
Definition: TOPPASToolVertex.h:244
std::vector< RoundPackage > RoundPackages
all information a node needs to process all rounds
Definition: TOPPASVertex.h:135
IOInfo & operator=(const IOInfo &rhs)
Assignment operator.
Definition: TOPPASToolVertex.h:104
IOInfo(const IOInfo &rhs)
Copy constructor.
Definition: TOPPASToolVertex.h:76
IOInfo()
Standard constructor.
Definition: TOPPASToolVertex.h:68
bool breakpoint_set_
Breakpoint set?
Definition: TOPPASToolVertex.h:258
Management and storage of parameters / INI files.
Definition: Param.h:69
String param_name
The name of the parameter.
Definition: TOPPASToolVertex.h:116
static UInt uid_
UID for output files.
Definition: TOPPASToolVertex.h:255
String list.
Definition: StringList.h:56
IOType
The type.
Definition: TOPPASToolVertex.h:84
IOType type
The type of the parameter.
Definition: TOPPASToolVertex.h:114
TOOLSTATUS
current status of the vertex
Definition: TOPPASToolVertex.h:62
TOOLSTATUS status_
current status of the tool
Definition: TOPPASToolVertex.h:250
String name_
The name of the tool.
Definition: TOPPASToolVertex.h:242
StringList valid_types
The valid file types for this parameter.
Definition: TOPPASToolVertex.h:118

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:22 using doxygen 1.8.5