~ubuntu-branches/ubuntu/wily/openms/wily

« back to all changes in this revision

Viewing changes to include/OpenMS/ANALYSIS/MAPMATCHING/LabeledPairFinder.h

  • Committer: Package Import Robot
  • Author(s): Filippo Rusconi
  • Date: 2012-11-12 15:58:12 UTC
  • Revision ID: package-import@ubuntu.com-20121112155812-vr15wtg9b50cuesg
Tags: upstream-1.9.0
ImportĀ upstreamĀ versionĀ 1.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- mode: C++; tab-width: 2; -*-
 
2
// vi: set ts=2:
 
3
//
 
4
// --------------------------------------------------------------------------
 
5
//                   OpenMS Mass Spectrometry Framework
 
6
// --------------------------------------------------------------------------
 
7
//  Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
 
8
//
 
9
//  This library is free software; you can redistribute it and/or
 
10
//  modify it under the terms of the GNU Lesser General Public
 
11
//  License as published by the Free Software Foundation; either
 
12
//  version 2.1 of the License, or (at your option) any later version.
 
13
//
 
14
//  This library is distributed in the hope that it will be useful,
 
15
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
//  Lesser General Public License for more details.
 
18
//
 
19
//  You should have received a copy of the GNU Lesser General Public
 
20
//  License along with this library; if not, write to the Free Software
 
21
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
22
//
 
23
// --------------------------------------------------------------------------
 
24
// $Maintainer: $
 
25
// $Authors: Marc Sturm $
 
26
// --------------------------------------------------------------------------
 
27
 
 
28
#ifndef OPENMS_ANALYSIS_MAPMATCHING_LABELEDPAIRFINDER_H
 
29
#define OPENMS_ANALYSIS_MAPMATCHING_LABELEDPAIRFINDER_H
 
30
 
 
31
#include <OpenMS/ANALYSIS/MAPMATCHING/BaseGroupFinder.h>
 
32
 
 
33
#include <boost/math/tr1.hpp>
 
34
#include <cmath>
 
35
 
 
36
namespace OpenMS
 
37
{
 
38
        /**
 
39
                @brief The LabeledPairFinder allows the matching of labeled features (features with a fixed distance).
 
40
                
 
41
                Finds feature pairs that have a defined distance in RT and m/z in the same map.
 
42
        
 
43
                @htmlinclude OpenMS_LabeledPairFinder.parameters
 
44
 
 
45
                @todo Implement support for labled MRM experiments, Q1 m/z value and charges. (Andreas)
 
46
                @todo Implement support for more than one mass delta, e.g. from missed cleavages and so on (Andreas)
 
47
                
 
48
                @ingroup FeatureGrouping
 
49
        */
 
50
        class OPENMS_DLLAPI LabeledPairFinder
 
51
                : public BaseGroupFinder
 
52
        {
 
53
                
 
54
                public:
 
55
                        
 
56
                        /// Default constructor
 
57
                        LabeledPairFinder();
 
58
        
 
59
                        /// Destructor
 
60
                        inline virtual ~LabeledPairFinder()
 
61
                        {
 
62
                        }
 
63
 
 
64
            /// Returns an instance of this class
 
65
            static BaseGroupFinder* create()
 
66
            {
 
67
              return new LabeledPairFinder();
 
68
            }
 
69
        
 
70
            /// Returns the name of this module
 
71
            static const String getProductName()
 
72
            {
 
73
              return "labeled_pair_finder";
 
74
            }
 
75
        
 
76
                        /**
 
77
                                @brief Run the algorithm
 
78
                                
 
79
                                @note Exactly one @em input map has to be provided.
 
80
                                @note The @em output map has to have two file descriptions, containing
 
81
                                the same file name. The file descriptions have to be labeled 'heavy' and 'light'.
 
82
                                
 
83
                                @exception Exception::IllegalArgument is thrown if the input data is not valid.
 
84
                        */
 
85
                        virtual void run(const std::vector<ConsensusMap>& input_maps, ConsensusMap& result_map);
 
86
        
 
87
                protected:
 
88
                        
 
89
                        /// return the p-value at position x for the bi-Gaussian distribution with mean @p m and standard deviation @p sig1 (left) and @p sig2 (right)
 
90
                        inline DoubleReal PValue_(DoubleReal x, DoubleReal m, DoubleReal sig1, DoubleReal sig2)
 
91
                        {
 
92
                                if (m<x)
 
93
                                {
 
94
                                        return 1-boost::math::tr1::erf((x-m)/sig2/0.707106781);
 
95
                                }
 
96
                                else
 
97
                                {
 
98
                                        return 1-boost::math::tr1::erf((m-x)/sig1/0.707106781);
 
99
                                }
 
100
                        }
 
101
                private:
 
102
                        
 
103
                        /// Copy constructor not implemented => private
 
104
                        LabeledPairFinder(const LabeledPairFinder& source);
 
105
 
 
106
                        /// Assignment operator not implemented => private
 
107
            LabeledPairFinder& operator=(const LabeledPairFinder& source);
 
108
 
 
109
        }; // end of class LabeledPairFinder
 
110
 
 
111
} // end of namespace OpenMS
 
112
 
 
113
#endif  // OPENMS_ANALYSIS_MAPMATCHER_LABELEDPAIRFINDER_H