Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
MapAlignmentAlgorithmSpectrumAlignment.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-2013.
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: Erhan Kenar $
32 // $Authors: Vipul Patel $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHMSPECTRUMALIGNMENT_H
36 #define OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHMSPECTRUMALIGNMENT_H
37 
41 #include <iostream>
42 #include <fstream>
43 #include <gsl/gsl_errno.h>
44 #include <gsl/gsl_spline.h>
45 #include <gsl/gsl_fft_real.h>
46 
47 namespace OpenMS
48 {
61  {
62 public:
65 
68 
69  //Docu in base class
70  virtual void alignPeakMaps(std::vector<MSExperiment<> > &, std::vector<TransformationDescription> &);
71 
74  {
76  }
77 
80  {
81  return "spectrum_alignment";
82  }
83 
84 private:
89 
98  class OPENMS_DLLAPI Compare
99  {
100 protected:
101  bool flag;
102 
103 public:
104 
106  Compare(bool b = false) :
107  flag(b)
108  {
109  }
110 
112  inline bool operator()(const std::pair<std::pair<Int, Real>, Real> & c1, const std::pair<std::pair<Int, Real>, Real> & c2)
113  {
114  if (!flag)
115  {
116  return c1.second > c2.second;
117  }
118  else
119  {
120  return (c1.first).first < (c2.first).first;
121  }
122  }
123 
125  inline bool operator()(const std::pair<Real, Real> & c1, const std::pair<Real, Real> & c2)
126  {
127  if (!flag)
128  {
129  return c1.first > c2.first;
130  }
131  else
132  {
133  return c1.first < c2.first;
134  }
135  }
136 
137  };
138 
153  void prepareAlign_(const std::vector<MSSpectrum<> *> & pattern, MSExperiment<> & aligned, std::vector<TransformationDescription> & transformation);
154 
165  void msFilter_(MSExperiment<> & peakmap, std::vector<MSSpectrum<> *> & spectrum_pointer_container);
166 
173  void fourierActivation_(std::vector<MSSpectrum<> *> & spectrum_pointer_container);
174 
181  void transform_(MSSpectrum<> & spec);
182 
195  bool insideBand_(Size i, Size j, Size n, Size m, Int k_);
196 
212  Int bestk_(const std::vector<MSSpectrum<> *> & pattern, std::vector<MSSpectrum<> *> & aligned, std::map<Size, std::map<Size, Real> > & buffer, bool column_row_orientation, Size xbegin, Size xend, Size ybegin, Size yend);
213 
230  Real scoreCalculation_(Size i, Size j, Size patternbegin, Size alignbegin, const std::vector<MSSpectrum<> *> & pattern, std::vector<MSSpectrum<> *> & aligned, std::map<Size, std::map<Size, Real> > & buffer, bool column_row_orientation);
231 
235  Real scoring_(const MSSpectrum<> & a, MSSpectrum<> & b);
236 
259  void affineGapalign_(Size xbegin, Size ybegin, Size xend, Size yend, const std::vector<MSSpectrum<> *> & pattern, std::vector<MSSpectrum<> *> & aligned, std::vector<int> & xcoordinate, std::vector<Real> & ycoordinate, std::vector<int> & xcoordinatepattern);
260 
274  void bucketFilter_(const std::vector<MSSpectrum<> *> & pattern, std::vector<MSSpectrum<> *> & aligned, std::vector<Int> & xcoordinate, std::vector<Real> & ycoordinate, std::vector<Int> & xcoordinatepattern);
275 
284  void debugFileCreator_(const std::vector<MSSpectrum<> *> & pattern, std::vector<MSSpectrum<> *> & aligned);
285 
291  void eraseFloatDataArrayEntry_(std::vector<MSSpectrum<> *> & spectrum_pointer_container);
292 
298  void debugscoreDistributionCalculation_(Real score);
312  bool debug_;
318  std::vector<std::vector<Real> > debugmatrix_;
320  std::vector<std::vector<Real> > debugscorematrix_;
322  std::vector<std::pair<Real, Real> > debugtraceback_;
324  std::vector<Real> scoredistribution_; //save the cell i, j , matchscore, insertscore, traceback
325  //docu in base class
326  void updateMembers_();
327  };
328 
329 
330 
331 } // namespace OpenMS
332 
333 #endif // OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHMSPECTRUMALIGNMENT_H
std::vector< std::pair< Real, Real > > debugtraceback_
Container holding the path of the traceback.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:322
float Real
Real type.
Definition: Types.h:109
A more convenient string class.
Definition: String.h:56
Real gap_
Represent the gap cost for opening o closing a gap in the alignment.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:300
Size anchorPoints_
Defines the amount of ankerpoints which are selected within one bucket.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:310
std::vector< std::vector< Real > > debugscorematrix_
Container holding the only the score of Spectrums.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:320
Real threshold_
This is the minimum score for counting as a match(1-cutoffScore_)
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:316
bool debug_
Debug mode flag default: False.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:312
bool operator()(const std::pair< std::pair< Int, Real >, Real > &c1, const std::pair< std::pair< Int, Real >, Real > &c2)
overloaded operator() for comparing maps of maps std::pair&lt;std::pair&lt;Int,Real&gt;,Real&gt;. If flag is false the second argument of the outer map is selected. The output is an ascending order. If the order flag is true, the first argument of the inner class is selected to get a descending oder.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:112
Base class for all map-alignment algorithms.
Definition: MapAlignmentAlgorithm.h:58
bool operator()(const std::pair< Real, Real > &c1, const std::pair< Real, Real > &c2)
overloaded operator() for comparing pairs of Real, Real std::pair&lt;Real,Real&gt;. If the order flag is fa...
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:125
PeakSpectrumCompareFunctor * c1_
Pointer holds the scoringfunction, which can be selected.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:304
bool flag
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:101
Size bucketsize_
Defines the size of one bucket.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:308
Compare(bool b=false)
Default constructor with an order flag.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:106
innerclass necessary for using the sort algo.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:98
std::vector< std::vector< Real > > debugmatrix_
Container holding the score of the matchmatrix and also the insertmatrix.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:318
A map alignment algorithm based on spectrum similarity (dynamic programming).
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:59
std::vector< Real > scoredistribution_
Container holding the score of each cell(matchmatrix,insertmatrix, traceback)
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:324
static String getProductName()
Returns the product name (for the Factory)
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:79
Real mismatchscore_
Represent the cost of a mismath in the alignment.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:314
Representation of a mass spectrometry experiment.
Definition: MSExperiment.h:68
Real cutoffScore_
This is the minimal score to be count as a mismatch(range 0.0 - 1.0)
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:306
static MapAlignmentAlgorithm * create()
Creates a new instance of this class (for Factory)
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:73
Real e_
Extension cost after a gap ist open.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:302
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
Base class for compare functors of spectra, that return a similiarity value for two spectra...
Definition: PeakSpectrumCompareFunctor.h:53
int Int
Signed integer type.
Definition: Types.h:100

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:16 using doxygen 1.8.5