Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHMIDENTIFICATION_H
00036 #define OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHMIDENTIFICATION_H
00037
00038 #include <OpenMS/ANALYSIS/MAPMATCHING/MapAlignmentAlgorithm.h>
00039 #include <OpenMS/ANALYSIS/MAPMATCHING/TransformationDescription.h>
00040 #include <OpenMS/KERNEL/ConsensusMap.h>
00041
00042 #include <map>
00043
00044 namespace OpenMS
00045 {
00066 class OPENMS_DLLAPI MapAlignmentAlgorithmIdentification :
00067 public MapAlignmentAlgorithm
00068 {
00069 public:
00071 MapAlignmentAlgorithmIdentification();
00072
00074 virtual ~MapAlignmentAlgorithmIdentification();
00075
00076
00077 virtual void alignPeakMaps(std::vector<MSExperiment<> > &,
00078 std::vector<TransformationDescription> &);
00079
00080
00081 virtual void alignFeatureMaps(std::vector<FeatureMap<> > &,
00082 std::vector<TransformationDescription> &);
00083
00084
00085 virtual void alignConsensusMaps(std::vector<ConsensusMap> &,
00086 std::vector<TransformationDescription> &);
00087
00088
00089 virtual void alignPeptideIdentifications(
00090 std::vector<std::vector<PeptideIdentification> > &,
00091 std::vector<TransformationDescription> &);
00092
00093
00094 virtual void setReference(Size reference_index = 0,
00095 const String & reference_file = "");
00096
00107 template <typename MapType>
00108 void alignMaps(std::vector<MapType> & maps,
00109 std::vector<TransformationDescription> & transformations)
00110 {
00111 checkParameters_(maps.size());
00112 startProgress(0, 3, "aligning maps");
00113
00114 if (reference_index_)
00115 {
00116 SeqToList rt_data;
00117 getRetentionTimes_(maps[reference_index_ - 1], rt_data);
00118 computeMedians_(rt_data, reference_, true);
00119 }
00120
00121
00122 std::vector<SeqToList> rt_data(maps.size() - bool(reference_index_));
00123 for (Size i = 0, j = 0; i < maps.size(); ++i)
00124 {
00125 if (i == reference_index_ - 1) continue;
00126
00127 getRetentionTimes_(maps[i], rt_data[j++]);
00128 }
00129 setProgress(1);
00130
00131 computeTransformations_(rt_data, transformations, true);
00132
00133 setProgress(3);
00134 endProgress();
00135 }
00136
00138 static MapAlignmentAlgorithm * create()
00139 {
00140 return new MapAlignmentAlgorithmIdentification();
00141 }
00142
00144 static String getProductName()
00145 {
00146 return "identification";
00147 }
00148
00149 protected:
00150
00152 typedef std::map<String, DoubleList> SeqToList;
00153
00155 typedef std::map<String, DoubleReal> SeqToValue;
00156
00158 Size reference_index_;
00159
00161 SeqToValue reference_;
00162
00164 DoubleReal score_threshold_;
00165
00167 Size min_run_occur_;
00168
00178 void computeMedians_(SeqToList & rt_data, SeqToValue & medians,
00179 bool sorted = false);
00180
00182 bool hasGoodHit_(PeptideIdentification & peptide);
00183
00190 void getRetentionTimes_(std::vector<PeptideIdentification> & peptides,
00191 SeqToList & rt_data);
00192
00199 void getRetentionTimes_(MSExperiment<> & experiment, SeqToList & rt_data);
00200
00211 template <typename MapType>
00212 void getRetentionTimes_(MapType & features, SeqToList & rt_data);
00213
00221 void computeTransformations_(std::vector<SeqToList> & rt_data,
00222 std::vector<TransformationDescription> &
00223 transforms, bool sorted = false);
00224
00232 void checkParameters_(const Size runs);
00233
00240 void getReference_();
00241
00242 private:
00243
00245 MapAlignmentAlgorithmIdentification(const MapAlignmentAlgorithmIdentification &);
00246
00248 MapAlignmentAlgorithmIdentification & operator=(const MapAlignmentAlgorithmIdentification &);
00249
00250 };
00251
00252 }
00253
00254 #endif // OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHMIDENTIFICATION_H