Matrix Science header

ms_masses.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_masses.hpp                                                        #
00004 # 'msparser' toolkit                                                         #
00005 # Encapsulates "masses"-file that defines atom and residue masses            #
00006 # about several consecutive erros                                            #
00007 ##############################################################################
00008 # COPYRIGHT NOTICE                                                           #
00009 # Copyright 1998-2003 Matrix Science Limited  All Rights Reserved.           #
00010 #                                                                            #
00011 ##############################################################################
00012 #    $Archive:: /Mowse/ms_mascotresfile/include/ms_masses.hpp              $ #
00013 #     $Author: davidc $ #
00014 #       $Date: 2016/05/04 20:35:57 $ #
00015 #   $Revision: 1.22 $ #
00016 # $NoKeywords::                                                            $ #
00017 ##############################################################################
00018 */
00019 
00020 #ifndef MS_MASSES_HPP
00021 #define MS_MASSES_HPP
00022 
00023 #ifdef _WIN32
00024 #pragma warning(disable:4251)   // Don't want all classes to be exported
00025 #pragma warning(disable:4786)   // Debug symbols too long
00026 #   ifndef _MATRIX_USE_STATIC_LIB
00027 #       ifdef MS_MASCOTRESFILE_EXPORTS
00028 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00029 #       else
00030 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00031 #       endif
00032 #   else
00033 #       define MS_MASCOTRESFILE_API
00034 #   endif
00035 #else
00036 #   define MS_MASCOTRESFILE_API
00037 #endif
00038 
00039 // for the sake of #include <string>
00040 #ifdef __ALPHA_UNIX__
00041 #include <ctype.h>
00042 #endif
00043 #include <string>
00044 
00045 
00046 namespace matrix_science {
00047 
00048     class ms_umod_configfile; // forward declaration
00049     class ms_quant_component; // forward declaration
00050 
00056 
00057 
00066     class MS_MASCOTRESFILE_API ms_masses: public ms_errors
00067     {
00068     public:
00070         ms_masses();
00071 
00073         ms_masses(const ms_masses& src);
00074 
00076         ms_masses(const ms_umod_configfile& src, bool addMissingResidueMasses=true);
00077 
00079         ms_masses(const ms_umod_configfile& src, const ms_quant_component& quantComp);
00080 
00082         ms_masses(const char* filename, const matrix_science::ms_connection_settings * cs = 0);
00083 
00085         ~ms_masses();
00086 
00088         void defaultValues(bool useDefaultResidueMasses=true);
00089 
00091         void copyFrom(const ms_masses* right);
00092 
00094         void copyFrom(const ms_umod_configfile *right, bool addMissingResidueMasses=true);
00095 
00097         ms_modvector applyFixedMods(const ms_modvector *mods, ms_errs *err);
00098 
00100         void applyIsotopes(const ms_umod_configfile *umodFile, const ms_quant_component *quantComp);
00101 
00103         bool isSame(const ms_masses& other, const MASS_TYPE massType) const;
00104 
00105 #ifndef SWIG
00106 
00107         ms_masses& operator=(const ms_masses& right);
00108 #endif
00109 
00110         std::string getFileName() const;
00111 
00113         void setFileName(const char* name);
00114 
00116         void setConnectionSettings(const matrix_science::ms_connection_settings & cs);
00117 
00119         matrix_science::ms_connection_settings getConnectionSettings() const;
00120 
00122         void read_file();
00123 
00125         void save_file();
00126 
00128         double getResidueMass(const matrix_science::MASS_TYPE massType, const char residue) const;
00129 
00131         void setResidueMasses(const char residue, const double massMono, const double massAve);
00132 
00134         double getNtermDelta(const matrix_science::MASS_TYPE massType) const;
00135 
00137         double getNterminalMass(const matrix_science::MASS_TYPE massType) const;
00138 
00140         double getNtermNeutralLoss(const matrix_science::MASS_TYPE massType) const;
00141 
00143         void setNtermModification(const double monoDelta, 
00144                                   const double aveDelta, 
00145                                   const double monoNeutralLoss = 0.0,
00146                                   const double aveNeutralLoss = 0.0);
00147 
00149         double getCtermDelta(const matrix_science::MASS_TYPE massType) const;
00150 
00152         double getCterminalMass(const matrix_science::MASS_TYPE massType) const;
00153 
00155         double getCtermNeutralLoss(const matrix_science::MASS_TYPE massType) const;
00156 
00158         void setCtermModification(const double monoDelta, 
00159                                   const double aveDelta, 
00160                                   const double monoNeutralLoss = 0.0,
00161                                   const double aveNeutralLoss = 0.0);
00162 
00164         double getFragResidueMass(const matrix_science::MASS_TYPE massType, const char residue) const;
00165 
00167         bool isResidueModified(const char residue) const;
00168 
00170         void setResidueModification(const double monoDelta, 
00171                                     const double aveDelta, 
00172                                     const double monoNeutralLoss,
00173                                     const double aveNeutralLoss,
00174                                     const char *residues);
00175 
00177         double getHydrogenMass(const matrix_science::MASS_TYPE massType) const;
00178 
00180         void setHydrogenMass(const double massMono, const double massAve);
00181 
00183         double getCarbonMass(const matrix_science::MASS_TYPE massType) const;
00184 
00186         void setCarbonMass(const double massMono, const double massAve);
00187 
00189         double getNitrogenMass(const matrix_science::MASS_TYPE  massType) const;
00190 
00192         void setNitrogenMass(const double massMono, const double massAve);
00193 
00195         double getOxygenMass(const matrix_science::MASS_TYPE  massType) const;
00196 
00198         void setOxygenMass(const double massMono, const double massAve);
00199 
00201         double getElectronMass() const;
00202 
00204         void setElectronMass(const double mass);
00205 
00207         void setStorage(double* res_mono, 
00208                         double* res_ave, 
00209                         double* hydrogen, 
00210                         double* carbon, 
00211                         double* nitrogen, 
00212                         double* oxygen, 
00213                         double* electron);
00214 
00216         void defaultMasses(double* res_mono, 
00217                            double* res_ave, 
00218                            double* hydrogen, 
00219                            double* carbon, 
00220                            double* nitrogen, 
00221                            double* oxygen, 
00222                            double* electron,
00223                            bool useDefaultResidueMasses = true);
00224 
00225     private:
00226 
00227         bool getTwoMasses(char * line, 
00228                           char *lineForError, 
00229                           double *pMono, 
00230                           double *pAve, 
00231                           const double dMin, 
00232                           const double dMax);
00233 
00234         void setCustomProperty();
00235 
00236     private:
00237         // final destinations - they are assigned either 
00238         // 1) supplied array pointers 
00239         // 2) the internal storages
00240         double* res_mono;
00241         double* res_ave;
00242 
00243         // mass combined with neutral loss for residue-specific mods
00244         bool res_mod[26];
00245         double* frag_res_mono;
00246         double* frag_res_ave;
00247 
00248         // masses of terminal groups for terminus mods
00249         double ntermDelta[2];
00250         double ctermDelta[2];
00251 
00252         // neutral losses on terminal groups for terminus mods
00253         double neutralLossNterm[2];
00254         double neutralLossCterm[2];
00255 
00256         double* hydrogen;
00257         double* carbon;
00258         double* nitrogen;
00259         double* oxygen;
00260 
00261         double* electron;
00262 
00263         // internal storages in case they are not supplied with a proper constructor
00264         double _res_mono[26];
00265         double _res_ave[26];
00266         double _frag_res_mono[26];
00267         double _frag_res_ave[26];
00268 
00269         double _hydrogen[2];
00270         double _carbon[2];
00271         double _nitrogen[2];
00272         double _oxygen[2];
00273 
00274         double _electron;
00275 
00276         std::string _fn;
00277         ms_customproperty _custprop;
00278         ms_connection_settings cs_;
00279     }; // class ms_masses // end of config_group
00281 }
00282 
00283 #endif // MS_MASSES_HPP
00284 
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51