Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
LayerStatisticsDialog.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: Timo Sachsenberg $
32 // $Authors: Marc Sturm $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_VISUAL_DIALOGS_LAYERSTATISTICSDIALOG_H
36 #define OPENMS_VISUAL_DIALOGS_LAYERSTATISTICSDIALOG_H
37 
38 // OpenMS_GUI config
39 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
40 
41 #include <OpenMS/VISUAL/DIALOGS/UIC/ui_LayerStatisticsDialog.h>
43 
44 #include <QtGui/QPushButton>
45 
46 #include <utility>
47 #include <map>
48 
49 namespace OpenMS
50 {
51  class SpectrumWidget;
52  class SpectrumCanvas;
53 
59  class OPENMS_GUI_DLLAPI LayerStatisticsDialog :
60  public QDialog,
61  public Ui::LayerStatisticsDialogTemplate
62  {
63  Q_OBJECT
64 
65 public:
66 
69 
70 protected slots:
71 
73  void showDistribution_();
74 
75 protected:
76 
81  {
82  MetaStatsValue_(unsigned long c = 0, double mi = 0, double ma = 0, double a = 0)
83  {
84  count = c;
85  min = mi;
86  max = ma;
87  avg = a;
88  }
89 
90  unsigned long count;
91  double min, max, avg;
92  };
93 
101  typedef std::map<UInt, MetaStatsValue_>::iterator MetaIterator_;
102 
104  void computePeakStats_();
106  void computeFeatureStats_();
108  void computeConsensusStats_();
110  template <typename MetaDataIterator>
111  void computeMetaDataArrayStats_(MetaDataIterator begin, MetaDataIterator end);
113  void bringInMetaStats_(const MetaInfoInterface & meta_interface);
115  void computeMetaAverages_();
116 
118  std::map<UInt, MetaStatsValue_> meta_stats_;
120  std::map<String, MetaStatsValue_> meta_array_stats_;
132  double min_charge_;
134  double max_charge_;
136  double avg_charge_;
138  double min_quality_;
140  double max_quality_;
142  double avg_quality_;
149 
150 private:
153 
154  };
155 
156  template <typename MetaDataIterator>
157  void LayerStatisticsDialog::computeMetaDataArrayStats_(MetaDataIterator begin, MetaDataIterator end)
158  {
159  for (MetaDataIterator meta_array_it = begin; meta_array_it != end; meta_array_it++)
160  {
161  String meta_name = meta_array_it->getName();
162  MetaStatsValue_ meta_stats_value;
163  std::map<String, MetaStatsValue_>::iterator it = meta_array_stats_.find(meta_name);
164  if (it != meta_array_stats_.end()) // stats about this meta name already exist -> bring this value in
165  {
166  meta_stats_value = it->second;
167  for (typename MetaDataIterator::value_type::const_iterator value_it = meta_array_it->begin(); value_it != meta_array_it->end(); value_it++)
168  {
169  float value = *value_it;
170  meta_stats_value.count++;
171  if (value < meta_stats_value.min)
172  {
173  meta_stats_value.min = value;
174  }
175  else if (value > meta_stats_value.max)
176  {
177  meta_stats_value.max = value;
178  }
179  meta_stats_value.avg += value;
180  }
181  it->second = meta_stats_value;
182  }
183  else if (meta_array_it->size() > 0) // meta name has not occurred before, create new stats for it:
184  {
185  float init_value = *(meta_array_it->begin());
186  meta_stats_value = MetaStatsValue_(0, init_value, init_value, 0);
187  for (typename MetaDataIterator::value_type::const_iterator value_it = meta_array_it->begin(); value_it != meta_array_it->end(); value_it++)
188  {
189  float value = *value_it;
190  meta_stats_value.count++;
191  if (value < meta_stats_value.min)
192  {
193  meta_stats_value.min = value;
194  }
195  else if (value > meta_stats_value.max)
196  {
197  meta_stats_value.max = value;
198  }
199  meta_stats_value.avg += value;
200  }
201  meta_array_stats_.insert(make_pair(meta_name, meta_stats_value));
202  }
203  }
204  }
205 
206 }
207 #endif // OPENMS_VISUAL_DIALOGS_LAYERSTATISTICSDIALOG_H
Base::const_iterator ConstIterator
Definition: FeatureMap.h:139
std::map< String, MetaStatsValue_ > meta_array_stats_
Map containing the statistics about the FloatDataArrays of all spectra in this layer.
Definition: LayerStatisticsDialog.h:120
A more convenient string class.
Definition: String.h:57
double min_charge_
Minimum charge value.
Definition: LayerStatisticsDialog.h:132
double avg_elements_
Average number of elements (for consensus features only)
Definition: LayerStatisticsDialog.h:148
void computeMetaDataArrayStats_(MetaDataIterator begin, MetaDataIterator end)
Computes the statistics of all meta data contained in the FloatDataArray or IntegerDataArray of an MS...
Definition: LayerStatisticsDialog.h:157
double avg_quality_
Average quality value.
Definition: LayerStatisticsDialog.h:142
Base class for visualization canvas classes.
Definition: SpectrumCanvas.h:96
double min_elements_
Minimum number of elements (for consensus features only)
Definition: LayerStatisticsDialog.h:144
const double c
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
double max_charge_
Maximum charge value.
Definition: LayerStatisticsDialog.h:134
double min
Definition: LayerStatisticsDialog.h:91
double avg_intensity_
Average intensity value.
Definition: LayerStatisticsDialog.h:130
std::map< UInt, MetaStatsValue_ > meta_stats_
Map containing the statistics about all meta information of the peaks/features in the layer...
Definition: LayerStatisticsDialog.h:118
Dialog showing statistics about the data of the current layer.
Definition: LayerStatisticsDialog.h:59
double min_quality_
Minimum quality value.
Definition: LayerStatisticsDialog.h:138
std::map< UInt, MetaStatsValue_ >::iterator MetaIterator_
Iterates over the meta_stats map.
Definition: LayerStatisticsDialog.h:101
double avg
Definition: LayerStatisticsDialog.h:91
double avg_charge_
Average charge value.
Definition: LayerStatisticsDialog.h:136
LayerData::ExperimentType::SpectrumType::ConstIterator PeakIterator_
Iterates over peaks of a spectrum.
Definition: LayerStatisticsDialog.h:95
LayerData::ConsensusMapType::ConstIterator ConsensusIterator_
Iterates over features of a feature map.
Definition: LayerStatisticsDialog.h:99
double max_elements_
Maximum number of elements (for consensus features only)
Definition: LayerStatisticsDialog.h:146
Base class for spectrum widgets.
Definition: SpectrumWidget.h:74
LayerData layer_data_
The LayerData object we compute statistics about.
Definition: LayerStatisticsDialog.h:124
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:56
Struct representing the statistics about one meta information.
Definition: LayerStatisticsDialog.h:80
unsigned long count
Definition: LayerStatisticsDialog.h:90
std::vector< SpectrumType >::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSExperiment.h:118
LayerData::FeatureMapType::ConstIterator FeatureIterator_
Iterates over features of a feature map.
Definition: LayerStatisticsDialog.h:97
SpectrumCanvas * canvas_
The canvas of the layer.
Definition: LayerStatisticsDialog.h:122
MetaStatsValue_(unsigned long c=0, double mi=0, double ma=0, double a=0)
Definition: LayerStatisticsDialog.h:82
double max
Definition: LayerStatisticsDialog.h:91
double min_intensity_
Minimum intensity value.
Definition: LayerStatisticsDialog.h:126
std::vector< ConsensusFeature >::const_iterator ConstIterator
Non-mutable iterator.
Definition: ConsensusMap.h:137
double max_intensity_
Maximum intensity value.
Definition: LayerStatisticsDialog.h:128
double max_quality_
Maximum quality value.
Definition: LayerStatisticsDialog.h:140
Class that stores the data for one layer.
Definition: LayerData.h:62

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