This file is indexed.

/usr/include/OpenMS/TRANSFORMATIONS/RAW2PEAK/PeakPickerSH.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
// --------------------------------------------------------------------------
//                   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: Florian Zeller $
// $Authors: Florian Zeller $
// --------------------------------------------------------------------------

#ifndef OPENMS_TRANSFORMATIONS_RAW2PEAK_PEAKPICKERSH_H
#define OPENMS_TRANSFORMATIONS_RAW2PEAK_PEAKPICKERSH_H

#include <OpenMS/KERNEL/MSExperiment.h>
#include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
#include <OpenMS/CONCEPT/ProgressLogger.h>

// TODO: Check if I need this # PeakPickerSH.h
#define DEBUG_PEAK_PICKING
#undef DEBUG_PEAK_PICKING

namespace OpenMS
{
  class OPENMS_DLLAPI PeakPickerSH :
    public DefaultParamHandler,
    public ProgressLogger
  {
public:
    PeakPickerSH();

    virtual ~PeakPickerSH();

    /**
     @brief Picks peaks in one spectrum.
    */
    template <typename PeakType>
    void pick(const MSSpectrum<PeakType> & input, MSSpectrum<PeakType> & output, float fWindowWidth)
    {
      int i, hw, j;
      double cm, toti, min_dh;

      // Hack: Prepare data structures for Lukas' algorithm
      std::vector<double> masses, intens;
      // TODO: Probably we could save some time when we resize the vectors... # PeakPickerSH.C
      //masses.resize(input.size());
      //intens.resize(input.size());
      for (Size k = 0; k < input.size() - 1; ++k)
      {
        // Lukas requires a minimum of intensity (=50). His vectors do not contain
        // other data, so I strip the low ones out right here.
        // TODO: Read 50.0 from parameters  # PeakPickerSH.C
        if (input[k].getIntensity() >= 50.0)
        {
          masses.push_back(input[k].getMZ());
          intens.push_back(input[k].getIntensity());
        }
      }

      min_dh = 50.0;              // min height
      hw = fWindowWidth / 2;

      for (i = 2; i < (int)masses.size() - 2; i++)
      {

        // Peak must be concave in the interval [i-2 .. i+2]
        if (intens[i] > min_dh && intens[i] > intens[i - 1] + min_dh && intens[i] >= intens[i + 1] && intens[i - 1] > intens[i - 2] + min_dh && intens[i + 1] >= intens[i + 2])
        {

          cm = 0.0;                   // centroid mass:
          toti = 0.0;             // total intensity:

          for (j = -hw; j <= hw; j++)
          {
            double inte = intens[i - j];
            double mz = masses[i - j];

            cm += inte * mz;
            toti += (double) intens[i - j];
          }
          cm = cm / toti;           // Centre of gravity = centroid

          PeakType peak;
          peak.setMZ(cm);
          peak.setIntensity(intens[i]);
          output.push_back(peak);
        }
      }
    }

    /**
     @brief Applies the peak-picking algorithm to a map (MSExperiment).
     
     This method picks peaks for each scan in the map consecutively. The
     resulting picked peaks are written to the output map.
    */
    void pickExperiment(const MSExperiment<> & input, MSExperiment<> & output);
  };
}

#endif