OpenMS  2.7.0
MetaDataBrowser.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-2021.
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: Timo Sachsenberg $
32 // $Authors: Marc Sturm $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 // OpenMS_GUI config
38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
39 
44 
45 //QT
46 #include <QtWidgets/QDialog>
47 #include <QtWidgets/QTreeWidget>
48 class QTreeWidgetItem;
49 class QPushButton;
50 class QStackedWidget;
51 class QHBoxLayout;
52 class QVBoxLayout;
53 class QGridLayout;
54 
55 namespace OpenMS
56 {
57  class BaseVisualizerGUI;
58  class Acquisition;
59  class AcquisitionInfo;
60  class ContactPerson;
61  class Digestion;
62  class ExperimentalSettings;
63  class Gradient;
64  class HPLC;
65  class PeptideIdentification;
66  class Instrument;
67  class IonDetector;
68  class IonSource;
69  class MassAnalyzer;
70  class MetaInfo;
71  class MetaInfoDescription;
72  class MetaInfoInterface;
73  class MetaInfoRegistry;
74  class Modification;
75  class PeptideHit;
76  class Precursor;
77  class DataProcessing;
78  class ProteinHit;
79  class ProteinIdentification;
80  class Sample;
81  class SampleTreatment;
82  class Software;
83  class SourceFile;
84  class SpectrumSettings;
85  class Tagging;
86  class DocumentIdentifier;
87  class Product;
88 
104  class OPENMS_GUI_DLLAPI MetaDataBrowser :
105  public QDialog
106  {
107  Q_OBJECT
108 
109 public:
110 
112  MetaDataBrowser(bool editable = false, QWidget * parent = nullptr, bool modal = false);
113 
115  void add(PeakMap & exp)
116  {
117  add(static_cast<ExperimentalSettings &>(exp));
118  treeview_->expandItem(treeview_->findItems(QString::number(0), Qt::MatchExactly, 1).first());
119  }
120 
122  void add(MSSpectrum & spectrum)
123  {
124  //spectrum settings
125  add(static_cast<SpectrumSettings &>(spectrum));
126 
127  //MetaInfoDescriptions
128  for (Size i = 0; i < spectrum.getFloatDataArrays().size(); ++i)
129  {
130  add(spectrum.getFloatDataArrays()[i]);
131  }
132  for (Size i = 0; i < spectrum.getIntegerDataArrays().size(); ++i)
133  {
134  add(spectrum.getIntegerDataArrays()[i]);
135  }
136  for (Size i = 0; i < spectrum.getStringDataArrays().size(); ++i)
137  {
138  add(spectrum.getStringDataArrays()[i]);
139  }
140 
141  add(static_cast<MetaInfoInterface &>(spectrum));
142 
143  treeview_->expandItem(treeview_->findItems(QString::number(0), Qt::MatchExactly, 1).first());
144  }
145 
147  void add(FeatureMap& map)
148  {
149  //identifier
150  add(static_cast<DocumentIdentifier &>(map));
151 
152  //protein ids
153  for (Size i = 0; i < map.getProteinIdentifications().size(); ++i)
154  {
155  add(map.getProteinIdentifications()[i]);
156  }
157 
158  //unassigned peptide ids
159  for (Size i = 0; i < map.getUnassignedPeptideIdentifications().size(); ++i)
160  {
162  }
163 
164  treeview_->expandItem(treeview_->findItems(QString::number(0), Qt::MatchExactly, 1).first());
165  }
166 
168  void add(Feature & feature);
170  void add(ConsensusFeature & feature);
171 
173  void add(ConsensusMap & map);
174 
180  template <class MetaDataType>
181  void add(MetaDataType & meta_data_object)
182  {
183  visualize_(meta_data_object);
184  treeview_->expandItem(treeview_->findItems(QString::number(0), Qt::MatchExactly, 1).first());
185  }
186 
188  bool isEditable();
189 
193 
194 public slots:
195 
197  void setStatus(std::string status);
198 
199 protected slots:
200 
202  void showDetails_();
203 
205  void saveAll_();
206 
207 protected:
208 
210 
211  void visualize_(ExperimentalSettings & meta, QTreeWidgetItem * parent = nullptr);
212  void visualize_(SpectrumSettings & meta, QTreeWidgetItem * parent = nullptr);
213  void visualize_(MetaInfoInterface & meta, QTreeWidgetItem * parent = nullptr);
214  void visualize_(Sample & meta, QTreeWidgetItem * parent = nullptr);
215  void visualize_(HPLC & meta, QTreeWidgetItem * parent = nullptr);
216  void visualize_(Digestion & meta, QTreeWidgetItem * parent = nullptr);
217  void visualize_(Modification & meta, QTreeWidgetItem * parent = nullptr);
218  void visualize_(Tagging & meta, QTreeWidgetItem * parent = nullptr);
219  void visualize_(Gradient & meta, QTreeWidgetItem * parent = nullptr);
220  void visualize_(Software & meta, QTreeWidgetItem * parent = nullptr);
221  void visualize_(ScanWindow & meta, QTreeWidgetItem * parent = nullptr);
222  void visualize_(SourceFile & meta, QTreeWidgetItem * parent = nullptr);
223  void visualize_(ContactPerson & meta, QTreeWidgetItem * parent = nullptr);
224  void visualize_(Instrument & meta, QTreeWidgetItem * parent = nullptr);
225  void visualize_(IonSource & meta, QTreeWidgetItem * parent = nullptr);
226  void visualize_(IonDetector & meta, QTreeWidgetItem * parent = nullptr);
227  void visualize_(MassAnalyzer & meta, QTreeWidgetItem * parent = nullptr);
228  void visualize_(DataProcessingPtr & meta, QTreeWidgetItem * parent = nullptr);
229  void visualize_(ProteinIdentification & meta, QTreeWidgetItem * parent = nullptr);
230  void visualize_(ProteinHit & meta, QTreeWidgetItem * parent = nullptr);
231  void visualize_(PeptideHit & meta, QTreeWidgetItem * parent = nullptr);
232  void visualize_(Acquisition & meta, QTreeWidgetItem * parent = nullptr);
233  void visualize_(AcquisitionInfo & meta, QTreeWidgetItem * parent = nullptr);
234  void visualize_(MetaInfoDescription & meta, QTreeWidgetItem * parent = nullptr);
235  void visualize_(Precursor & meta, QTreeWidgetItem * parent = nullptr);
236  void visualize_(Product & meta, QTreeWidgetItem * parent = nullptr);
237  void visualize_(InstrumentSettings & meta, QTreeWidgetItem * parent = nullptr);
238  void visualize_(PeptideIdentification & meta, QTreeWidgetItem * parent = nullptr);
239  void visualize_(DocumentIdentifier & meta, QTreeWidgetItem * parent = nullptr);
241 
243  template <typename ContainerType>
244  void visualizeAll_(ContainerType & container, QTreeWidgetItem * parent)
245  {
246  for (typename ContainerType::iterator it = container.begin(); it != container.end(); ++it)
247  {
248  visualize_(*it, parent);
249  }
250  }
251 
254 
256  void filterHits_(double threshold, bool higher_better, int tree_item_id);
258  void showAllHits_(int tree_item_id);
259 
261  std::string status_list_;
262 
264  bool editable_;
265 
267  QStackedWidget * ws_;
269  QPushButton * saveallbutton_;
271  QPushButton * closebutton_;
273  QPushButton * cancelbutton_;
275  QPushButton * undobutton_;
276 
279  };
280 }
Description of the combination of raw data to a single spectrum.
Definition: AcquisitionInfo.h:55
Information about one raw data spectrum that was combined with several other raw data spectra.
Definition: Acquisition.h:51
A base class for all visualizer classes.
Definition: BaseVisualizerGUI.h:66
A consensus feature spanning multiple LC-MS/MS experiments.
Definition: ConsensusFeature.h:71
A container for consensus elements.
Definition: ConsensusMap.h:88
Contact person information.
Definition: ContactPerson.h:49
Meta information about digestion of a sample.
Definition: Digestion.h:51
Manage source document information.
Definition: DocumentIdentifier.h:56
Description of the experimental settings.
Definition: ExperimentalSettings.h:62
A container for features.
Definition: FeatureMap.h:105
const std::vector< ProteinIdentification > & getProteinIdentifications() const
non-mutable access to the protein identifications
const std::vector< PeptideIdentification > & getUnassignedPeptideIdentifications() const
non-mutable access to the unassigned peptide identifications
An LC-MS feature.
Definition: Feature.h:72
Representation of a HPLC gradient.
Definition: Gradient.h:53
Representation of a HPLC experiment.
Definition: HPLC.h:51
Description of the settings a MS Instrument was run with.
Definition: InstrumentSettings.h:49
Description of a MS instrument.
Definition: Instrument.h:65
Description of a ion detector (part of a MS Instrument)
Definition: IonDetector.h:48
Description of an ion source (part of a MS Instrument)
Definition: IonSource.h:49
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:80
The representation of a 1D spectrum.
Definition: MSSpectrum.h:71
const IntegerDataArrays & getIntegerDataArrays() const
Returns a const reference to the integer meta data arrays.
const FloatDataArrays & getFloatDataArrays() const
Returns a const reference to the float meta data arrays.
const StringDataArrays & getStringDataArrays() const
Returns a const reference to the string meta data arrays.
Description of a mass analyzer (part of a MS Instrument)
Definition: MassAnalyzer.h:49
A meta data visualization widget.
Definition: MetaDataBrowser.h:106
void visualize_(PeptideHit &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(SpectrumSettings &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(InstrumentSettings &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(Gradient &meta, QTreeWidgetItem *parent=nullptr)
QPushButton * cancelbutton_
Cancel Button.
Definition: MetaDataBrowser.h:273
void visualize_(Sample &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(Instrument &meta, QTreeWidgetItem *parent=nullptr)
void filterHits_(double threshold, bool higher_better, int tree_item_id)
Filters hits according to a score threshold. Takes the score orientation into account.
void visualize_(AcquisitionInfo &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(ProteinIdentification &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(ExperimentalSettings &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(ProteinHit &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(ContactPerson &meta, QTreeWidgetItem *parent=nullptr)
void add(ConsensusMap &map)
Adds a consensus map.
void visualize_(IonSource &meta, QTreeWidgetItem *parent=nullptr)
std::string status_list_
A list of setting errors due to invalid formats.
Definition: MetaDataBrowser.h:261
void visualizeAll_(ContainerType &container, QTreeWidgetItem *parent)
Visualizes all elements of a container.
Definition: MetaDataBrowser.h:244
void visualize_(Digestion &meta, QTreeWidgetItem *parent=nullptr)
bool isEditable()
Check if mode is editable or not.
MetaDataBrowser(bool editable=false, QWidget *parent=nullptr, bool modal=false)
Constructor with flag for edit mode.
QStackedWidget * ws_
A widgetstack that keeps track of all widgets.
Definition: MetaDataBrowser.h:267
void showAllHits_(int tree_item_id)
Shows hits.
void add(Feature &feature)
Adds a feature.
QTreeWidget * treeview_
The tree.
Definition: MetaDataBrowser.h:278
QPushButton * saveallbutton_
Save button.
Definition: MetaDataBrowser.h:269
void visualize_(Precursor &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(MetaInfoDescription &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(MetaInfoInterface &meta, QTreeWidgetItem *parent=nullptr)
QPushButton * closebutton_
Close Button.
Definition: MetaDataBrowser.h:271
void saveAll_()
Saves all changes and close explorer.
bool editable_
Indicates the mode.
Definition: MetaDataBrowser.h:264
void visualize_(SourceFile &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(Modification &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(PeptideIdentification &meta, QTreeWidgetItem *parent=nullptr)
void add(FeatureMap &map)
Adds a feature map.
Definition: MetaDataBrowser.h:147
QPushButton * undobutton_
Undo Button.
Definition: MetaDataBrowser.h:275
void visualize_(IonDetector &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(Software &meta, QTreeWidgetItem *parent=nullptr)
void showDetails_()
Raises the corresponding viewer from the widget stack according to the item selected in the tree.
void add(PeakMap &exp)
Adds a peak map.
Definition: MetaDataBrowser.h:115
void visualize_(DocumentIdentifier &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(Acquisition &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(Product &meta, QTreeWidgetItem *parent=nullptr)
void add(MSSpectrum &spectrum)
Adds a peak spectrum.
Definition: MetaDataBrowser.h:122
void visualize_(ScanWindow &meta, QTreeWidgetItem *parent=nullptr)
void setStatus(std::string status)
Set a list of error strings due to invalid date format.
void add(MetaDataType &meta_data_object)
A generic function to add data.
Definition: MetaDataBrowser.h:181
void add(ConsensusFeature &feature)
Adds a consensus feature.
void visualize_(HPLC &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(MassAnalyzer &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(DataProcessingPtr &meta, QTreeWidgetItem *parent=nullptr)
void visualize_(Tagging &meta, QTreeWidgetItem *parent=nullptr)
void connectVisualizer_(BaseVisualizerGUI *ptr)
Connects the Signals of all visualiser classes with Slot setStatus()
Description of the meta data arrays of MSSpectrum.
Definition: MetaInfoDescription.h:50
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:61
Meta information about chemical modification of a sample.
Definition: Modification.h:53
Representation of a peptide hit.
Definition: PeptideHit.h:57
Class that displays all meta information for PeptideIdentification objects.
Definition: PeptideIdentificationVisualizer.h:57
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:65
Precursor meta information.
Definition: Precursor.h:61
Product meta information.
Definition: Product.h:50
Representation of a protein hit.
Definition: ProteinHit.h:60
Class that displays all meta information for ProteinIdentification objects.
Definition: ProteinIdentificationVisualizer.h:57
Representation of a protein identification run.
Definition: ProteinIdentification.h:72
Meta information about the sample.
Definition: Sample.h:61
Description of the software used for processing.
Definition: Software.h:50
Description of a file location, used to store the origin of (meta) data.
Definition: SourceFile.h:48
Representation of 1D spectrum settings.
Definition: SpectrumSettings.h:65
Meta information about tagging of a sample e.g. ICAT labeling.
Definition: Tagging.h:51
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: DataProcessing.h:135
Scan window description.
Definition: ScanWindow.h:48