Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
MapAlignmentAlgorithmIdentification.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-2013.
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: Hendrik Weisser $
32 // $Authors: Eva Lange, Clemens Groepl, Hendrik Weisser $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHMIDENTIFICATION_H
36 #define OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHMIDENTIFICATION_H
37 
41 
42 #include <map>
43 
44 namespace OpenMS
45 {
68  {
69 public:
72 
75 
76  // Docu in base class
77  virtual void alignPeakMaps(std::vector<MSExperiment<> > &,
78  std::vector<TransformationDescription> &);
79 
80  // Docu in base class
81  virtual void alignFeatureMaps(std::vector<FeatureMap<> > &,
82  std::vector<TransformationDescription> &);
83 
84  // Docu in base class
85  virtual void alignConsensusMaps(std::vector<ConsensusMap> &,
86  std::vector<TransformationDescription> &);
87 
88  // Docu in base class
89  virtual void alignPeptideIdentifications(
90  std::vector<std::vector<PeptideIdentification> > &,
91  std::vector<TransformationDescription> &);
92 
93  // Docu in base class
94  virtual void setReference(Size reference_index = 0,
95  const String & reference_file = "");
96 
107  template <typename MapType>
108  void alignMaps(std::vector<MapType> & maps,
109  std::vector<TransformationDescription> & transformations)
110  {
111  checkParameters_(maps.size());
112  startProgress(0, 3, "aligning maps");
113 
114  if (reference_index_) // reference is one of the input files
115  {
116  SeqToList rt_data;
117  getRetentionTimes_(maps[reference_index_ - 1], rt_data);
118  computeMedians_(rt_data, reference_, true);
119  }
120 
121  // one set of RT data for each input map, except reference:
122  std::vector<SeqToList> rt_data(maps.size() - bool(reference_index_));
123  for (Size i = 0, j = 0; i < maps.size(); ++i)
124  {
125  if (i == reference_index_ - 1) continue; // skip reference map, if any
126 
127  getRetentionTimes_(maps[i], rt_data[j++]);
128  }
129  setProgress(1);
130 
131  computeTransformations_(rt_data, transformations, true);
132 
133  setProgress(3);
134  endProgress();
135  }
136 
139  {
141  }
142 
145  {
146  return "identification";
147  }
148 
149 protected:
150 
152  typedef std::map<String, DoubleList> SeqToList;
153 
155  typedef std::map<String, DoubleReal> SeqToValue;
156 
159 
162 
165 
168 
178  void computeMedians_(SeqToList & rt_data, SeqToValue & medians,
179  bool sorted = false);
180 
182  bool hasGoodHit_(PeptideIdentification & peptide);
183 
190  void getRetentionTimes_(std::vector<PeptideIdentification> & peptides,
191  SeqToList & rt_data);
192 
199  void getRetentionTimes_(MSExperiment<> & experiment, SeqToList & rt_data);
200 
211  template <typename MapType>
212  void getRetentionTimes_(MapType & features, SeqToList & rt_data);
213 
221  void computeTransformations_(std::vector<SeqToList> & rt_data,
222  std::vector<TransformationDescription> &
223  transforms, bool sorted = false);
224 
232  void checkParameters_(const Size runs);
233 
240  void getReference_();
241 
242 private:
243 
246 
249 
250  };
251 
252 } // namespace OpenMS
253 
254 #endif // OPENMS_ANALYSIS_MAPMATCHING_MAPALIGNMENTALGORITHMIDENTIFICATION_H
void alignMaps(std::vector< MapType > &maps, std::vector< TransformationDescription > &transformations)
Align feature maps or consensus maps.
Definition: MapAlignmentAlgorithmIdentification.h:108
DoubleReal score_threshold_
Score threshold for peptide hits.
Definition: MapAlignmentAlgorithmIdentification.h:164
A more convenient string class.
Definition: String.h:56
Base class for all map-alignment algorithms.
Definition: MapAlignmentAlgorithm.h:58
Size reference_index_
Index of input file to use as reference (1-based!)
Definition: MapAlignmentAlgorithmIdentification.h:158
std::map< String, DoubleReal > SeqToValue
Type to store one representative retention time per peptide sequence.
Definition: MapAlignmentAlgorithmIdentification.h:155
static MapAlignmentAlgorithm * create()
Creates a new instance of this class (for Factory)
Definition: MapAlignmentAlgorithmIdentification.h:138
A map alignment algorithm based on peptide identifications from MS2 spectra.
Definition: MapAlignmentAlgorithmIdentification.h:66
std::map< String, DoubleList > SeqToList
Type to store retention times given for individual peptide sequences.
Definition: MapAlignmentAlgorithmIdentification.h:152
Representation of a mass spectrometry experiment.
Definition: MSExperiment.h:68
static String getProductName()
Returns the product name (for the Factory)
Definition: MapAlignmentAlgorithmIdentification.h:144
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
Size min_run_occur_
Minimum number of runs a peptide must occur in.
Definition: MapAlignmentAlgorithmIdentification.h:167
SeqToValue reference_
Reference retention times (per peptide sequence)
Definition: MapAlignmentAlgorithmIdentification.h:161
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:63

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:16 using doxygen 1.8.5