Matrix Science header

ms_modfile.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_modfile.hpp                                                       #
00004 # 'msparser' toolkit                                                         #
00005 # Encapsulates "mod_file"-file that defines amino acid modifications         #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2003 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 #    $Archive:: /Mowse/ms_mascotresfile/include/ms_modfile.hpp             $ #
00012 #     $Author: francoisr $ #
00013 #       $Date: 2016/05/17 12:49:19 $ #
00014 #   $Revision: 1.44 $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 #ifndef MS_MODFILE_HPP
00020 #define MS_MODFILE_HPP
00021 
00022 #ifdef _WIN32
00023 #pragma warning(disable:4251)   // Don't want all classes to be exported
00024 #pragma warning(disable:4786)   // Debug symbols too long
00025 #   ifndef _MATRIX_USE_STATIC_LIB
00026 #       ifdef MS_MASCOTRESFILE_EXPORTS
00027 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00028 #       else
00029 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00030 #       endif
00031 #   else
00032 #       define MS_MASCOTRESFILE_API
00033 #   endif
00034 #else
00035 #   define MS_MASCOTRESFILE_API
00036 #endif
00037 
00038 // for the sake of #include <string>
00039 #ifdef __ALPHA_UNIX__
00040 #include <ctype.h>
00041 #endif
00042 
00043 #include <string>
00044 #include <vector>
00045 #include <memory>
00046 
00047 namespace msparser_internal {
00048     class ms_modification_impl;
00049 }
00050 
00051 namespace matrix_science {
00052 
00053     class ms_masses;
00054     class ms_umod_modification;
00055 
00066     enum MOD_TYPES
00067     {
00068         MOD_TYPE_RESIDUE        = 0, 
00069         MOD_TYPE_N_TERM         = 1, 
00070         MOD_TYPE_C_TERM         = 2, 
00071         MOD_TYPE_N_PROTEIN      = 3, 
00072         MOD_TYPE_C_PROTEIN      = 4, 
00073         MOD_TYPE_N_TERM_RESIDUE = 5, 
00074         MOD_TYPE_C_TERM_RESIDUE = 6, 
00075         MOD_TYPE_N_PROTEIN_RESIDUE= 7, 
00076         MOD_TYPE_C_PROTEIN_RESIDUE= 8, 
00077         MOD_TYPE_______LAST     = 9     // This must always be last....
00078     };
00079 
00081 
00084     enum MASS_TYPE
00085     {
00086         MASS_TYPE_MONO = 0x0000,  
00087         MASS_TYPE_AVE  = 0x0001   
00088     };
00089 
00091 
00094     enum 
00095     { 
00096         MAX_VAR_MODS = 'W' -'A' + 10  
00097     };
00098 
00099     typedef std::vector<double> ms_vectorDouble;
00100     typedef std::vector< bool > ms_vectorBool;
00101 
00103 
00153     class MS_MASCOTRESFILE_API ms_modification: public ms_customproperty
00154     {
00155         friend class ms_modfile;
00156         friend class ms_modvector;
00157     public:
00158 
00160         ms_modification(const ms_masses* massFile = NULL);
00161 
00163         ms_modification(const ms_modification& src);
00164 
00166         ~ms_modification();
00167 
00169         void defaultValues();
00170 
00172         void copyFrom(const ms_modification* src);
00173 
00174 #ifndef SWIG
00175 
00176         ms_modification& operator=(const ms_modification& right);
00177 #endif
00178 
00179         bool getFromUnimod(const char* modName, const ms_umod_configfile *umod_file);
00180 
00182         void setMassFile(const ms_masses* massFile);
00183 
00185         const ms_masses* getMassFile() const;
00186 
00188         void copyMassFile(const ms_masses* massFile);
00189 
00191         std::string getTitle() const;
00192 
00194         void setTitle(const char* value);
00195 
00197         int getModificationType() const;
00198 
00200         void setModificationType(const int type);
00201 
00203         bool isHidden() const;
00204 
00206         void setHidden(const bool value);
00207 
00209         bool inShortList() const;
00210 
00212         void setInShortList(const bool value);
00213 
00215         bool inLongList() const;
00216 
00218         void setInLongList(const bool value);
00219 
00221         bool inErrorTolerant() const;
00222 
00224         void setInErrorTolerant(const bool value);
00225 
00227         bool isSubstitution() const;
00228 
00230         double getDelta(const MASS_TYPE massType) const;
00231 
00233         void setDelta(const double massMono, const double massAve);
00234 
00236         ms_vectorDouble getNeutralLoss(const MASS_TYPE massType) const;
00237 
00239         ms_vectorBool getNeutralLossRequired() const;
00240 
00242         //std::vector< double > getNeutralLossFrequencies() const;
00243 
00245         void setNeutralLoss(const ms_vectorDouble massMono, const ms_vectorDouble massAve, const ms_vectorBool required);
00246 
00248         int getNumberOfModifiedResidues() const;
00249 
00251         char getModifiedResidue(const int n) const;
00252 
00254         bool isResidueModified(const char residue) const;
00255 
00257         double getResidueMass(const MASS_TYPE massType, const char residue) const;
00258 
00260         void clearModifiedResidues();
00261 
00263         void appendModifiedResidue(const char residue, const double massMono, const double massAve);
00264 
00266         double getNTerminusMass(const MASS_TYPE massType) const;
00267 
00269         void setNTerminusMass(const double massMono, const double massAve);
00270 
00272         double getCTerminusMass(const MASS_TYPE massType) const;
00273 
00275         void setCTerminusMass(const double massMono, const double massAve);
00276 
00278         int getNumberOfIgnoreMasses() const;
00279 
00281         double getIgnoreMass(const MASS_TYPE massType, const int idx) const;
00282 
00284         void clearIgnoreMasses();
00285 
00287         void appendIgnoreMass(const double massMono, const double massAve);
00288 
00290         ms_vectorDouble getReqPepNeutralLoss(const MASS_TYPE massType) const;
00291 
00293         void setReqPepNeutralLoss(const ms_vectorDouble valuesMono, const ms_vectorDouble valuesAve);
00294 
00296         ms_vectorDouble getPepNeutralLoss(const MASS_TYPE massType) const;
00297 
00299         void setPepNeutralLoss(const ms_vectorDouble valuesMono, const ms_vectorDouble valuesAve);
00300 
00301 #ifdef SUPPRESS_MS_CUSTOMPROPERTY_INHERITANCE
00302 #include "suppress_ms_customproperty.hpp"
00303 #endif
00304 
00305     private:
00306         void setCustomProperty();
00307 
00308         msparser_internal::ms_modification_impl * m_pImpl;
00309     }; // ms_modification
00310 
00312     class MS_MASCOTRESFILE_API ms_modvector
00313     {
00314         friend class ms_modfile;
00315     public:
00317         ms_modvector();
00318 
00320         ms_modvector(const ms_modvector& src);
00321 
00323         ms_modvector(const ms_umod_modification &src, const ms_umod_configfile &umod_file);
00324 
00326         ~ms_modvector();
00327 
00329         void copyFrom(const ms_modvector* right);
00330 
00332         void copyFrom(const ms_umod_modification* right, const ms_umod_configfile *umod_file);
00333 
00334 #ifndef SWIG
00335 
00336         ms_modvector& operator=(const ms_modvector& right);
00337 #endif
00338 
00340         int getNumberOfModifications() const;
00341 
00343         void clearModifications();
00344 
00346         void appendModification(const ms_modification* item);
00347 
00349         void appendModifications(ms_modvector &right);
00350 
00352         const ms_modification * getModificationByNumber(const int numMod) const;
00353 
00355         const ms_modification * getModificationByName(const std::string &name) const;
00356 
00357     private:
00358         typedef std::vector<ms_modification* > mod_vector;
00359 
00360         mod_vector  entries_;
00361     }; // class ms_modvector
00362 
00364 
00380     class MS_MASCOTRESFILE_API ms_modfile: public ms_errors
00381     {
00382     public:
00384         ms_modfile();
00385 
00387         ms_modfile(const ms_modfile& src);
00388 
00389 
00391         ms_modfile(const ms_umod_configfile& src,
00392             const unsigned int flags = ms_umod_configfile::MODFILE_FLAGS_ALL);
00393 
00395         ms_modfile(const char* filename, 
00396                    const ms_masses* massFile, 
00397                    const bool fromSubstitutions = false,
00398                    const ms_connection_settings * cs = 0);
00399 
00401         ~ms_modfile();
00402 
00404         void defaultValues();
00405 
00407         void copyFrom(const ms_modfile* right);
00408 
00410         void copyFrom(const ms_umod_configfile* right,
00411                       const unsigned int flags = ms_umod_configfile::MODFILE_FLAGS_ALL);
00412 
00413 #ifndef SWIG
00414 
00415         ms_modfile& operator=(const ms_modfile& right);
00416 #endif
00417 
00418         void setFileName(const char* name);
00419 
00421         std::string getFileName() const;
00422 
00424         void setConnectionSettings(const ms_connection_settings & cs);
00425 
00427         ms_connection_settings getConnectionSettings() const;
00428 
00430         void setMassFile(const ms_masses* massFile);
00431 
00433         const ms_masses* getMassFile() const;
00434 
00436         bool isFromSubstitutions() const;
00437 
00439         void setFromSubstitutions(const bool value);
00440 
00442         void read_file();
00443 
00445         void save_file();
00446 
00448         void saveToString(std::string & modfileAsStr);
00449 
00451         void sortModifications();
00452 
00454         int getNumberOfModifications() const;
00455 
00457         void clearModifications();
00458 
00460         void appendModification(const ms_modification* item);
00461 
00463         const ms_modification * getModificationByNumber(const int numMod) const;
00464 
00466         const ms_modification * getModificationByName(const char* nameMod) const;
00467 
00469         bool updateModificationByNumber(const int num, const ms_modification mod);
00470 
00472         bool updateModificationByName(const char* name, const ms_modification mod);
00473 
00475         bool deleteModificationByNumber(const int num);
00476 
00478         bool deleteModificationByName(const char* name);
00479 
00480     private:
00481         void read_text();
00482         void save_text();
00483         void applyVisibility(const ms_session *session);
00484 
00485         typedef std::vector<ms_modification* > entries_vector;
00486         entries_vector  entries;
00487 
00488         std::string     filename_;
00489         std::auto_ptr<ms_masses> m_massFile;
00490         std::vector< std::string > comments_;
00491         bool            bFromSubstitutions_;
00492         ms_connection_settings cs_;
00493 
00494     }; // ms_modfile // end of config_group
00496 } // namespace matrix_science
00497 
00498 #endif // MS_MODFILE_HPP
00499 
00500 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51