Matrix Science header

ms_customquantitation.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_customquantitation.hpp                                               #
00004 # 'msparser' toolkit                                                         #
00005 # Quantitation for Reporter and Multiplex protocols                          #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2013 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 #     $Author: francoisr@matrixscience.com $ #
00012 #       $Date: 2018-11-22 11:02:10 +0000 $ #
00013 #   $Revision: b577d675f5daad88ac6730bda521ef7317380154 | MSPARSER_REL_2_8_1-0-gea32989045 $ #
00014 # $NoKeywords::                                                            $ #
00015 ##############################################################################
00016 */
00017 
00018 #ifndef MS_CUSTOMQUANTITATION_HPP
00019 #define MS_CUSTOMQUANTITATION_HPP
00020 
00021 
00022 // Includes from the standard template library
00023 #include <string>
00024 #include <vector>
00025 #include <utility>
00026 
00027 namespace msparser_internal {
00028     struct peptide_ratio_data_t;
00029 }
00030 
00031 namespace matrix_science {
00032     class ms_peptide_quant_ratio;
00033     class ms_quantitation;
00034     class ms_peptidesummary;
00035     class ms_ms2quantitation;
00036     class ms_protein;
00037     class ms_peptide_quant_key;
00038     class ms_peptide_quant_key_vector;
00039     class ms_quant_average;
00040 
00046 
00047 
00118     class MS_MASCOTRESFILE_API ms_customquantitation: public ms_quantitation
00119     {
00120         public:
00122             explicit ms_customquantitation(const ms_quant_method &qm);
00123 
00125             explicit ms_customquantitation(const ms_peptidesummary &initFrom);
00126 
00128             ms_customquantitation(const ms_peptidesummary &initFrom, const ms_quant_method &qm);
00129 
00131             explicit ms_customquantitation(const ms_ms2quantitation &copyFrom);
00132 
00134             virtual ~ms_customquantitation();
00135 
00136             virtual bool hasPeptideRatio(const ms_peptide_quant_key &key, const std::string &ratioName) const;
00137             virtual ms_peptide_quant_ratio getPeptideRatio(const ms_peptide_quant_key &key, const std::string &ratioName) const;
00138 
00139             virtual bool isPeptideRatioExcluded(const ms_peptide_quant_key &key, const std::string &ratioName) const;
00140             virtual void setPeptideRatioIncluded(const ms_peptide_quant_key &key, const std::string &ratioName);
00141             virtual void setPeptideRatioExcluded(const ms_peptide_quant_key &key, const std::string &ratioName);
00142 
00143             virtual void setProteinRatioType(const char *value);
00144 
00145             virtual void setQuantOutliers(const ms_quant_outliers *);
00146 
00147             virtual ms_protein_quant_ratio getProteinRatio(const std::string &accession, int dbIdx, const std::string &ratioName) const;
00148 
00149             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;
00150 
00152             void addPeptideRatio(const ms_peptide_quant_ratio &ratio);
00153 
00155             void removePeptideRatio(const ms_peptide_quant_key &key, const std::string &ratioName);
00156 
00158             void clearPeptideRatios();
00159 
00161             void addPeptideQuantKey(const std::string &accession, int dbIdx, const ms_peptide_quant_key &key);
00162 
00164             void addPeptideQuantKeys(const std::string &accession, int dbIdx, const std::vector<ms_peptide_quant_key> &keys);
00165 
00167             void addPeptideQuantKeys(const std::string &accession, int dbIdx, const ms_peptide_quant_key_vector &keys);
00168 
00170             void removePeptideQuantKey(const std::string &accession, int dbIdx, const ms_peptide_quant_key &key);
00171 
00173             void clearPeptideQuantKeys(const std::string &accession, int dbIdx);
00174 
00176             double getUnnormalisedAveragePeptideRatio(const std::string &ratioName, const std::string &averageType) const;
00177 
00179             double getUnnormalisedAveragePeptideRatio(const std::string &ratioName, const std::string &averageType, const ms_peptide_quant_key_vector &keys) const;
00180 
00182             double getUnnormalisedAveragePeptideRatio(const std::string &ratioName, const std::string &averageType, const std::string &accession, int dbIdx) const;
00183 
00184         protected:
00185             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;
00186 
00187             void addPeptideQuantKeySibling(const ms_peptide_quant_key & originalKey, const ms_peptide_quant_key & newKey);
00188             void removePeptideQuantKeySibling(const ms_peptide_quant_key & newKey);
00189 
00190         private:
00191             ms_customquantitation(const ms_customquantitation &copyFrom);
00192             ms_customquantitation& operator=(const ms_customquantitation &right);
00193 
00194             typedef std::string ratio_name_t;
00195 
00196             typedef std::map< ms_peptide_quant_key, msparser_internal::peptide_ratio_data_t* > peptide_quant_key_to_ratio_pointer_t;
00197             typedef std::multimap< msparser_internal::peptide_ratio_data_t*, ms_peptide_quant_key > ratio_pointer_to_peptide_quant_key_t;
00198 
00199             typedef std::map< ratio_name_t, peptide_quant_key_to_ratio_pointer_t > ratio_name_to_peptide_quant_key_map_t;
00200             typedef std::map< ratio_name_t, ratio_pointer_to_peptide_quant_key_t > ratio_name_to_pointer_map_t;
00201 
00202             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);
00203             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;
00204 
00205             bool insertPeptideRatio(const ms_peptide_quant_ratio &ratio);
00206             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);
00207             void deleteAlias(const std::string &ratioName, const ms_peptide_quant_key &key);
00208             void deleteAliases(const std::string &ratioName, const ms_peptide_quant_key &key);
00209             void deallocatePeptideRatios();
00210 
00211             double calculateAverageRatio(const std::vector<double> &values, const std::string &kind) const;
00212 
00213             std::set< msparser_internal::peptide_ratio_data_t* > peptideRatioPool_;
00214             ratio_name_to_peptide_quant_key_map_t ratioNameToPeptideQuantKeyMap_;
00215             ratio_name_to_pointer_map_t ratioNameToPointerMap_;
00216 
00217             enum SUPPORTED_PROTEIN_RATIO_TYPE {
00218                 PROTEIN_RATIO_TYPE_MEDIAN = 0,
00219                 PROTEIN_RATIO_TYPE_AVERAGE,
00220                 PROTEIN_RATIO_TYPE_WEIGHTED
00221             };
00222 
00223             int proteinRatioType_;
00224 
00225             bool initialiseProteinMappingFromResultsFile(const ms_peptidesummary &pepsum);
00226             bool initialisePeptideQuantKeys(const ms_peptidesummary &pepsum, const ms_protein *protein);
00227 
00228     }; // end of quantitation_group
00230 }   // matrix_science namespace
00231 
00232 #endif // MS_CUSTOMQUANTITATION_HPP
00233 
00234 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29