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

« back to all changes in this revision

Viewing changes to include/OpenMS/ANALYSIS/MAPMATCHING/MapAlignmentAlgorithm.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: Clemens Groepl $
 
25
// $Authors: Marc Sturm, Clemens Groepl $
 
26
// --------------------------------------------------------------------------
 
27
 
 
28
#ifndef OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHM_H
 
29
#define OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHM_H
 
30
 
 
31
#include <OpenMS/ANALYSIS/MAPMATCHING/TransformationDescription.h>
 
32
#include <OpenMS/CONCEPT/Exception.h>
 
33
#include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
 
34
#include <OpenMS/CONCEPT/ProgressLogger.h>
 
35
#include <OpenMS/KERNEL/ConsensusMap.h>
 
36
#include <OpenMS/KERNEL/FeatureMap.h>
 
37
#include <OpenMS/KERNEL/MSExperiment.h>
 
38
 
 
39
namespace OpenMS
 
40
{
 
41
 
 
42
        /**
 
43
                @brief Base class for all map-alignment algorithms
 
44
 
 
45
                It takes two or more maps and corrects for retention time distortions.
 
46
 
 
47
                The input maps are transformed and the transformation description is returned.
 
48
 
 
49
                @improvement The maps should not be all loaded before the algorithm  - in order to save memory e.g. in the star-wise approach (Clemens)
 
50
        */
 
51
        class OPENMS_DLLAPI MapAlignmentAlgorithm
 
52
                : public DefaultParamHandler,
 
53
                        public ProgressLogger
 
54
        {
 
55
         public:
 
56
                /// Default constructor
 
57
                MapAlignmentAlgorithm();
 
58
 
 
59
                /// Destructor
 
60
                virtual ~MapAlignmentAlgorithm();
 
61
 
 
62
                /**
 
63
                @brief Aligns peak maps
 
64
 
 
65
                @exception Exception::NotImplemented is thrown if an algorithm cannot align peak maps
 
66
                */
 
67
                virtual void alignPeakMaps(std::vector< MSExperiment<> >&, std::vector<TransformationDescription>&);
 
68
 
 
69
                /**
 
70
                @brief Aligns feature maps
 
71
 
 
72
                @exception Exception::NotImplemented is thrown if an algorithm cannot align feature maps
 
73
                */
 
74
                virtual void alignFeatureMaps(std::vector< FeatureMap<> >&, std::vector<TransformationDescription>&);
 
75
 
 
76
                /**
 
77
                @brief Aligns consensus maps
 
78
 
 
79
                @exception Exception::NotImplemented is thrown if an algorithm cannot align consensus maps
 
80
                */
 
81
                virtual void alignConsensusMaps(std::vector<ConsensusMap>&, std::vector<TransformationDescription>&);
 
82
 
 
83
                /**
 
84
                @brief Aligns peptide identifications
 
85
 
 
86
                @exception Exception::NotImplemented is thrown if an algorithm cannot align peptide identifications
 
87
                */
 
88
                virtual void alignPeptideIdentifications(std::vector< std::vector< PeptideIdentification > >&, std::vector<TransformationDescription>&);
 
89
 
 
90
                /**
 
91
                         @brief Defines a reference for the alignment
 
92
                         
 
93
                         @param reference_index Index of input file to use as reference (1-based!)
 
94
                         @param reference_file Path to external reference file
 
95
 
 
96
                         @exception Exception::InvalidParameter is thrown if the algorithm does not support references
 
97
                        */
 
98
                virtual void setReference(Size reference_index=0, const String& reference_file="");
 
99
 
 
100
    /// Applies the <i>given</i> transformations to peak maps
 
101
    static void transformPeakMaps( std::vector< MSExperiment<> >& maps, const std::vector<TransformationDescription>& given_trafos );
 
102
 
 
103
    /// Applies the <i>given</i> transformations to feature maps
 
104
    static void transformFeatureMaps( std::vector< FeatureMap<> >& maps, const std::vector<TransformationDescription>& given_trafos );
 
105
 
 
106
    /// Applies the <i>given</i> transformations to consensus maps
 
107
    static void transformConsensusMaps( std::vector<ConsensusMap>& maps, const std::vector<TransformationDescription>& given_trafos );
 
108
 
 
109
    /// Applies the <i>given</i> transformations to peptide identifications
 
110
    static void transformPeptideIdentifications( std::vector< std::vector< PeptideIdentification > >& maps, const std::vector<TransformationDescription>& given_trafos );
 
111
 
 
112
 
 
113
    /// Applies the <i>given</i> transformations to a single peak map
 
114
    static void transformSinglePeakMap( MSExperiment<>& msexp, const TransformationDescription& trafo );
 
115
 
 
116
    /// Applies the <i>given</i> transformations to a single feature map
 
117
    static void transformSingleFeatureMap( FeatureMap<>& fmap, const TransformationDescription& trafo );
 
118
 
 
119
    /// Applies the <i>given</i> transformations to a single consensus map
 
120
    static void transformSingleConsensusMap( ConsensusMap& cmap, const TransformationDescription& trafo );
 
121
 
 
122
    /// Applies the <i>given</i> transformations to a single peptide identification
 
123
    static void transformSinglePeptideIdentification( std::vector< PeptideIdentification >& pepids, const TransformationDescription& trafo );
 
124
 
 
125
 
 
126
                /**
 
127
                         @brief Fits a model with given parameters to the transformations
 
128
 
 
129
                         This will not alter transformations of reference files (transformation type "identity").
 
130
                */
 
131
                static void fitModel(const String& model_type, const Param& params, std::vector<TransformationDescription>& trafos);
 
132
 
 
133
                /// Register all derived classes in this method
 
134
                static void registerChildren();
 
135
 
 
136
 
 
137
   protected:
 
138
 
 
139
                /// apply a transformation to a feature
 
140
    static void applyToFeature_(Feature& feature,
 
141
                                                                                                                                const TransformationDescription& trafo);
 
142
 
 
143
                /// apply a transformation to a basic feature
 
144
    static void applyToBaseFeature_(BaseFeature& feature,
 
145
                                                                                                                                                const TransformationDescription& trafo);
 
146
 
 
147
                /// apply a transformation to a consensus feature
 
148
    static void applyToConsensusFeature_(ConsensusFeature& feature, const 
 
149
                                                                                                                                                                 TransformationDescription& trafo);
 
150
 
 
151
         private:
 
152
                /// Copy constructor is not implemented -> private
 
153
                MapAlignmentAlgorithm(const MapAlignmentAlgorithm& );
 
154
                /// Assignment operator is not implemented -> private
 
155
                MapAlignmentAlgorithm& operator=(const MapAlignmentAlgorithm& );
 
156
 
 
157
        };
 
158
 
 
159
} // namespace OpenMS
 
160
 
 
161
#endif // OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHM_H