Matrix Science header

ms_aahelper.hpp

00001 /*
00002 ##############################################################################
00003 # File: ms_aahelper.hpp                                                      #
00004 # Mascot Parser toolkit                                                      #
00005 # Utility functions for generating peptides, peptide and fragment masses     #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2006 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 #    $Source: /vol/cvsroot/parser/inc/ms_aahelper.hpp,v $
00012 #    $Author: villek $ 
00013 #      $Date: 2013/12/04 14:37:10 $ 
00014 #  $Revision: 1.27 $
00015 ##############################################################################
00016 */
00017 
00018 #ifndef MS_AAHELPER_HPP
00019 #define MS_AAHELPER_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 // for the sake of #include <string>
00038 #ifdef __ALPHA_UNIX__
00039 #include <ctype.h>
00040 #endif
00041 #include <string>
00042 #include <vector>
00043 
00044 
00045 namespace matrix_science {
00052 
00053     class MS_MASCOTRESFILE_API ms_aahelper: public ms_errors
00054     {
00055     public:
00057         ms_aahelper();
00058 
00060         ms_aahelper(const ms_mascotresfile & resfile, 
00061                     const char * enzymeFileName,
00062                     const char * quantSchemaFilePath = "http://www.matrixscience.com/xmlns/schema/quantitation_2  ../html/xmlns/schema/quantitation_2/quantitation_2.xsd http://www.matrixscience.com/xmlns/schema/quantitation_1 ../html/xmlns/schema/quantitation_1/quantitation_1.xsd",
00063                     const char * unimodSchemaFilePath = "http://www.unimod.org/xmlns/schema/unimod_2 ../html/xmlns/schema/unimod_2/unimod_2.xsd");
00064 
00066         ms_aahelper(const ms_aahelper& right);
00067 
00069         ~ms_aahelper();
00070 
00071 #ifndef SWIG
00072 
00073         ms_aahelper& operator=(const ms_aahelper& right);
00074 #endif
00075 
00076         void copyFrom(const ms_aahelper* right);
00077 
00079         void defaultValues();
00080 
00082         void setEnzyme(const ms_enzyme* enzyme);
00083 
00085         const ms_enzyme* getEnzyme() const;
00086 
00088         void setMasses(const ms_masses *masses);
00089 
00091         const ms_masses* getMasses() const;
00092 
00094         void setAvailableModifications(const ms_modvector *fixedModVector, 
00095                                        const ms_modvector *varModVector);
00096 
00098         ms_modvector getFixedMods() const;
00099 
00101         ms_modvector getVarMods() const;
00102 
00104         void startIteratePeptides(const char* sequenceProtein,
00105                                   const int sizeProtein,
00106                                   const int pfa);
00107 
00109         bool getNextPeptide();
00110 
00112         int getPepStart() const;
00113 
00115         int getPepEnd() const;
00116 
00118         int getMissed() const;
00119 
00121         void stopIteratePeptides();
00122 
00124         double calcPeptideMZ(const char* proteinStr,
00125                              const int proteinLen,
00126                              const int startPos,
00127                              const int endPos,
00128                              const std::vector< int > numThatMustBeModded, 
00129                              const int charge, 
00130                              const MASS_TYPE massType,
00131                              ms_errs *err) const;
00132 
00134         ms_peptide createPeptide(const char* proteinStr,
00135                                  const int proteinLen,
00136                                  const int startPos,
00137                                  const int endPos,
00138                                  const std::vector< int > varMods, 
00139                                  const std::vector< int > varModsWhichNl,
00140                                  const int charge,
00141                                  const MASS_TYPE massType,
00142                                  ms_errs *err) const;
00143 
00145         ms_peptide createPeptide(const char* proteinStr,
00146                                  const int proteinLen,
00147                                  const int startPos,
00148                                  const int endPos,
00149                                  const std::vector< int > varMods, 
00150                                  const std::vector< int > varModsWhichNl,
00151                                  const std::vector< int > summedMods, 
00152                                  const std::vector< int > summedModsWhichNl,
00153                                  const int charge,
00154                                  const MASS_TYPE massType,
00155                                  ms_errs *err) const;
00156 
00158         std::vector< double > calcFragments(const ms_peptide* peptide, 
00159                                             const int seriesID, 
00160                                             const bool doubleCharged,
00161                                             const double minMass, 
00162                                             const double maxMass,
00163                                             const MASS_TYPE massType,
00164                                             ms_fragmentvector* fragments,
00165                                             ms_errs* err) const;
00166 
00168         bool calcFragmentsEx(const ms_peptide* peptide, 
00169                              const int seriesID, 
00170                              const int fragCharge,
00171                              const double minMass, 
00172                              const double maxMass,
00173                              const MASS_TYPE massType,
00174                              ms_fragmentvector* fragments,
00175                              ms_errs* err) const;
00176 
00177 #ifndef SWIG
00178 
00179         std::vector< double > calcFragments(const ms_peptide* peptide, 
00180                                             const int seriesID, 
00181                                             const bool doubleCharged,
00182                                             const double minMass, 
00183                                             const double maxMass,
00184                                             const MASS_TYPE massType,
00185                                             std::vector< ms_fragment > *fragments,
00186                                             ms_errs* err) const;
00187 
00189         bool calcFragmentsEx(const ms_peptide* peptide, 
00190                              const int seriesID, 
00191                              const int fragCharge,
00192                              const double minMass, 
00193                              const double maxMass,
00194                              const MASS_TYPE massType,
00195                              std::vector< ms_fragment > *fragments,
00196                              ms_errs* err) const;
00197 #endif
00198 
00199                              
00200         std::string convertPrimaryNlVectorToString(const std::vector< int > modded,
00201                                                    const std::vector< int > whichNl, 
00202                                                    const ms_modvector &varMods,
00203                                                    const ms_modvector &varMods_used,
00204                                                    ms_errs* err) const;
00205 
00206         std::vector< int > convertPrimaryNlStringToVector(const std::string varModStr,
00207                                                           const std::string primaryNlStr, 
00208                                                           const ms_modvector &varMods_used,
00209                                                           ms_errs* err) const;
00210 
00211     private:
00212         bool checkVarModConflicts(const ms_modvector *varModVector, ms_modvector &varMods, std::vector<int> &varModsSrc, ms_modvector &varMods_used, ms_errs &err) const;
00213         bool iscleavagepoint(const char left, const char right) const;
00214         bool switchIndependent();
00215         void updatemissed(const int leftPos);
00216         void dropmissed();
00217         void clearMods();
00218         bool cfr(const ms_peptide* peptide, 
00219                 const int seriesID, 
00220                 const int fragCharge,
00221                 const double minMass, 
00222                 const double maxMass,
00223                 const MASS_TYPE massType,
00224                 std::vector< ms_fragment > *fragments,
00225                 ms_errs* err,
00226                 std::vector< double > *vi) const;
00227 
00228         void getSeriesParams(const char* pepStr,
00229                              const int seriesID,
00230                              const ms_masses & masses,
00231                              const MASS_TYPE massType,
00232                              double& delta,
00233                              int& start,
00234                              int& end,
00235                              bool& forward) const;
00236         void setupFromPre2_2ResultsFile(const std::string & peptide, const std::string & varMods);
00237 
00238         bool lookupLocalModVectors(int q, const ms_modvector* &local_mods, const std::vector<int>* &local_mods_src, const ms_modvector* &local_mods_used);
00239         void clearLocalModVectors();
00240 
00241         ms_masses   massesUnmod_;
00242         ms_masses   masses_;
00243         ms_umod_configfile umodFile_;
00244         ms_quant_configfile quantFile_;
00245         const ms_mascotresfile * pResfile_;
00246 
00247 
00248         ms_modvector fixedMods_;
00249         ms_modvector varMods_;
00250         std::vector< int > varModsSrc_;
00251         ms_modvector varMods_used_;
00252 
00253         typedef std::map<int, ms_modvector > queryParsedLocalMods_t;
00254         typedef std::map<int, std::vector<int> > queryParsedLocalModsSrc_t;
00255         queryParsedLocalMods_t queryParsedLocalMods_;
00256         queryParsedLocalModsSrc_t queryParsedLocalModsSrc_;
00257         queryParsedLocalMods_t queryParsedLocalModsUsed_;
00258 
00259         ms_enzyme   enzyme_;
00260         bool        bEnzymeSet_;
00261         std::string protStr_;
00262         int         protLen_;
00263         int         pfa_; // missed cleavages limit
00264 
00265         // internal iteration parameters
00266         int         numInd_; // current independent enzyme ID
00267         int         l_, r_; // the last peptide ends
00268         int         missed_; // number of missed cleavages in the current peptide
00269         int         enzymesPassed_;
00270 
00271         // for the sake of semi-specific enzymes
00272         bool        forward_;
00273 
00274         // For a pre 2.2 results file, need to keep track of what we know
00275         enum DERIVED_MOD_SPECIFICITY_STATUS
00276         {
00277             DMSS_NOT_INITIALISED,
00278             DMSS_WORKING,
00279             DMSS_COMPLETED,
00280             DMSS_FROM_V2_2_OR_LATER_RESFILE,
00281             DMSS_NOT_FROM_RESFILE
00282         };
00283         DERIVED_MOD_SPECIFICITY_STATUS derivedModSpecificityStatus_;
00284         std::vector<MOD_TYPES> derivedModSpecificities_;
00285         typedef std::vector< std::vector<bool> > modifiedResidues_t;
00286         modifiedResidues_t derivedModifiedResidues_;
00287 
00288     }; // ms_aahelper // end of mass_calculation_group
00290 } // matrix_science
00291 
00292 #endif // MS_AAHELPER_HPP
00293 
00294 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:50