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-2015.
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 
42 namespace OpenMS
43 {
56  {
57 public:
60 
63 
64  //Docu in base class
65  virtual void alignPeakMaps(std::vector<MSExperiment<> > &, std::vector<TransformationDescription> &);
66 
69  {
71  }
72 
75  {
76  return "spectrum_alignment";
77  }
78 
79 private:
84 
93  class OPENMS_DLLAPI Compare
94  {
95 protected:
96  bool flag;
97 
98 public:
99 
101  explicit Compare(bool b = false) :
102  flag(b)
103  {
104  }
105 
107  inline bool operator()(const std::pair<std::pair<Int, float>, float> & c1, const std::pair<std::pair<Int, float>, float> & c2)
108  {
109  if (!flag)
110  {
111  return c1.second > c2.second;
112  }
113  else
114  {
115  return (c1.first).first < (c2.first).first;
116  }
117  }
118 
120  inline bool operator()(const std::pair<float, float> & c1, const std::pair<float, float> & c2)
121  {
122  if (!flag)
123  {
124  return c1.first > c2.first;
125  }
126  else
127  {
128  return c1.first < c2.first;
129  }
130  }
131 
132  };
133 
148  void prepareAlign_(const std::vector<MSSpectrum<> *> & pattern, MSExperiment<> & aligned, std::vector<TransformationDescription> & transformation);
149 
160  void msFilter_(MSExperiment<> & peakmap, std::vector<MSSpectrum<> *> & spectrum_pointer_container);
161 
174  bool insideBand_(Size i, Size j, Size n, Size m, Int k_);
175 
191  Int bestk_(const std::vector<MSSpectrum<> *> & pattern, std::vector<MSSpectrum<> *> & aligned, std::map<Size, std::map<Size, float> > & buffer, bool column_row_orientation, Size xbegin, Size xend, Size ybegin, Size yend);
192 
209  float scoreCalculation_(Size i, Size j, Size patternbegin, Size alignbegin, const std::vector<MSSpectrum<> *> & pattern, std::vector<MSSpectrum<> *> & aligned, std::map<Size, std::map<Size, float> > & buffer, bool column_row_orientation);
210 
214  float scoring_(const MSSpectrum<> & a, MSSpectrum<> & b);
215 
238  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<float> & ycoordinate, std::vector<int> & xcoordinatepattern);
239 
253  void bucketFilter_(const std::vector<MSSpectrum<> *> & pattern, std::vector<MSSpectrum<> *> & aligned, std::vector<Int> & xcoordinate, std::vector<float> & ycoordinate, std::vector<Int> & xcoordinatepattern);
254 
263  void debugFileCreator_(const std::vector<MSSpectrum<> *> & pattern, std::vector<MSSpectrum<> *> & aligned);
264 
270  void debugscoreDistributionCalculation_(float score);
272  float gap_;
274  float e_;
284  bool debug_;
288  float threshold_;
290  std::vector<std::vector<float> > debugmatrix_;
292  std::vector<std::vector<float> > debugscorematrix_;
294  std::vector<std::pair<float, float> > debugtraceback_;
296  std::vector<float> scoredistribution_; //save the cell i, j , matchscore, insertscore, traceback
297  //docu in base class
298  void updateMembers_();
299  };
300 
301 } // namespace OpenMS
302 
303 #endif // OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHMSPECTRUMALIGNMENT_H
std::vector< std::vector< float > > debugmatrix_
Container holding the score of the matchmatrix and also the insertmatrix.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:290
A more convenient string class.
Definition: String.h:57
float mismatchscore_
Represent the cost of a mismatch in the alignment.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:286
Size anchorPoints_
Defines the amount of anchor points which are selected within one bucket.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:282
bool debug_
Debug mode flag default: False.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:284
Base class for all map-alignment algorithms.
Definition: MapAlignmentAlgorithm.h:58
PeakSpectrumCompareFunctor * c1_
Pointer holds the scoring function, which can be selected.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:276
std::vector< float > scoredistribution_
Container holding the score of each cell(matchmatrix,insertmatrix, traceback)
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:296
bool flag
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:96
Size bucketsize_
Defines the size of one bucket.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:280
float e_
Extension cost after a gap is open.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:274
Compare(bool b=false)
Default constructor with an order flag.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:101
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
innerclass necessary for using the sort algo.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:93
A map alignment algorithm based on spectrum similarity (dynamic programming).
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:54
bool operator()(const std::pair< float, float > &c1, const std::pair< float, float > &c2)
overloaded operator() for comparing pairs of float, float std::pair&lt;float,float&gt;. If the order flag i...
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:120
static String getProductName()
Returns the product name (for the Factory)
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:74
bool operator()(const std::pair< std::pair< Int, float >, float > &c1, const std::pair< std::pair< Int, float >, float > &c2)
overloaded operator() for comparing maps of maps std::pair&lt;std::pair&lt;Int,float&gt;,float&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 order.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:107
std::vector< std::pair< float, float > > debugtraceback_
Container holding the path of the traceback.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:294
float cutoffScore_
This is the minimal score to be count as a mismatch(range 0.0 - 1.0)
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:278
static MapAlignmentAlgorithm * create()
Creates a new instance of this class (for Factory)
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:68
std::vector< std::vector< float > > debugscorematrix_
Container holding the only the score of Spectra.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:292
Base class for compare functors of spectra, that return a similarity value for two spectra...
Definition: PeakSpectrumCompareFunctor.h:53
float gap_
Represent the gap cost for opening or closing a gap in the alignment.
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:272
float threshold_
This is the minimum score for counting as a match(1-cutoffScore_)
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:288
int Int
Signed integer type.
Definition: Types.h:96

OpenMS / TOPP release 2.0.0 Documentation generated on Wed Mar 30 2016 16:18:39 using doxygen 1.8.5