This file is indexed.

/usr/include/OpenMS/VISUAL/DIALOGS/LayerStatisticsDialog.h is in libopenms-dev 1.11.1-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
// --------------------------------------------------------------------------
//                   OpenMS -- Open-Source Mass Spectrometry
// --------------------------------------------------------------------------
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
// ETH Zurich, and Freie Universitaet Berlin 2002-2013.
//
// This software is released under a three-clause BSD license:
//  * Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
//  * Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
//  * Neither the name of any author or any participating institution
//    may be used to endorse or promote products derived from this software
//    without specific prior written permission.
// For a full list of authors, refer to the file AUTHORS.
// --------------------------------------------------------------------------
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// --------------------------------------------------------------------------
// $Maintainer: Timo Sachsenberg $
// $Authors: Marc Sturm $
// --------------------------------------------------------------------------


#ifndef OPENMS_VISUAL_DIALOGS_LAYERSTATISTICSDIALOG_H
#define OPENMS_VISUAL_DIALOGS_LAYERSTATISTICSDIALOG_H

#include <OpenMS/VISUAL/DIALOGS/UIC/ui_LayerStatisticsDialog.h>
#include <OpenMS/VISUAL/LayerData.h>

#include <QtGui/QPushButton>

#include <utility>
#include <map>

namespace OpenMS
{
  class SpectrumWidget;
  class SpectrumCanvas;

  /**
      @brief Dialog showing statistics about the data of the current layer

      @ingroup Dialogs
  */
  class OPENMS_GUI_DLLAPI LayerStatisticsDialog :
    public QDialog,
    public Ui::LayerStatisticsDialogTemplate
  {
    Q_OBJECT

public:

    /// Constructor
    LayerStatisticsDialog(SpectrumWidget * parent);

protected slots:

    /// Shows the distribution accoring to the clicked button
    void showDistribution_();

protected:

    /**
        @brief Struct representing the statistics about one meta information
    */
    struct MetaStatsValue_
    {
      MetaStatsValue_(unsigned long c = 0, DoubleReal mi = 0, DoubleReal ma = 0, DoubleReal a = 0)
      {
        count = c;
        min = mi;
        max = ma;
        avg = a;
      }

      unsigned long count;
      DoubleReal min, max, avg;
    };

    /// Iterates over peaks of a spectrum
    typedef LayerData::ExperimentType::SpectrumType::ConstIterator PeakIterator_;
    /// Iterates over features of a feature map
    typedef LayerData::FeatureMapType::ConstIterator FeatureIterator_;
    /// Iterates over features of a feature map
    typedef LayerData::ConsensusMapType::ConstIterator ConsensusIterator_;
    /// Iterates over the meta_stats map
    typedef std::map<UInt, MetaStatsValue_>::iterator MetaIterator_;

    /// Computes the statistics of a peak layer
    void computePeakStats_();
    /// Computes the statistics of a feature layer
    void computeFeatureStats_();
    /// Computes the statistics of a consensus feature layer
    void computeConsensusStats_();
    /// Computes the statistics of all meta data contained in the FloatDataArray or IntegerDataArray of an MSSpectrum
    template <typename MetaDataIterator>
    void computeMetaDataArrayStats_(MetaDataIterator begin, MetaDataIterator end);
    /// Brings the meta values of one @p meta_interface (a peak or feature) into the statistics
    void bringInMetaStats_(const MetaInfoInterface & meta_interface);
    /// Computes the averages of all meta values stored in meta_stats and meta_array_stats
    void computeMetaAverages_();

    /// Map containing the statistics about all meta information of the peaks/features in the layer
    std::map<UInt, MetaStatsValue_> meta_stats_;
    /// Map containing the statistics about the FloatDataArrays of all spectra in this layer
    std::map<String, MetaStatsValue_> meta_array_stats_;
    /// The canvas of the layer
    SpectrumCanvas * canvas_;
    /// The LayerData object we compute statistics about
    LayerData layer_data_;
    /// Minimum intensity value
    DoubleReal min_intensity_;
    /// Maximum intensity value
    DoubleReal max_intensity_;
    /// Average intensity value
    DoubleReal avg_intensity_;
    /// Minimum charge value
    DoubleReal min_charge_;
    /// Maximum charge value
    DoubleReal max_charge_;
    /// Average charge value
    DoubleReal avg_charge_;
    /// Minimum quality value
    DoubleReal min_quality_;
    /// Maximum quality value
    DoubleReal max_quality_;
    /// Average quality value
    DoubleReal avg_quality_;
    /// Minimum number of elements (for consensus features only)
    DoubleReal min_elements_;
    /// Maximum number of elements (for consensus features only)
    DoubleReal max_elements_;
    /// Average number of elements (for consensus features only)
    DoubleReal avg_elements_;

private:
    ///Not implemented
    LayerStatisticsDialog();

  };

  template <typename MetaDataIterator>
  void LayerStatisticsDialog::computeMetaDataArrayStats_(MetaDataIterator begin, MetaDataIterator end)
  {
    for (MetaDataIterator meta_array_it = begin; meta_array_it != end; meta_array_it++)
    {
      String meta_name = meta_array_it->getName();
      MetaStatsValue_ meta_stats_value;
      std::map<String, MetaStatsValue_>::iterator it = meta_array_stats_.find(meta_name);
      if (it != meta_array_stats_.end())       // stats about this meta name already exist -> bring this value in
      {
        meta_stats_value = it->second;
        for (typename MetaDataIterator::value_type::const_iterator value_it = meta_array_it->begin(); value_it != meta_array_it->end(); value_it++)
        {
          Real value = *value_it;
          meta_stats_value.count++;
          if (value < meta_stats_value.min)
          {
            meta_stats_value.min = value;
          }
          else if (value > meta_stats_value.max)
          {
            meta_stats_value.max = value;
          }
          meta_stats_value.avg += value;
        }
        it->second = meta_stats_value;
      }
      else if (meta_array_it->size() > 0)    // meta name has not occurred before, create new stats for it:
      {
        Real init_value = *(meta_array_it->begin());
        meta_stats_value = MetaStatsValue_(0, init_value, init_value, 0);
        for (typename MetaDataIterator::value_type::const_iterator value_it = meta_array_it->begin(); value_it != meta_array_it->end(); value_it++)
        {
          Real value = *value_it;
          meta_stats_value.count++;
          if (value < meta_stats_value.min)
          {
            meta_stats_value.min = value;
          }
          else if (value > meta_stats_value.max)
          {
            meta_stats_value.max = value;
          }
          meta_stats_value.avg += value;
        }
        meta_array_stats_.insert(make_pair(meta_name, meta_stats_value));
      }
    }
  }

}
#endif // OPENMS_VISUAL_DIALOGS_LAYERSTATISTICSDIALOG_H