ProteoWizard
SpectrumPeakExtractor.hpp
Go to the documentation of this file.
1//
2// $Id$
3//
4//
5// Original author: Jarrett Egertson <jegertso .@. uw.edu>
6//
7// Licensed under the Apache License, Version 2.0 (the "License");
8// you may not use this file except in compliance with the License.
9// You may obtain a copy of the License at
10//
11// http://www.apache.org/licenses/LICENSE-2.0
12//
13// Unless required by applicable law or agreed to in writing, software
14// distributed under the License is distributed on an "AS IS" BASIS,
15// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16// See the License for the specific language governing permissions and
17// limitations under the License.
18//
19
20#ifndef _SPECTRUMPEAKEXTRACTOR_HPP
21#define _SPECTRUMPEAKEXTRACTOR_HPP
22
23#include <vector>
25#include <boost/smart_ptr/shared_array.hpp>
26#include "DemuxSolver.hpp"
27#include "DemuxHelpers.hpp"
28
29namespace pwiz{
30namespace analysis{
31
32 /// Extracts sets of centroided peaks from spectra using a user-defined list of peaks to extract
34 {
35 public:
36
37 /// Generates a SpectrumPeakExtractor
38 /// \param peakMzList The m/z values around which will be searched to centroid peaks.
39 /// The size of this list defines how many peak centroids will be output.
40 /// \param ppmError The tolerance that defines how far around a nominal peak to search relative to its m/z.
41 /// \pre The peakMzList must be sorted from smallest to largest mz values with no duplicates.
42 SpectrumPeakExtractor(const std::vector<double>& peakMzList, const pwiz::chemistry::MZTolerance& massError);
43
44 /// Extracts centroided peaks from an input spectrum.
45 /// The peaks extracted are chosen from the peakMzList provided during initialization of the SpectrumPeakExtractor.
46 /// Peaks are extracted to a user-defined row of a user-provided matrix.
47 /// \param[in] spectrum Spectrum from which peaks are searched and binned.
48 /// \param[out] matrix The matrix into which peaks will be extracted.
49 /// \param[in] rowNum The index of the matrix row to extract peaks to.
50 /// \param[in] weight The relative weight to apply to this row (multiplies the output row by the given scalar).
51 /// \pre The size of the output matrix row must be the same as the size of the peakMzList given during instantiation.
52 void operator()(msdata::Spectrum_const_ptr spectrum, MatrixType& matrix, size_t rowNum, double weight=1.0) const;
53
54 /// Returns the number of peaks extracted
55 size_t numPeaks() const;
56
57 private:
58
59 boost::shared_array< std::pair<double, double> > _ranges; ///< defines the set of m/z windows to search, one for each peak in the search list.
60
61 size_t _numPeakBins; ///< the number of peaks given in the search list peakMzList. This is also the number of centroids that will be output.
62
63 double _maxDelta; ///< the m/z half-window size to bin around a peak based on the set ppm error.
64
65 double _minValue; ///< the minimum m/z that will be searched for peaks across the full m/z range.
66
67 double _maxValue; ///< the maximum m/z that will be searched for peaks across the full m/z range.
68 };
69
70} // namespace analysis
71} // namespace pwiz
72
73#endif // _SPECTRUMPEAKEXTRACTOR_HPP
Helper functions for demultiplexing Helper functions include nice methods of accessing CV parameters ...
Extracts sets of centroided peaks from spectra using a user-defined list of peaks to extract.
void operator()(msdata::Spectrum_const_ptr spectrum, MatrixType &matrix, size_t rowNum, double weight=1.0) const
Extracts centroided peaks from an input spectrum.
SpectrumPeakExtractor(const std::vector< double > &peakMzList, const pwiz::chemistry::MZTolerance &massError)
Generates a SpectrumPeakExtractor.
double _maxValue
the maximum m/z that will be searched for peaks across the full m/z range.
double _maxDelta
the m/z half-window size to bin around a peak based on the set ppm error.
boost::shared_array< std::pair< double, double > > _ranges
defines the set of m/z windows to search, one for each peak in the search list.
double _minValue
the minimum m/z that will be searched for peaks across the full m/z range.
size_t numPeaks() const
Returns the number of peaks extracted.
size_t _numPeakBins
the number of peaks given in the search list peakMzList. This is also the number of centroids that wi...
Matrix< DemuxScalar, Dynamic, Dynamic > MatrixType
boost::shared_ptr< const msdata::Spectrum > Spectrum_const_ptr
struct for expressing m/z tolerance in either amu or ppm