Matrix Science header

ms_quant_helper.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_quant_helper.hpp                                                  #
00004 # 'msparser' toolkit                                                         #
00005 # Helper routines for peptide and protein quantitation                       #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2013 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 #     $Author: villek $ #
00012 #       $Date: 2015/11/04 13:46:52 $ #
00013 #   $Revision: 1.11 $ #
00014 # $NoKeywords::                                                            $ #
00015 ##############################################################################
00016 */
00017 
00018 #ifndef MS_QUANT_HELPER_HPP
00019 #define MS_QUANT_HELPER_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 #include <string>
00038 #include <vector>
00039 #include <list>
00040 
00041 namespace msparser_internal {
00042     typedef std::pair<char, int> modification_site_t;
00043     typedef std::vector<modification_site_t> modification_sites_t;
00044     typedef std::map<std::string, char> varmod_title_map_t;
00045 }
00046 
00047 namespace matrix_science {
00048     class ms_quant_method;
00049     class ms_quant_localdef;
00050     class ms_quant_unmodified;
00051     class ms_peptide;
00052     class ms_peptidesummary;
00053     class ms_protein;
00054     class ms_ms1quant_match;
00055 
00056     using namespace msparser_internal;
00057 
00063 
00064 
00066     class MS_MASCOTRESFILE_API ms_quant_helper: public ms_errors
00067     {
00068         public:
00070             enum PEPTIDE_QUANTIFIABILITY {
00071                 PEPTIDE_IS_QUANTIFIABLE             = 0x0000, 
00072                 PEPTIDE_HAS_NO_REQUIRED_FIXEDMOD    = 0x0001, 
00073                 PEPTIDE_HAS_NO_REQUIRED_VARMOD      = 0x0002, 
00074                 PEPTIDE_HAS_EXCLUDED_FIXEDMOD       = 0x0010, 
00075                 PEPTIDE_HAS_EXCLUDED_LOCAL_FIXEDMOD = 0x0011, 
00076                 PEPTIDE_HAS_EXCLUDED_VARMOD         = 0x0012, 
00077                 PEPTIDE_HAS_UNMODIFIED_SITE         = 0x0013, 
00078                 PEPTIDE_HAS_EXCLUDED_LOCAL_VARMOD   = 0x0014, 
00079 
00080                 PEPTIDE_QUANTIFIABILITY_UNAVAILABLE = 0xf000 
00081             };
00082 
00084             enum PEPTIDE_QUALITY {
00085                 PEPTIDE_QUALITY_IS_OK                  = 0x0000, 
00086                 PEPTIDE_CHARGE_BELOW_PRECURSOR_MIN     = 0x0001, 
00087                 PEPTIDE_SCORE_BELOW_SCORE_THR          = 0x0002, 
00088                 PEPTIDE_EXPECT_ABOVE_THRESHOLD         = 0x0003, 
00089                 PEPTIDE_SCORE_BELOW_IDENTITY_THR       = 0x0004, 
00090                 PEPTIDE_SCORE_BELOW_IDENTITY_THR_NOHOM = 0x0005, 
00091                 PEPTIDE_SCORE_BELOW_HOMOLOGY_THR       = 0x0006, 
00092                 PEPTIDE_NOT_UNIQUE                     = 0x0007, 
00093                 PEPTIDE_HAS_NO_EXCLUSIVE_MODS          = 0x0010, 
00094 
00095                 PEPTIDE_QUALITY_UNAVAILABLE            = 0xf000 
00096             };
00097 
00099             ms_quant_helper(const ms_peptidesummary &pepsum, const ms_quant_method &qm, const ms_umod_configfile &umodfile);
00100 
00102             ~ms_quant_helper();
00103 
00104             const ms_peptidesummary & getSummary() const;
00105             const ms_quant_method & getMethod() const;
00106 
00108             int isPeptideQuantifiable(int q, int p, const ms_protein *protein, int peptideIndex, std::string & reasonStrRef) const;
00109 
00111             int isPeptideQualityOK(int q, int p, std::string & reasonStrRef) const;
00112 
00114             int testProteinTerminusExclusion(int q, int p, const ms_protein *, int peptideIndex, std::string & reason) const;
00115 
00117             int createMissingComponents(matrix_science::ms_ms1quant_match * match) const;
00118 
00119             matrix_science::ms_ms1quant_peptide_status::peptideStatus group_peptide(
00120                     const matrix_science::ms_protein & hit,
00121                     int iPeptide,
00122                     matrix_science::ms_peptide *& peptide,
00123                     matrix_science::ms_quant_component & component,
00124                     matrix_science::ms_quant_helper::PEPTIDE_QUANTIFIABILITY * quantifiabilityStatus = 0,
00125                     matrix_science::ms_quant_helper::PEPTIDE_QUALITY * qualityStatus = 0,
00126                     matrix_science::ms_mascotresults::QUANT_COMPONENT_STATUS * componentStatus = 0,
00127                     std::string * reason = 0 ) const;
00128 
00129             matrix_science::ms_ms1quant_peptide_status::peptideStatus group_peptide(
00130                     const matrix_science::ms_peptide & peptide,
00131                     matrix_science::ms_quant_component & component,
00132                     matrix_science::ms_quant_helper::PEPTIDE_QUANTIFIABILITY * quantifiabilityStatus = 0,
00133                     matrix_science::ms_quant_helper::PEPTIDE_QUALITY * qualityStatus = 0,
00134                     matrix_science::ms_mascotresults::QUANT_COMPONENT_STATUS * componentStatus = 0,
00135                     std::string * reason = 0,
00136                     const matrix_science::ms_protein * hit = 0,
00137                     int iPeptide = 0
00138                      ) const;
00139 
00140         private:
00141             // No copying.
00142             ms_quant_helper(const ms_quant_helper& src);
00143             ms_quant_helper& operator=(const ms_quant_helper& right);
00144 
00145             void applyComponentMods(
00146                     std::string * newVarMods,
00147                     std::string * newSummedMods,
00148                     const matrix_science::ms_quant_component & targetComponent,
00149                     const std::string & pepStr,
00150                     const std::string & labelFreeVarMods,
00151                     bool isProteinNterm,
00152                     bool isProteinCterm
00153                     ) const;
00154 
00155             char ModLetter(const std::string & modName) const;
00156 
00157             const ms_peptidesummary &pepsum_;
00158             const ms_quant_method &method_;
00159             const ms_umod_configfile & umodfile_;
00160 
00161             std::map<char, std::string> varModTitles_;
00162             std::map<char, std::string> fixedModTitles_;
00163 
00164             bool haveRequiredMods_;
00165             std::string sortedRequiredFixedMods_;
00166             std::string sortedRequiredVarMods_;
00167 
00168             bool haveExclusions_;
00169             bool haveProteinTerminusTest_;
00170 
00171             typedef struct {
00172                 int why;
00173                 std::string fmt;
00174                 modification_sites_t modsites;
00175             } fixed_exclusion_t;
00176 
00177             typedef struct {
00178                 int why;
00179                 std::string fmt;
00180                 char varmod_id;
00181                 modification_sites_t modsites;
00182             } variable_exclusion_t;
00183 
00184             std::list<fixed_exclusion_t> fixedExclusions_;
00185             std::list<variable_exclusion_t> variableExclusions_;
00186 
00187             bool initRequiredMods(const ms_quant_modgroup *modgroup, const ms_umod_configfile &umodfile, const varmod_title_map_t &varmod_title_map, std::set<char> &requiredFixedMods, std::set<char> &requiredVarMods);
00188             bool initFixedExclusion(const ms_quant_modgroup *modgroup, const ms_umod_configfile &umodfile);
00189 
00190             bool initVariableExclusion(const ms_quant_modgroup *modgroup, const ms_umod_configfile &umodfile, const varmod_title_map_t &varmod_title_map, std::list<variable_exclusion_t> &variableExclusions);
00191 
00192             int testRequiredMods(const std::string &peptide_str, const std::string &varmods_str, std::string & reason) const;
00193             int testFixedExclusions(const std::string &peptide_str, const std::string &varmods_str, const ms_protein *protein, int peptideIndex, std::string & reason) const;
00194             int testVariableExclusions(const std::string &peptide_str, const std::string &varmods_str, const ms_protein *protein, int peptideIndex, std::string & reason) const;
00195 
00196             bool requireUniquePeptide_;
00197             int minPrecursorCharge_;
00198             double ionsScoreThreshold_;
00199             double expectationValueThreshold_;
00200             bool mustPassIdentityThreshold_;
00201             bool mustPassHomologyThreshold_;
00202 
00203             std::list< std::list<variable_exclusion_t> > qualityExclusions_;
00204 
00205             bool peptideFitsExclusiveGroup(const std::string &peptide_str, const std::string &varmods_str) const;
00206             bool peptideFitsExclusiveGroupMods(const std::string &peptide_str, const std::string &varmods_str, const std::list<variable_exclusion_t> &qualityExclusions) const;
00207 
00208             static bool mod_can_be_fixed(char site, int position);
00209             static bool excluded_due_to_fixed_mod(const std::string &peptide_str, char site, int position);
00210             static bool excluded_due_to_variable_mod(const std::string &peptide_str, const std::string &varmods_str, char site, int position, char varmod_id, const ms_protein *protein, int peptideIndex);
00211 
00212     }; // end of quantitation_group
00214 }   // matrix_science namespace
00215 
00216 #endif // MS_QUANT_HELPER_HPP
00217 
00218 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51