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-2015.
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 
42 
43 #include <map>
44 
45 namespace OpenMS
46 {
69  {
70 public:
73 
76 
77  // Docu in base class
78  virtual void alignPeakMaps(std::vector<MSExperiment<> > &,
79  std::vector<TransformationDescription> &);
80 
81  // Docu in base class
82  virtual void alignFeatureMaps(std::vector<FeatureMap > &,
83  std::vector<TransformationDescription> &);
84 
85  // Docu in base class
86  virtual void alignConsensusMaps(std::vector<ConsensusMap> &,
87  std::vector<TransformationDescription> &);
88 
89  // Docu in base class
90  virtual void alignPeptideIdentifications(
91  std::vector<std::vector<PeptideIdentification> > &,
92  std::vector<TransformationDescription> &);
93 
94  // Docu in base class
95  virtual void setReference(Size reference_index = 0,
96  const String & reference_file = "");
97 
108  template <typename MapType>
109  void alignMaps(std::vector<MapType> & maps,
110  std::vector<TransformationDescription> & transformations)
111  {
112  checkParameters_(maps.size());
113  startProgress(0, 3, "aligning maps");
114 
115  if (reference_index_) // reference is one of the input files
116  {
117  SeqToList rt_data;
118  getRetentionTimes_(maps[reference_index_ - 1], rt_data);
119  computeMedians_(rt_data, reference_, true);
120  }
121 
122  // one set of RT data for each input map, except reference:
123  std::vector<SeqToList> rt_data(maps.size() - bool(reference_index_));
124  for (Size i = 0, j = 0; i < maps.size(); ++i)
125  {
126  if (i == reference_index_ - 1) continue; // skip reference map, if any
127 
128  getRetentionTimes_(maps[i], rt_data[j++]);
129  }
130  setProgress(1);
131 
132  computeTransformations_(rt_data, transformations, true);
133 
134  setProgress(3);
135  endProgress();
136  }
137 
140  {
142  }
143 
146  {
147  return "identification";
148  }
149 
150 protected:
151 
153  typedef std::map<String, DoubleList> SeqToList;
154 
156  typedef std::map<String, double> SeqToValue;
157 
160 
162  SeqToValue reference_;
163 
166 
169 
179  void computeMedians_(SeqToList & rt_data, SeqToValue & medians,
180  bool sorted = false);
181 
183  bool hasGoodHit_(PeptideIdentification & peptide);
184 
191  void getRetentionTimes_(std::vector<PeptideIdentification> & peptides,
192  SeqToList & rt_data);
193 
200  void getRetentionTimes_(MSExperiment<> & experiment, SeqToList & rt_data);
201 
212  template <typename MapType>
213  void getRetentionTimes_(MapType & features, SeqToList & rt_data);
214 
222  void computeTransformations_(std::vector<SeqToList> & rt_data,
223  std::vector<TransformationDescription> &
224  transforms, bool sorted = false);
225 
233  void checkParameters_(const Size runs);
234 
241  void getReference_();
242 
243 private:
244 
247 
250 
251  };
252 
253 } // namespace OpenMS
254 
255 #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:109
A more convenient string class.
Definition: String.h:57
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:159
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
double score_threshold_
Score threshold for peptide hits.
Definition: MapAlignmentAlgorithmIdentification.h:165
static MapAlignmentAlgorithm * create()
Creates a new instance of this class (for Factory)
Definition: MapAlignmentAlgorithmIdentification.h:139
A map alignment algorithm based on peptide identifications from MS2 spectra.
Definition: MapAlignmentAlgorithmIdentification.h:67
std::map< String, DoubleList > SeqToList
Type to store retention times given for individual peptide sequences.
Definition: MapAlignmentAlgorithmIdentification.h:153
static String getProductName()
Returns the product name (for the Factory)
Definition: MapAlignmentAlgorithmIdentification.h:145
Size min_run_occur_
Minimum number of runs a peptide must occur in.
Definition: MapAlignmentAlgorithmIdentification.h:168
SeqToValue reference_
Reference retention times (per peptide sequence)
Definition: MapAlignmentAlgorithmIdentification.h:162
std::map< String, double > SeqToValue
Type to store one representative retention time per peptide sequence.
Definition: MapAlignmentAlgorithmIdentification.h:156
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:63

OpenMS / TOPP release 2.0.0 Documentation generated on Sat May 16 2015 16:13:23 using doxygen 1.8.9.1