Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

MapAlignmentAlgorithmSpectrumAlignment.h

Go to the documentation of this file.
00001 // --------------------------------------------------------------------------
00002 //                   OpenMS -- Open-Source Mass Spectrometry
00003 // --------------------------------------------------------------------------
00004 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
00005 // ETH Zurich, and Freie Universitaet Berlin 2002-2012.
00006 //
00007 // This software is released under a three-clause BSD license:
00008 //  * Redistributions of source code must retain the above copyright
00009 //    notice, this list of conditions and the following disclaimer.
00010 //  * Redistributions in binary form must reproduce the above copyright
00011 //    notice, this list of conditions and the following disclaimer in the
00012 //    documentation and/or other materials provided with the distribution.
00013 //  * Neither the name of any author or any participating institution
00014 //    may be used to endorse or promote products derived from this software
00015 //    without specific prior written permission.
00016 // For a full list of authors, refer to the file AUTHORS.
00017 // --------------------------------------------------------------------------
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
00022 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00024 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00025 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00026 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00027 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00028 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 //
00030 // --------------------------------------------------------------------------
00031 // $Maintainer: Erhan Kenar $
00032 // $Authors: Vipul Patel $
00033 // --------------------------------------------------------------------------
00034 
00035 #ifndef OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHMSPECTRUMALIGNMENT_H
00036 #define OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHMSPECTRUMALIGNMENT_H
00037 
00038 #include <OpenMS/ANALYSIS/MAPMATCHING/MapAlignmentAlgorithm.h>
00039 #include <OpenMS/COMPARISON/SPECTRA/PeakSpectrumCompareFunctor.h>
00040 #include <OpenMS/DATASTRUCTURES/String.h>
00041 #include <iostream>
00042 #include <fstream>
00043 #include <gsl/gsl_errno.h>
00044 #include <gsl/gsl_spline.h>
00045 #include <gsl/gsl_fft_real.h>
00046 
00047 namespace OpenMS
00048 {
00059   class OPENMS_DLLAPI MapAlignmentAlgorithmSpectrumAlignment :
00060     public MapAlignmentAlgorithm
00061   {
00062 public:
00064     MapAlignmentAlgorithmSpectrumAlignment();
00065 
00067     virtual ~MapAlignmentAlgorithmSpectrumAlignment();
00068 
00069     //Docu in base class
00070     virtual void alignPeakMaps(std::vector<MSExperiment<> > &, std::vector<TransformationDescription> &);
00071 
00073     static MapAlignmentAlgorithm * create()
00074     {
00075       return new MapAlignmentAlgorithmSpectrumAlignment();
00076     }
00077 
00079     static String getProductName()
00080     {
00081       return "spectrum_alignment";
00082     }
00083 
00084 private:
00086     MapAlignmentAlgorithmSpectrumAlignment(const MapAlignmentAlgorithmSpectrumAlignment &);
00088     MapAlignmentAlgorithmSpectrumAlignment & operator=(const MapAlignmentAlgorithmSpectrumAlignment &);
00089 
00098     class OPENMS_DLLAPI Compare
00099     {
00100 protected:
00101       bool flag;
00102 
00103 public:
00104 
00106       Compare(bool b = false) :
00107         flag(b)
00108       {
00109       }
00110 
00112       inline bool operator()(const std::pair<std::pair<Int, Real>, Real> & c1, const std::pair<std::pair<Int, Real>, Real> & c2)
00113       {
00114         if (!flag)
00115         {
00116           return c1.second > c2.second;
00117         }
00118         else
00119         {
00120           return (c1.first).first < (c2.first).first;
00121         }
00122       }
00123 
00125       inline bool operator()(const std::pair<Real, Real> & c1, const std::pair<Real, Real> & c2)
00126       {
00127         if (!flag)
00128         {
00129           return c1.first > c2.first;
00130         }
00131         else
00132         {
00133           return c1.first < c2.first;
00134         }
00135       }
00136 
00137     };
00138 
00153     void prepareAlign_(const std::vector<MSSpectrum<> *> & pattern, MSExperiment<> & aligned, std::vector<TransformationDescription> & transformation);
00154 
00165     void msFilter_(MSExperiment<> & peakmap, std::vector<MSSpectrum<> *> & spectrum_pointer_container);
00166 
00173     void fourierActivation_(std::vector<MSSpectrum<> *> & spectrum_pointer_container);
00174 
00181     void transform_(MSSpectrum<> & spec);
00182 
00195     bool insideBand_(Size i, Size j, Size n, Size m, Int k_);
00196 
00212     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);
00213 
00230     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);
00231 
00235     Real scoring_(const MSSpectrum<> & a, MSSpectrum<> & b);
00236 
00259     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);
00260 
00274     void bucketFilter_(const std::vector<MSSpectrum<> *> & pattern, std::vector<MSSpectrum<> *> & aligned, std::vector<Int> & xcoordinate, std::vector<Real> & ycoordinate, std::vector<Int> & xcoordinatepattern);
00275 
00284     void debugFileCreator_(const std::vector<MSSpectrum<> *> & pattern, std::vector<MSSpectrum<> *> & aligned);
00285 
00291     void eraseFloatDataArrayEntry_(std::vector<MSSpectrum<> *> & spectrum_pointer_container);
00292 
00298     void debugscoreDistributionCalculation_(Real score);
00300     Real gap_;
00302     Real e_;
00304     PeakSpectrumCompareFunctor * c1_;
00306     Real cutoffScore_;
00308     Size bucketsize_;
00310     Size anchorPoints_;
00312     bool debug_;
00314     Real mismatchscore_;
00316     Real threshold_;
00318     std::vector<std::vector<Real> > debugmatrix_;
00320     std::vector<std::vector<Real> > debugscorematrix_;
00322     std::vector<std::pair<Real, Real> > debugtraceback_;
00324     std::vector<Real> scoredistribution_;        //save the cell i, j , matchscore, insertscore, traceback
00325     //docu in base class
00326     void updateMembers_();
00327   };
00328 
00329 
00330 
00331 } // namespace OpenMS
00332 
00333 #endif // OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHMSPECTRUMALIGNMENT_H

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:41 using doxygen 1.7.1