Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
PeptideAndProteinQuant.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: Hendrik Weisser $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_ANALYSIS_QUANTITATION_PEPTIDEANDPROTEINQUANT_H
36 #define OPENMS_ANALYSIS_QUANTITATION_PEPTIDEANDPROTEINQUANT_H
37 
43 
44 namespace OpenMS
45 {
53  class OPENMS_DLLAPI PeptideAndProteinQuant :
54  public DefaultParamHandler
55  {
56 public:
57 
59  typedef std::map<UInt64, double> SampleAbundances;
60 
62  struct PeptideData
63  {
65  std::map<Int, SampleAbundances> abundances;
66 
68  SampleAbundances total_abundances;
69 
71  std::set<String> accessions;
72 
75 
78  id_count(0) {}
79  };
80 
82  typedef std::map<AASequence, PeptideData> PeptideQuant;
83 
85  struct ProteinData
86  {
88  std::map<String, SampleAbundances> abundances;
89 
91  SampleAbundances total_abundances;
92 
95 
98  id_count(0) {}
99  };
100 
102  typedef std::map<String, ProteinData> ProteinQuant;
103 
105  struct Statistics
106  {
109 
111  Size quant_proteins, too_few_peptides;
112 
114  Size quant_peptides, total_peptides;
115 
117  Size quant_features, total_features, blank_features, ambig_features;
118 
121  n_samples(0), quant_proteins(0), too_few_peptides(0),
122  quant_peptides(0), total_peptides(0), quant_features(0),
123  total_features(0), blank_features(0), ambig_features(0) {}
124  };
125 
128 
131 
137  void quantifyPeptides(FeatureMap& features);
138 
144  void quantifyPeptides(ConsensusMap& consensus);
145 
151  void quantifyPeptides(std::vector<ProteinIdentification>& proteins,
152  std::vector<PeptideIdentification>& peptides);
153 
159  void quantifyProteins(const ProteinIdentification & proteins =
161 
163  const Statistics & getStatistics();
164 
166  const PeptideQuant & getPeptideResults();
167 
169  const ProteinQuant & getProteinResults();
170 
171 private:
172 
175 
177  PeptideQuant pep_quant_;
178 
180  ProteinQuant prot_quant_;
181 
182 
189  PeptideHit getAnnotation_(std::vector<PeptideIdentification> & peptides);
190 
196  void quantifyFeature_(const FeatureHandle & feature, const PeptideHit & hit);
197 
203  template <typename T>
204  void orderBest_(const std::map<T, SampleAbundances> abundances,
205  std::vector<T> & result)
206  {
207  typedef std::pair<Size, double> PairType;
208  std::multimap<PairType, T, std::greater<PairType> > order;
209  for (typename std::map<T, SampleAbundances>::const_iterator ab_it =
210  abundances.begin(); ab_it != abundances.end(); ++ab_it)
211  {
212  double total = 0.0;
213  for (SampleAbundances::const_iterator samp_it = ab_it->second.begin();
214  samp_it != ab_it->second.end(); ++samp_it)
215  {
216  total += samp_it->second;
217  }
218  if (total <= 0.0) continue; // not quantified
219  PairType key = std::make_pair(ab_it->second.size(), total);
220  order.insert(std::make_pair(key, ab_it->first));
221  }
222  result.clear();
223  for (typename std::multimap<PairType, T, std::greater<PairType> >::
224  iterator ord_it = order.begin(); ord_it != order.end(); ++ord_it)
225  {
226  result.push_back(ord_it->second);
227  }
228  }
229 
235  void quantifyPeptides_();
236 
240  void normalizePeptides_();
241 
254  String getAccession_(const std::set<String> & pep_accessions,
255  std::map<String, String> & accession_to_leader);
256 
262  void countPeptides_(std::vector<PeptideIdentification> & peptides);
263 
265  void updateMembers_();
266 
267  }; // class
268 
269 } // namespace
270 
271 #endif // OPENMS_ANALYSIS_QUANTITATION_PEPTIDEANDPROTEINQUANT_H
Size too_few_peptides
Definition: PeptideAndProteinQuant.h:111
Representation of a protein identification run.
Definition: ProteinIdentification.h:61
Statistics()
constructor
Definition: PeptideAndProteinQuant.h:120
Size total_peptides
Definition: PeptideAndProteinQuant.h:114
A more convenient string class.
Definition: String.h:57
Size n_samples
number of samples
Definition: PeptideAndProteinQuant.h:108
ProteinData()
constructor
Definition: PeptideAndProteinQuant.h:97
A container for features.
Definition: FeatureMap.h:93
Size total_features
Definition: PeptideAndProteinQuant.h:117
A container for consensus elements.
Definition: ConsensusMap.h:72
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
std::set< String > accessions
protein accessions for this peptide
Definition: PeptideAndProteinQuant.h:71
PeptideQuant pep_quant_
Peptide quantification data.
Definition: PeptideAndProteinQuant.h:177
~PeptideAndProteinQuant()
Destructor.
Definition: PeptideAndProteinQuant.h:130
std::map< String, ProteinData > ProteinQuant
Mapping: protein accession -> protein data.
Definition: PeptideAndProteinQuant.h:102
std::map< Int, SampleAbundances > abundances
mapping: charge -> sample -> abundance
Definition: PeptideAndProteinQuant.h:65
std::map< AASequence, PeptideData > PeptideQuant
Mapping: peptide sequence (modified) -> peptide data.
Definition: PeptideAndProteinQuant.h:82
PeptideData()
constructor
Definition: PeptideAndProteinQuant.h:77
Helper class for peptide and protein quantification based on feature data annotated with IDs...
Definition: PeptideAndProteinQuant.h:53
Representation of a peptide hit.
Definition: PeptideHit.h:55
Size id_count
number of identifications
Definition: PeptideAndProteinQuant.h:74
Quantitative and associated data for a peptide.
Definition: PeptideAndProteinQuant.h:62
Statistics stats_
Processing statistics for output in the end.
Definition: PeptideAndProteinQuant.h:174
SampleAbundances total_abundances
mapping: sample -> total abundance
Definition: PeptideAndProteinQuant.h:68
SampleAbundances total_abundances
mapping: sample -> total abundance
Definition: PeptideAndProteinQuant.h:91
void orderBest_(const std::map< T, SampleAbundances > abundances, std::vector< T > &result)
Order keys (charges/peptides for peptide/protein quantification) according to how many samples they a...
Definition: PeptideAndProteinQuant.h:204
Representation of a Peak2D, RichPeak2D or Feature .
Definition: FeatureHandle.h:58
Statistics for processing summary.
Definition: PeptideAndProteinQuant.h:105
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
std::map< String, SampleAbundances > abundances
mapping: peptide (unmodified) -> sample -> abundance
Definition: PeptideAndProteinQuant.h:88
Quantitative and associated data for a protein.
Definition: PeptideAndProteinQuant.h:85
Size id_count
total number of identifications (of peptides mapping to this protein)
Definition: PeptideAndProteinQuant.h:94
ProteinQuant prot_quant_
Protein quantification data.
Definition: PeptideAndProteinQuant.h:180
std::map< UInt64, double > SampleAbundances
Mapping: sample ID -> abundance.
Definition: PeptideAndProteinQuant.h:59

OpenMS / TOPP release 2.0.0 Documentation generated on Fri May 29 2015 17:20:28 using doxygen 1.8.9.1