Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
MasstraceCorrelator.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-2017.
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: Hannes Roest $
32 // $Authors: Hannes Roest $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
41 
42 namespace OpenMS
43 {
44 
53  class OPENMS_DLLAPI MasstraceCorrelator :
54  public DefaultParamHandler,
55  public ProgressLogger
56  {
57 
58  public:
59 
61 
62  ~MasstraceCorrelator() override;
63 
64  // a mass trace is a vector of pairs in (RT, Intensity)
65  typedef std::vector<std::pair<double, double> > MasstracePointsType;
66 
80  void createPseudoSpectra(ConsensusMap& map, MSExperiment& pseudo_spectra,
81  Size min_peak_nr, double min_correlation, int max_lag,
82  double max_rt_apex_difference);
83 
84  /* Score two mass traces against each other
85  *
86  * This function scores two mass traces (vector of <RT,Intensity>) against each other:
87  *
88  * - The algorithm first creates 2 arrays that contain matched intensities
89  * in RT-space (accounting for missing data points and unequal length)
90  * - Next, these arrays are scored using cross-correlation scores and
91  * pearson coefficients.
92  *
93  * @note The pairs need to be sorted by the first entry (RT)
94  *
95  * @param hull_points1 The first input masstrace
96  * @param hull_points2 The second input masstrace
97  * @param lag The computed lag (output coelution score)
98  * @param lag_intensity The computed intensity at the lag (output shape score)
99  * @param pearson_score The computed pearson score (output)
100  * @param min_corr Minimal correlation needed to proceed computing the cross-correlations
101  * @param max_lag Currently unused
102  * @param mindiff Minimal differences for matching up the two mass traces
103  *
104  */
105  void scoreHullpoints(const MasstracePointsType& hull_points1, const MasstracePointsType& hull_points2,
106  int& lag, double& lag_intensity, double& pearson_score,
107  const double min_corr, const int max_lag, const double mindiff = 0.1);
108 
109  /* Create a cache of the features in a consensus map
110  *
111  * This creates a cache of the input consensus map by creating the
112  * following data structures:
113  * - a vector of mass traces (each mass trace is simply a vector of <RT,Intensity>
114  * - a vector of maximal intensities (max_rt, max_int)
115  * - a vector of retention times of the feature
116  *
117  * @param map The input consensus map
118  * @param feature_points The list of all mass traces
119  * @param max_intensities The list of maximal intensities
120  * @param rt_cache The list of retention times of all features
121  */
122  void createConsensusMapCache(const ConsensusMap& map,
123  std::vector<MasstracePointsType>& feature_points,
124  std::vector<std::pair<double, double> >& max_intensities,
125  std::vector<double>& rt_cache);
126 
127  protected:
128 
150  void matchMassTraces_(const MasstracePointsType& hull_points1, const MasstracePointsType& hull_points2,
151  std::vector<double>& vec1, std::vector<double>& vec2, double mindiff,
152  double padEnds = true);
153  };
154 }
155 
A container for consensus elements.
Definition: ConsensusMap.h:71
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
Correlates individual masstraces found in mass spectrometric maps.
Definition: MasstraceCorrelator.h:53
std::vector< std::pair< double, double > > MasstracePointsType
Definition: MasstraceCorrelator.h:65
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91

OpenMS / TOPP release 2.3.0 Documentation generated on Wed Apr 18 2018 19:29:06 using doxygen 1.8.14