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

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