18#ifndef MS_MS2QUANTITATION_HPP
19#define MS_MS2QUANTITATION_HPP
28namespace msparser_internal {
29 class ms_ms2ratiocalculator;
34namespace matrix_science {
36 class ms_quantitation;
37 class ms_peptidesummary;
38 class ms_peptide_quant_key;
39 class ms_peptide_quant_key_vector;
40 class ms_quant_helper;
42 class ms_mascotresfilebase;
139 virtual bool hasPeptideRatio(
const ms_peptide_quant_key &key,
const std::string &ratioName)
const;
142 virtual void setPeptideRatioIncluded(
const ms_peptide_quant_key &key,
const std::string &ratioName);
143 virtual void setPeptideRatioExcluded(
const ms_peptide_quant_key &key,
const std::string &ratioName);
144 virtual bool isPeptideRatioExcluded(
const ms_peptide_quant_key &key,
const std::string &ratioName)
const;
146 virtual void setProteinRatioType(
const char *value);
150 virtual ms_protein_quant_ratio getProteinRatio(
const std::string &accession,
int dbIdx,
const std::string &ratioName)
const;
158 bool getAllProteinRatios(
const std::string & accession,
const int dbIdx,
159 const std::string & ratioName,
160 std::vector<double> & ratios,
161 std::vector<std::vector<bool> > & flags,
165 std::vector<double> getAllProteinRatios(
const std::string & accession,
const int dbIdx,
const std::string & ratioName)
const;
168 std::vector<std::vector<bool> > getAllProteinRatioFlags(
const std::string & accession,
const int dbIdx,
const std::string & ratioName)
const;
174 bool hasPeptideRatioNormalisation()
const;
177 void normalisePeptideRatios();
180 std::vector<double> getComponentIntensities(
const ms_peptide_quant_key &key,
bool raw =
false)
const;
183 void includeProteinPeptideRatioKeys(
const std::string &accession,
int dbIdx,
const std::string &ratioName,
const ms_peptide_quant_key_vector &includeKeys);
186 void excludeProteinPeptideRatioKeys(
const std::string &accession,
int dbIdx,
const std::string &ratioName,
const ms_peptide_quant_key_vector &excludeKeys);
189 std::vector<std::string> getReportRatioNamesInFile(
unsigned int fileNum)
const;
192 const ms_quant_ratio* getReportRatioFromFile(
unsigned int fileNum,
const std::string &ratioName)
const;
195 void setReportRatioInFile(
unsigned int fileNum,
const std::string &ratioName,
const ms_quant_ratio &ratioDef);
198 void removeReportRatioInFile(
unsigned int fileNum,
const std::string &ratioName);
202 std::vector<std::string> getCombinedReportRatioNames()
const;
205 const ms_quant_ratio* getCombinedReportRatio(
const std::string &ratioName)
const;
208 void removeCombinedReportRatio(
const std::string &ratioName);
211 void setCombinedReportRatio(
const std::string &ratioName,
const ms_quant_ratio &ratioDef);
214 double getIntensityNormalisationBase(
const std::string &componentName)
const;
217 void setIntensityNormalisationBase(
const std::string &componentName,
double b);
220 void removeIntensityNormalisationBase(
const std::string &componentName);
223 void removeIntensityNormalisationBases();
226 bool hasIntensityNormalisation()
const;
229 void normaliseIntensities();
232 bool loadCdbFile(
const char* path);
235 bool loadCdbFiles(
const std::vector<std::string> & cdbFiles);
238 bool saveXmlFile(
const std::string & xmlFilename,
bool completeReport);
241 bool saveCdbFile(
const std::string & cdbFilename);
244 using ms_quantitation::countDistinctPeptides;
248 virtual int countDistinctPeptides(
const std::vector<ms_peptide_quant_key> & activeKeys)
const;
251 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;
259 enum SUPPORTED_PROTEIN_RATIO_TYPE {
260 PROTEIN_RATIO_TYPE_MEDIAN = 0,
261 PROTEIN_RATIO_TYPE_AVERAGE,
262 PROTEIN_RATIO_TYPE_WEIGHTED
265 int proteinRatioType_;
268 const unsigned int numResfiles_;
270 std::vector<std::string> componentNames_;
271 std::vector<double>::size_type numComponents_;
273 std::vector<double> componentIntensityNormalisationBase_;
274 bool normaliseComponentIntensities_;
276 bool renormaliseOnDemand_;
278 std::map<ms_peptide_quant_key, bool> peptideQuantKeyQualityTest_;
279 bool testPeptideQuantKeyUniqueness_;
280 bool testedAllKeysForNormalisation_;
283 typedef std::map< std::string, std::set<ms_peptide_quant_key> > ratio_name_to_peptide_quant_key_exclusion_t;
284 std::vector< ratio_name_to_peptide_quant_key_exclusion_t > isPeptideQuantKeyExcluded_;
286 bool useCanonicalQPvalues_;
288 typedef std::pair<int, int> qp_t;
290 int rankToCanonicalRank(
int p)
const;
293 std::vector<double> loadIntensities(
int q,
int p)
const;
295 static const unsigned int FILENUM_LOWER_BOUND;
296 static const unsigned int FILENUM_UPPER_BOUND;
298 typedef std::pair<std::string, unsigned int> ratio_name_and_file_index_t;
299 typedef std::set<ratio_name_and_file_index_t> ratio_name_in_files_t;
300 ratio_name_in_files_t ratioNamesInFiles_;
302 typedef std::list<ms_quant_ratio> quant_ratio_list_t;
303 std::vector<quant_ratio_list_t> fileToQuantRatioList_;
305 std::vector<msparser_internal::ms_ms2ratiocalculator> ratioCalculators_;
307 typedef std::map<std::string, std::set<ms_peptide_quant_key> > sequence_to_peptide_quant_key_t;
308 sequence_to_peptide_quant_key_t sequencePeptideQuantKeys_;
309 std::map<ms_peptide_quant_key, std::string> peptideQuantKeySequence_;
311 typedef std::pair<protein_key_t, std::string> protein_ratio_key_t;
312 typedef std::map<protein_ratio_key_t, ms_peptide_quant_key_vector> user_prot_to_pept_quantkey_override_t;
314 user_prot_to_pept_quantkey_override_t userExcludedKeys_;
316 user_prot_to_pept_quantkey_override_t userIncludedKeys_;
318 void fixRatioSourceRemovalInQM(
const std::string &ratioName);
319 void setRatioContentInQM(
const std::string &ratioName,
unsigned int fileNum);
321 bool calculateUnnormalisedPeptideRatio(
const ms_peptide_quant_key &key,
const std::string &ratioName,
int *fileNum,
bool *isInfinite,
double *value)
const;
325 double calculatePeptideNormalisationBase(
const std::string &ratioName)
const;
326 std::map<std::string, double> calculatePeptideNormalisationBases()
const;
328 void selectAllKeysForNormalisation(std::map<
int, std::pair<int, ms_peptide_quant_key> > &query_keys);
329 std::vector<double> normalisedComponentIntensities(
const std::vector<double> &intensities)
const;
331 bool initialiseReportRatios();
333 bool initialiseQuantHelper();
335 void setReportRatioInFileOnly(
unsigned int fileNum,
const std::string &ratioName,
const ms_quant_ratio &ratioDef);
336 void setReportRatioInFileOnly(
unsigned int fileNum,
const std::string &ratioName,
const ms_quant_ratio &ratioDef, std::string &oldName, std::string &newName);
338 bool removeReportRatioInFileOnly(
unsigned int fileNum,
const std::string &ratioName);
340 std::map<ms_peptide_quant_key, bool>::const_iterator testPeptideQuantKeyQuality(
int q,
int p,
const ms_peptide_quant_key &key);
341 void initialiseProteinPeptideMapping(
const std::string &accession,
int dbIdx);
343 bool savePeptideGroupingToXml(msparser_internal::ms_XMLHelper & helper, msparser_internal::ms_XMLElement & element,
const matrix_science::ms_protein * protein,
int hitId,
int memberNumber)
const;
345 bool savePeptideMatchXml(msparser_internal::ms_XMLHelper & helper, msparser_internal::ms_XMLElement & root,
const ms_peptide_quant_key & key,
long matchid)
const;
347 bool saveEmptyMatrixXml(msparser_internal::ms_XMLHelper & helper, msparser_internal::ms_XMLElement & parent,
const std::string matrixName)
const;
349 bool savePeptideRatioToXml(msparser_internal::ms_XMLHelper & helper, msparser_internal::ms_XMLElement & element,
const ms_peptide_quant_ratio ratio,
const ms_protein * protein = NULL)
const;
351 bool saveProteinHitRatiosToXml(msparser_internal::ms_XMLHelper & helper, msparser_internal::ms_XMLElement & element,
const ms_protein * protein,
int q,
int p)
const;
363 static bool readCdbCounterData(
ms_tinycdb & cdbFile,
unsigned & count);
Peptide and protein quantitation using custom peptide ratios and protein-peptide mappings.
Definition: ms_customquantitation.hpp:119
Abstract base class of ms_mascotresfile_dat and ms_mascotresfile_msr.
Definition: ms_mascotresfilebase.hpp:72
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
Helper routines for peptide quantitation.
Definition: ms_quant_helper.hpp:50
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 normalisation element in quantitation.xml.
Definition: ms_quant_normalisation.hpp:42
An object of this class represent a single OUTLIERS element in quantitation.xml.
Definition: ms_quant_outliers.hpp:44
Represents the ratioType type for the report_ratio element in quantitation.xml.
Definition: ms_quant_ratio.hpp:41
Base class for peptide and protein quantitation.
Definition: ms_quantitation.hpp:138
Wrapper for the public domain tinycdb package http://www.corpit.ru/mjt/tinycdb.html by Michael Tokare...
Definition: ms_tinycdb.hpp:124