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: martins $ #
00012 #       $Date: 2015/01/08 15:34:26 $ #
00013 #   $Revision: 1.17 $ #
00014 # $NoKeywords::                                                            $ #
00015 ##############################################################################
00016 */
00017 
00018 #ifndef MS_CUSTOMQUANTITATION_HPP
00019 #define MS_CUSTOMQUANTITATION_HPP
00020 
00021 #ifdef _WIN32
00022 #pragma warning(disable:4251)   // Don't want all classes to be exported
00023 #pragma warning(disable:4786)   // Debug symbols too long
00024 #   ifndef _MATRIX_USE_STATIC_LIB
00025 #       ifdef MS_MASCOTRESFILE_EXPORTS
00026 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00027 #       else
00028 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00029 #       endif
00030 #   else
00031 #       define MS_MASCOTRESFILE_API
00032 #   endif
00033 #else
00034 #   define MS_MASCOTRESFILE_API
00035 #endif
00036 
00037 // Includes from the standard template library
00038 #include <string>
00039 #include <vector>
00040 #include <utility>
00041 
00042 namespace msparser_internal {
00043     struct peptide_ratio_data_t;
00044 }
00045 
00046 namespace matrix_science {
00047     class ms_peptide_quant_ratio;
00048     class ms_quantitation;
00049     class ms_peptidesummary;
00050     class ms_ms2quantitation;
00051     class ms_protein;
00052     class ms_peptide_quant_key;
00053     class ms_peptide_quant_key_vector;
00054     class ms_quant_average;
00055     using namespace msparser_internal;
00056 
00062 
00063 
00134     class MS_MASCOTRESFILE_API ms_customquantitation: public ms_quantitation
00135     {
00136         public:
00138             explicit ms_customquantitation(const ms_quant_method &qm);
00139 
00141             explicit ms_customquantitation(const ms_peptidesummary &initFrom);
00142 
00144             ms_customquantitation(const ms_peptidesummary &initFrom, const ms_quant_method &qm);
00145 
00147             explicit ms_customquantitation(const ms_ms2quantitation &copyFrom);
00148 
00150             virtual ~ms_customquantitation();
00151 
00152             virtual bool hasPeptideRatio(const ms_peptide_quant_key &key, const std::string &ratioName) const;
00153             virtual ms_peptide_quant_ratio getPeptideRatio(const ms_peptide_quant_key &key, const std::string &ratioName) const;
00154 
00155             virtual bool isPeptideRatioExcluded(const ms_peptide_quant_key &key, const std::string &ratioName) const;
00156             virtual void setPeptideRatioIncluded(const ms_peptide_quant_key &key, const std::string &ratioName);
00157             virtual void setPeptideRatioExcluded(const ms_peptide_quant_key &key, const std::string &ratioName);
00158 
00159             virtual void setProteinRatioType(const char *value);
00160 
00161             virtual void setQuantOutliers(const ms_quant_outliers *);
00162 
00163             virtual ms_protein_quant_ratio getProteinRatio(const std::string &accession, int dbIdx, const std::string &ratioName) const;
00164 
00165             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;
00166 
00168             void addPeptideRatio(const ms_peptide_quant_ratio &ratio);
00169 
00171             void removePeptideRatio(const ms_peptide_quant_key &key, const std::string &ratioName);
00172 
00174             void clearPeptideRatios();
00175 
00177             void addPeptideQuantKey(const std::string &accession, int dbIdx, const ms_peptide_quant_key &key);
00178 
00180             void addPeptideQuantKeys(const std::string &accession, int dbIdx, const std::vector<ms_peptide_quant_key> &keys);
00181 
00183             void addPeptideQuantKeys(const std::string &accession, int dbIdx, const ms_peptide_quant_key_vector &keys);
00184 
00186             void removePeptideQuantKey(const std::string &accession, int dbIdx, const ms_peptide_quant_key &key);
00187 
00189             void clearPeptideQuantKeys(const std::string &accession, int dbIdx);
00190 
00192             double getUnnormalisedAveragePeptideRatio(const std::string &ratioName, const std::string &averageType) const;
00193 
00195             double getUnnormalisedAveragePeptideRatio(const std::string &ratioName, const std::string &averageType, const ms_peptide_quant_key_vector &keys) const;
00196 
00198             double getUnnormalisedAveragePeptideRatio(const std::string &ratioName, const std::string &averageType, const std::string &accession, int dbIdx) const;
00199 
00200         protected:
00201             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;
00202 
00203             void addPeptideQuantKeySibling(const ms_peptide_quant_key & originalKey, const ms_peptide_quant_key & newKey);
00204             void removePeptideQuantKeySibling(const ms_peptide_quant_key & newKey);
00205 
00206         private:
00207             ms_customquantitation(const ms_customquantitation &copyFrom);
00208             ms_customquantitation& operator=(const ms_customquantitation &right);
00209 
00210             typedef std::string ratio_name_t;
00211 
00212             typedef std::map< ms_peptide_quant_key, peptide_ratio_data_t* > peptide_quant_key_to_ratio_pointer_t;
00213             typedef std::multimap< peptide_ratio_data_t*, ms_peptide_quant_key > ratio_pointer_to_peptide_quant_key_t;
00214 
00215             typedef std::map< ratio_name_t, peptide_quant_key_to_ratio_pointer_t > ratio_name_to_peptide_quant_key_map_t;
00216             typedef std::map< ratio_name_t, ratio_pointer_to_peptide_quant_key_t > ratio_name_to_pointer_map_t;
00217 
00218             bool lookupPeptideRatioNondestructive(const ms_peptide_quant_key &key, const std::string &ratioName, peptide_quant_key_to_ratio_pointer_t **qpmap, peptide_ratio_data_t **rp);
00219             bool lookupPeptideRatioNondestructive(const ms_peptide_quant_key &key, const std::string &ratioName, const peptide_quant_key_to_ratio_pointer_t **qpmap = NULL, const peptide_ratio_data_t **rp = NULL) const;
00220 
00221             bool insertPeptideRatio(const ms_peptide_quant_ratio &ratio);
00222             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);
00223             void deleteAlias(const std::string &ratioName, const ms_peptide_quant_key &key);
00224             void deleteAliases(const std::string &ratioName, const ms_peptide_quant_key &key);
00225             void deallocatePeptideRatios();
00226 
00227             double calculateAverageRatio(const std::vector<double> &values, const std::string &kind) const;
00228 
00229             std::set< peptide_ratio_data_t* > peptideRatioPool_;
00230             ratio_name_to_peptide_quant_key_map_t ratioNameToPeptideQuantKeyMap_;
00231             ratio_name_to_pointer_map_t ratioNameToPointerMap_;
00232 
00233             enum SUPPORTED_PROTEIN_RATIO_TYPE {
00234                 PROTEIN_RATIO_TYPE_MEDIAN = 0,
00235                 PROTEIN_RATIO_TYPE_AVERAGE,
00236                 PROTEIN_RATIO_TYPE_WEIGHTED
00237             };
00238 
00239             int proteinRatioType_;
00240 
00241             bool initialiseProteinMappingFromResultsFile(const ms_peptidesummary &pepsum);
00242             bool initialisePeptideQuantKeys(const ms_peptidesummary &pepsum, const ms_protein *protein);
00243 
00244     }; // end of quantitation_group
00246 }   // matrix_science namespace
00247 
00248 #endif // MS_CUSTOMQUANTITATION_HPP
00249 
00250 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:50