Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_customquantitation.hpp
1/*
2##############################################################################
3# file: ms_customquantitation.hpp #
4# 'msparser' toolkit #
5# Quantitation for Reporter and Multiplex protocols #
6##############################################################################
7# COPYRIGHT NOTICE #
8# Copyright 1998-2013 Matrix Science Limited All Rights Reserved. #
9# #
10##############################################################################
11# $Author: francoisr@matrixscience.com $ #
12# $Date: 2018-11-22 11:02:10 +0000 $ #
13# $Revision: b577d675f5daad88ac6730bda521ef7317380154 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
14# $NoKeywords:: $ #
15##############################################################################
16*/
17
18#ifndef MS_CUSTOMQUANTITATION_HPP
19#define MS_CUSTOMQUANTITATION_HPP
20
21
22// Includes from the standard template library
23#include <string>
24#include <vector>
25#include <utility>
26
27namespace msparser_internal {
28 struct peptide_ratio_data_t;
29}
30
31namespace matrix_science {
32 class ms_peptide_quant_ratio;
33 class ms_quantitation;
34 class ms_peptidesummary;
35 class ms_ms2quantitation;
36 class ms_protein;
37 class ms_peptide_quant_key;
38 class ms_peptide_quant_key_vector;
39 class ms_quant_average;
40
47
118 class MS_MASCOTRESFILE_API ms_customquantitation: public ms_quantitation
119 {
120 public:
122 explicit ms_customquantitation(const ms_quant_method &qm);
123
125 explicit ms_customquantitation(const ms_peptidesummary &initFrom);
126
128 ms_customquantitation(const ms_peptidesummary &initFrom, const ms_quant_method &qm);
129
131 explicit ms_customquantitation(const ms_ms2quantitation &copyFrom);
132
134 virtual ~ms_customquantitation();
135
136 virtual bool hasPeptideRatio(const ms_peptide_quant_key &key, const std::string &ratioName) const;
137 virtual ms_peptide_quant_ratio getPeptideRatio(const ms_peptide_quant_key &key, const std::string &ratioName) const;
138
139 virtual bool isPeptideRatioExcluded(const ms_peptide_quant_key &key, const std::string &ratioName) const;
140 virtual void setPeptideRatioIncluded(const ms_peptide_quant_key &key, const std::string &ratioName);
141 virtual void setPeptideRatioExcluded(const ms_peptide_quant_key &key, const std::string &ratioName);
142
143 virtual void setProteinRatioType(const char *value);
144
145 virtual void setQuantOutliers(const ms_quant_outliers *);
146
147 virtual ms_protein_quant_ratio getProteinRatio(const std::string &accession, int dbIdx, const std::string &ratioName) const;
148
149 virtual ms_protein_quant_ratio getProteinRatio(const std::string &accession, int dbIdx, const std::string &ratioName, const ms_peptide_quant_key_vector &includeKeys, const ms_peptide_quant_key_vector &excludeKeys) const;
150
152 void addPeptideRatio(const ms_peptide_quant_ratio &ratio);
153
155 void removePeptideRatio(const ms_peptide_quant_key &key, const std::string &ratioName);
156
158 void clearPeptideRatios();
159
161 void addPeptideQuantKey(const std::string &accession, int dbIdx, const ms_peptide_quant_key &key);
162
164 void addPeptideQuantKeys(const std::string &accession, int dbIdx, const std::vector<ms_peptide_quant_key> &keys);
165
167 void addPeptideQuantKeys(const std::string &accession, int dbIdx, const ms_peptide_quant_key_vector &keys);
168
170 void removePeptideQuantKey(const std::string &accession, int dbIdx, const ms_peptide_quant_key &key);
171
173 void clearPeptideQuantKeys(const std::string &accession, int dbIdx);
174
176 double getUnnormalisedAveragePeptideRatio(const std::string &ratioName, const std::string &averageType) const;
177
179 double getUnnormalisedAveragePeptideRatio(const std::string &ratioName, const std::string &averageType, const ms_peptide_quant_key_vector &keys) const;
180
182 double getUnnormalisedAveragePeptideRatio(const std::string &ratioName, const std::string &averageType, const std::string &accession, int dbIdx) const;
183
184 protected:
185 virtual void getSortedFinitePeptideRatioValues(const std::string &ratioName, const std::set<ms_peptide_quant_key> &keys, const std::set<ms_peptide_quant_key> &includeKeys, const std::set<ms_peptide_quant_key> &excludeKEys, std::vector<double> &values, std::vector<double> &weights, std::vector<ms_peptide_quant_key> &activeKeys, std::map<ms_peptide_quant_key, int> &inactiveKeys) const;
186
187 void addPeptideQuantKeySibling(const ms_peptide_quant_key & originalKey, const ms_peptide_quant_key & newKey);
188 void removePeptideQuantKeySibling(const ms_peptide_quant_key & newKey);
189
190 private:
192 ms_customquantitation& operator=(const ms_customquantitation &right);
193
194 typedef std::string ratio_name_t;
195
196 typedef std::map< ms_peptide_quant_key, msparser_internal::peptide_ratio_data_t* > peptide_quant_key_to_ratio_pointer_t;
197 typedef std::multimap< msparser_internal::peptide_ratio_data_t*, ms_peptide_quant_key > ratio_pointer_to_peptide_quant_key_t;
198
199 typedef std::map< ratio_name_t, peptide_quant_key_to_ratio_pointer_t > ratio_name_to_peptide_quant_key_map_t;
200 typedef std::map< ratio_name_t, ratio_pointer_to_peptide_quant_key_t > ratio_name_to_pointer_map_t;
201
202 bool lookupPeptideRatioNondestructive(const ms_peptide_quant_key &key, const std::string &ratioName, peptide_quant_key_to_ratio_pointer_t **qpmap, msparser_internal::peptide_ratio_data_t **rp);
203 bool lookupPeptideRatioNondestructive(const ms_peptide_quant_key &key, const std::string &ratioName, const peptide_quant_key_to_ratio_pointer_t **qpmap = NULL, const msparser_internal::peptide_ratio_data_t **rp = NULL) const;
204
205 bool insertPeptideRatio(const ms_peptide_quant_ratio &ratio);
206 msparser_internal::peptide_ratio_data_t* insertPeptideRatio(const std::string &ratioName, bool isMissing, const ms_peptide_quant_key &key, bool isInfinite, bool isExcluded, double value, double weight);
207 void deleteAlias(const std::string &ratioName, const ms_peptide_quant_key &key);
208 void deleteAliases(const std::string &ratioName, const ms_peptide_quant_key &key);
209 void deallocatePeptideRatios();
210
211 double calculateAverageRatio(const std::vector<double> &values, const std::string &kind) const;
212
213 std::set< msparser_internal::peptide_ratio_data_t* > peptideRatioPool_;
214 ratio_name_to_peptide_quant_key_map_t ratioNameToPeptideQuantKeyMap_;
215 ratio_name_to_pointer_map_t ratioNameToPointerMap_;
216
217 enum SUPPORTED_PROTEIN_RATIO_TYPE {
218 PROTEIN_RATIO_TYPE_MEDIAN = 0,
219 PROTEIN_RATIO_TYPE_AVERAGE,
220 PROTEIN_RATIO_TYPE_WEIGHTED
221 };
222
223 int proteinRatioType_;
224
225 bool initialiseProteinMappingFromResultsFile(const ms_peptidesummary &pepsum);
226 bool initialisePeptideQuantKeys(const ms_peptidesummary &pepsum, const ms_protein *protein);
227
228 }; // end of quantitation_group
230} // matrix_science namespace
231
232#endif // MS_CUSTOMQUANTITATION_HPP
233
234/*------------------------------- End of File -------------------------------*/
Peptide and protein quantitation using custom peptide ratios and protein-peptide mappings.
Definition: ms_customquantitation.hpp:119
Peptide and protein quantitation in a Reporter or Multiplex Mascot results file.
Definition: ms_ms2quantitation.hpp:127
A vector of peptide quant keys.
Definition: ms_peptide_quant_key_vector.hpp:47
Feature key identifying a peptide ratio.
Definition: ms_peptide_quant_key.hpp:69
Peptide abundance in one component relative to another in a quantitation experiment.
Definition: ms_peptide_quant_ratio.hpp:61
Use this class to get peptide summary results.
Definition: ms_peptidesummary.hpp:51
Protein abundance in one component relative to another in a quantitation experiment,...
Definition: ms_protein_quant_ratio.hpp:72
This class encapsulates a protein in the mascot results file.
Definition: ms_protein.hpp:57
An object of this class represent a single quantitation method from quantitation.xml.
Definition: ms_quant_method.hpp:51
An object of this class represent a single OUTLIERS element in quantitation.xml.
Definition: ms_quant_outliers.hpp:44
Base class for peptide and protein quantitation.
Definition: ms_quantitation.hpp:138