Matrix Science header

ms_enzyme.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_enzyme.hpp                                                        #
00004 # 'msparser' toolkit                                                         #
00005 # Encapsulates "enzymes"-file that describes available enzymes               #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2005 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 #    $Archive:: /Mowse/ms_mascotresfile/include/ms_enzyme.hpp              $ #
00012 #     $Author: villek@matrixscience.com $ #
00013 #       $Date: 2018-07-30 16:23:53 +0100 $ #
00014 #   $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 #ifndef MS_ENZYME_HPP
00020 #define MS_ENZYME_HPP
00021 
00022 
00023 #include <string>
00024 #include <vector>
00025 
00026 
00027 namespace matrix_science {
00033 
00034 
00066     class MS_MASCOTRESFILE_API ms_enzyme : public ms_customproperty
00067     {
00068         friend class ms_enzymefile;
00069 
00070     public:
00072 
00075         enum cuttertype
00076         {
00077             UNDEFINED_CUTTER = 0x0000, 
00078             NTERM_CUTTER     = 0x0001, 
00079             CTERM_CUTTER     = 0x0002  
00080         };
00081 
00083         ms_enzyme();
00084 
00086         ms_enzyme(const ms_enzyme& src);
00087 
00089         ~ms_enzyme();
00090 
00092         void defaultValues();
00093 
00095         void copyFrom(const ms_enzyme* right);
00096 
00097 #ifndef SWIG
00098 
00099         ms_enzyme& operator=(const ms_enzyme& right);
00100 #endif
00101 
00102         bool isValid() const;
00103 
00105         bool verifyEnzyme(ms_errs* errObj) const;
00106 
00108         std::string getTitle() const;
00109 
00111         void setTitle(const char* str);
00112 
00114         bool isSemiSpecific() const;
00115 
00117         void setSemiSpecific(const bool value);
00118 
00120         bool isIndependent() const;
00121 
00123         void setIndependent(const bool bit);
00124 
00126         int getNumberOfCutters() const;
00127 
00129         void clearAllCutters();
00130 
00132         void addCutter(const cuttertype type, const char* cleaveAtStr, const char* restrictStr);
00133         
00135         ms_enzyme::cuttertype getCutterType(const int cutterNum) const;
00136 
00138         std::string getCleave(const int cutterNum) const;
00139 
00141         std::string getRestrict(const int cutterNum) const;
00142 
00144         bool canCleave(const int  cutterNum, 
00145                        const char leftResidue, 
00146                        const char rightResidue) const;
00147 
00148 #ifdef SUPPRESS_MS_CUSTOMPROPERTY_INHERITANCE
00149 #include "suppress_ms_customproperty.hpp"
00150 #endif
00151 
00152     private:
00153         void setNTerm(std::string& cleaveStr, std::string& restrictStr);
00154         void setCTerm(std::string& cleaveStr, std::string& restrictStr);
00155         std::string::size_type prepareNextNTerm();
00156         std::string::size_type prepareNextCTerm();
00157         void setIndependentInternal(const bool bit);
00158         void setSemiSpecificInternal(const bool bit);
00159         void makeCustomPropIndexed();
00160 
00161     private:
00162         std::string     title_;
00163         bool            semiSpecific_;
00164 
00165         bool            independent_;
00166         
00167         typedef std::vector< bool* > residue_flags_vector;
00168 
00169         residue_flags_vector cleavageNTerm;
00170         residue_flags_vector cleavageCTerm;
00171         residue_flags_vector restrictNTerm;
00172         residue_flags_vector restrictCTerm;
00173     };// class ms_enzyme
00174 
00175     class ms_filesource;
00176 
00178 
00193     class MS_MASCOTRESFILE_API ms_enzymefile : public ms_errors
00194     {
00195     public:
00197         ms_enzymefile();
00198 
00200         ms_enzymefile(const ms_enzymefile& src);
00201 
00203         ms_enzymefile(const char* filename, const matrix_science::ms_connection_settings * cs = 0);
00204 
00206         ~ms_enzymefile();
00207 
00209         void defaultValues();
00210 
00212         void copyFrom(const ms_enzymefile* right);
00213 
00214 #ifndef SWIG
00215 
00216         ms_enzymefile& operator=(const ms_enzymefile& right);
00217 #endif
00218 
00219         void setFileName(const char* filename);
00220 
00222         std::string getFileName() const;
00223 
00225         void setConnectionSettings(const matrix_science::ms_connection_settings & cs);
00226 
00228         matrix_science::ms_connection_settings getConnectionSettings() const;
00229 
00231         void read_file();
00232 
00234         void read_buffer(const char* buffer);
00235 
00237         void save_file();
00238 
00240         int getNumberOfEnzymes() const;
00241 
00243         void clearEnzymes();
00244 
00246         void appendEnzyme(const ms_enzyme* item);
00247 
00249         const ms_enzyme* getEnzymeByNumber(const int num) const;
00250 
00252         const ms_enzyme* getEnzymeByName(const char* name) const;
00253 
00255         bool isNoneFound() const;
00256 
00258         bool updateEnzymeByNumber(const int num, const ms_enzyme enzyme);
00259 
00261         bool updateEnzymeByName(const char* name, const ms_enzyme enzyme);
00262 
00264         bool deleteEnzymeByNumber(const int num);
00265 
00267         bool deleteEnzymeByName(const char* name);
00268 
00269 
00270     private:
00271 
00272         void read_internal(ms_filesource *pFSource);
00273 
00274         std::string filename_;
00275         std::vector<ms_enzyme*> entries_;
00276         std::vector< std::string > comments_;
00277         bool noneFound_;
00278         ms_connection_settings cs_;
00279 
00280     }; // class ms_enzymefile // end of config_group
00282 } // matrix_science
00283 
00284 #endif // MS_ENZYME_HPP
00285 
00286 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29