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-2015.
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 
38 // OpenMS_GUI config
40 
43 
44 #include <QtCore/QVector>
45 
46 namespace OpenMS
47 {
58  class OPENMS_GUI_DLLAPI TOPPASToolVertex :
59  public TOPPASVertex
60  {
61  Q_OBJECT
62 
63 public:
65  enum TOOLSTATUS {TOOL_READY, TOOL_SCHEDULED, TOOL_RUNNING, TOOL_SUCCESS, TOOL_CRASH, TOOLSTATUS_SIZE};
66 
68  struct IOInfo
69  {
71  IOInfo() :
72  type(IOT_FILE),
73  param_name(),
74  valid_types()
75  {
76  }
77 
79  IOInfo(const IOInfo & rhs) :
80  type(rhs.type),
81  param_name(rhs.param_name),
82  valid_types(rhs.valid_types)
83  {
84  }
85 
87  enum IOType
88  {
90  IOT_LIST
91  };
92 
94  bool operator<(const IOInfo & rhs) const
95  {
96  if (type != rhs.type)
97  {
98  return type == IOT_FILE;
99  }
100  else
101  {
102  return param_name.compare(rhs.param_name) < 0;
103  }
104  }
105 
107  IOInfo & operator=(const IOInfo & rhs)
108  {
109  type = rhs.type;
110  param_name = rhs.param_name;
111  valid_types = rhs.valid_types;
112 
113  return *this;
114  }
115 
122  };
123 
127  TOPPASToolVertex(const String & name, const String & type = "");
129  TOPPASToolVertex(const TOPPASToolVertex & rhs);
131  virtual ~TOPPASToolVertex();
133  TOPPASToolVertex & operator=(const TOPPASToolVertex & rhs);
134 
136  virtual String getName() const;
138  const String & getType() const;
140  void getInputParameters(QVector<IOInfo> & input_infos) const;
142  void getOutputParameters(QVector<IOInfo> & output_infos) const;
143  // documented in base class
144  virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
145  // documented in base class
146  virtual QRectF boundingRect() const;
147  // documented in base class
148  virtual QPainterPath shape() const;
149  // documented in base class
150  virtual void setTopoNr(UInt nr);
151  // documented in base class
152  virtual void reset(bool reset_all_files = false);
154  void setParam(const Param & param);
156  const Param & getParam();
158  void run();
162  bool updateCurrentOutputFileNames(const RoundPackages & pkg, String & error_message);
164  TOOLSTATUS getStatus() const;
166  void editParam();
168  int numIterations();
170  String getFullOutputDirectory() const;
172  String getOutputDir() const;
174  void createDirs();
176  void openContainingFolder();
178  void openInTOPPView();
180  bool refreshParameters();
182  bool isToolReady() const;
184  void toggleBreakpoint();
186  virtual void emitToolStarted();
188  virtual bool invertRecylingMode();
189 
190 public slots:
191 
193  void executionFinished(int ec, QProcess::ExitStatus es);
195  void forwardTOPPOutput();
197  void toolStartedSlot();
199  void toolFinishedSlot();
201  void toolCrashedSlot();
203  void toolFailedSlot();
205  virtual void toolScheduledSlot();
207  virtual void inEdgeHasChanged();
209  virtual void outEdgeHasChanged();
210 
211 signals:
212 
214  void toolStarted();
216  void toolFinished();
218  void toolCrashed();
220  void toolFailed(const QString & message = "");
222  void toppOutputReady(const QString & out);
223 
224 protected:
225 
227 
228  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * e);
230 
232  bool doesParamChangeInvalidate_();
234  bool renameOutput_();
236  bool initParam_(const QString & old_ini_file = "");
238  void getParameters_(QVector<IOInfo> & io_infos, bool input_params) const;
240  void writeParam_(const Param & param, const QString & ini_file);
242  QString toolnameWithWhitespacesForFancyWordWrapping_(QPainter * painter, const QString & str);
243 
256 
258  static UInt uid_;
259 
262 
265  void smartFileNames_(std::vector< QStringList >& filenames);
266 
267  };
268 }
269 
270 #endif
bool operator<(const IOInfo &rhs) const
Comparison operator.
Definition: TOPPASToolVertex.h:94
A more convenient string class.
Definition: String.h:57
A vertex representing a TOPP tool.
Definition: TOPPASToolVertex.h:58
Stores the information for input/output files/lists.
Definition: TOPPASToolVertex.h:68
The base class of the different vertex classes.
Definition: TOPPASVertex.h:101
Param param_
The parameters of the tool.
Definition: TOPPASToolVertex.h:251
String tmp_path_
The temporary path.
Definition: TOPPASToolVertex.h:249
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:255
Definition: TOPPASToolVertex.h:89
String type_
The type of the tool, or &quot;&quot; if it does not have a type.
Definition: TOPPASToolVertex.h:247
std::vector< RoundPackage > RoundPackages
all information a node needs to process all rounds
Definition: TOPPASVertex.h:138
IOInfo & operator=(const IOInfo &rhs)
Assignment operator.
Definition: TOPPASToolVertex.h:107
IOInfo(const IOInfo &rhs)
Copy constructor.
Definition: TOPPASToolVertex.h:79
IOInfo()
Standard constructor.
Definition: TOPPASToolVertex.h:71
bool breakpoint_set_
Breakpoint set?
Definition: TOPPASToolVertex.h:261
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:119
static UInt uid_
UID for output files.
Definition: TOPPASToolVertex.h:258
IOType
The type.
Definition: TOPPASToolVertex.h:87
IOType type
The type of the parameter.
Definition: TOPPASToolVertex.h:117
TOOLSTATUS
current status of the vertex
Definition: TOPPASToolVertex.h:65
TOOLSTATUS status_
current status of the tool
Definition: TOPPASToolVertex.h:253
String name_
The name of the tool.
Definition: TOPPASToolVertex.h:245
StringList valid_types
The valid file types for this parameter.
Definition: TOPPASToolVertex.h:121

OpenMS / TOPP release 2.0.0 Documentation generated on Wed Mar 30 2016 16:18:42 using doxygen 1.8.5