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 
29 namespace pwiz{
30 namespace 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
pwiz
Definition: ChromatogramList_Filter.hpp:36
pwiz::analysis::SpectrumPeakExtractor::_maxValue
double _maxValue
the maximum m/z that will be searched for peaks across the full m/z range.
Definition: SpectrumPeakExtractor.hpp:67
MSData.hpp
pwiz::chemistry::MZTolerance
struct for expressing m/z tolerance in either amu or ppm
Definition: MZTolerance.hpp:38
pwiz::analysis::SpectrumPeakExtractor::numPeaks
size_t numPeaks() const
Returns the number of peaks extracted.
DemuxTypes::MatrixType
Matrix< DemuxScalar, Dynamic, Dynamic > MatrixType
Definition: DemuxTypes.hpp:38
pwiz::analysis::SpectrumPeakExtractor
Extracts sets of centroided peaks from spectra using a user-defined list of peaks to extract.
Definition: SpectrumPeakExtractor.hpp:33
pwiz::msdata::Spectrum_const_ptr
boost::shared_ptr< const msdata::Spectrum > Spectrum_const_ptr
Definition: DemuxTypes.hpp:29
pwiz::analysis::SpectrumPeakExtractor::_ranges
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.
Definition: SpectrumPeakExtractor.hpp:59
pwiz::analysis::SpectrumPeakExtractor::operator()
void operator()(msdata::Spectrum_const_ptr spectrum, MatrixType &matrix, size_t rowNum, double weight=1.0) const
Extracts centroided peaks from an input spectrum.
DemuxHelpers.hpp
pwiz::analysis::SpectrumPeakExtractor::_numPeakBins
size_t _numPeakBins
the number of peaks given in the search list peakMzList. This is also the number of centroids that wi...
Definition: SpectrumPeakExtractor.hpp:61
pwiz::analysis::SpectrumPeakExtractor::_maxDelta
double _maxDelta
the m/z half-window size to bin around a peak based on the set ppm error.
Definition: SpectrumPeakExtractor.hpp:63
pwiz::analysis::SpectrumPeakExtractor::_minValue
double _minValue
the minimum m/z that will be searched for peaks across the full m/z range.
Definition: SpectrumPeakExtractor.hpp:65
pwiz::analysis::SpectrumPeakExtractor::SpectrumPeakExtractor
SpectrumPeakExtractor(const std::vector< double > &peakMzList, const pwiz::chemistry::MZTolerance &massError)
Generates a SpectrumPeakExtractor.
DemuxSolver.hpp