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-2017.
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 readQuantData(FeatureMap& features);
138 
144  void readQuantData(ConsensusMap& consensus);
145 
151  void readQuantData(std::vector<ProteinIdentification>& proteins,
152  std::vector<PeptideIdentification>& peptides);
153 
163  void quantifyPeptides(const std::vector<PeptideIdentification>& peptides =
164  std::vector<PeptideIdentification>());
165 
166 
172  void quantifyProteins(const ProteinIdentification& proteins =
174 
176  const Statistics& getStatistics();
177 
179  const PeptideQuant& getPeptideResults();
180 
182  const ProteinQuant& getProteinResults();
183 
184 private:
185 
188 
190  PeptideQuant pep_quant_;
191 
193  ProteinQuant prot_quant_;
194 
195 
202  PeptideHit getAnnotation_(std::vector<PeptideIdentification>& peptides);
203 
209  void quantifyFeature_(const FeatureHandle& feature, const PeptideHit& hit);
210 
216  template <typename T>
217  void orderBest_(const std::map<T, SampleAbundances> abundances,
218  std::vector<T>& result)
219  {
220  typedef std::pair<Size, double> PairType;
221  std::multimap<PairType, T, std::greater<PairType> > order;
222  for (typename std::map<T, SampleAbundances>::const_iterator ab_it =
223  abundances.begin(); ab_it != abundances.end(); ++ab_it)
224  {
225  double total = 0.0;
226  for (SampleAbundances::const_iterator samp_it = ab_it->second.begin();
227  samp_it != ab_it->second.end(); ++samp_it)
228  {
229  total += samp_it->second;
230  }
231  if (total <= 0.0) continue; // not quantified
232  PairType key = std::make_pair(ab_it->second.size(), total);
233  order.insert(std::make_pair(key, ab_it->first));
234  }
235  result.clear();
236  for (typename std::multimap<PairType, T, std::greater<PairType> >::
237  iterator ord_it = order.begin(); ord_it != order.end(); ++ord_it)
238  {
239  result.push_back(ord_it->second);
240  }
241  }
242 
246  void normalizePeptides_();
247 
260  String getAccession_(const std::set<String>& pep_accessions,
261  std::map<String, String>& accession_to_leader);
262 
268  void countPeptides_(std::vector<PeptideIdentification>& peptides);
269 
271  void updateMembers_();
272 
273  }; // class
274 
275 } // namespace
276 
277 #endif // OPENMS_ANALYSIS_QUANTITATION_PEPTIDEANDPROTEINQUANT_H
Size too_few_peptides
Definition: PeptideAndProteinQuant.h:111
Representation of a protein identification run.
Definition: ProteinIdentification.h:62
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:94
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:190
~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:187
SampleAbundances total_abundances
mapping: sample -> total abundance
Definition: PeptideAndProteinQuant.h:68
SampleAbundances total_abundances
mapping: sample -> total abundance
Definition: PeptideAndProteinQuant.h:91
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
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:217
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:193
std::map< UInt64, double > SampleAbundances
Mapping: sample ID -> abundance.
Definition: PeptideAndProteinQuant.h:59

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:03 using doxygen 1.8.13