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 $ #
00013 #       $Date: 2010/09/06 16:18:57 $ #
00014 #   $Revision: 1.18 $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 #ifndef MS_ENZYME_HPP
00020 #define MS_ENZYME_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 #include <string>
00043 #include <vector>
00044 
00045 
00046 namespace matrix_science {
00052 
00053 
00085     class MS_MASCOTRESFILE_API ms_enzyme : public ms_customproperty
00086     {
00087         friend class ms_enzymefile;
00088 
00089     public:
00091 
00094         enum cuttertype
00095         {
00096             UNDEFINED_CUTTER = 0x0000, 
00097             NTERM_CUTTER     = 0x0001, 
00098             CTERM_CUTTER     = 0x0002  
00099         };
00100 
00102         ms_enzyme();
00103 
00105         ms_enzyme(const ms_enzyme& src);
00106 
00108         ~ms_enzyme();
00109 
00111         void defaultValues();
00112 
00114         void copyFrom(const ms_enzyme* right);
00115 
00116 #ifndef SWIG
00117 
00118         ms_enzyme& operator=(const ms_enzyme& right);
00119 #endif
00120 
00121         bool isValid() const;
00122 
00124         bool verifyEnzyme(ms_errs* errObj) const;
00125 
00127         std::string getTitle() const;
00128 
00130         void setTitle(const char* str);
00131 
00133         bool isSemiSpecific() const;
00134 
00136         void setSemiSpecific(const bool value);
00137 
00139         bool isIndependent() const;
00140 
00142         void setIndependent(const bool bit);
00143 
00145         int getNumberOfCutters() const;
00146 
00148         void clearAllCutters();
00149 
00151         void addCutter(const cuttertype type, const char* cleaveAtStr, const char* restrictStr);
00152         
00154         ms_enzyme::cuttertype getCutterType(const int cutterNum) const;
00155 
00157         std::string getCleave(const int cutterNum) const;
00158 
00160         std::string getRestrict(const int cutterNum) const;
00161 
00163         bool canCleave(const int  cutterNum, 
00164                        const char leftResidue, 
00165                        const char rightResidue) const;
00166 
00167 #ifdef SUPPRESS_MS_CUSTOMPROPERTY_INHERITANCE
00168 #include "suppress_ms_customproperty.hpp"
00169 #endif
00170 
00171     private:
00172         void setNTerm(std::string& cleaveStr, std::string& restrictStr);
00173         void setCTerm(std::string& cleaveStr, std::string& restrictStr);
00174         std::string::size_type prepareNextNTerm();
00175         std::string::size_type prepareNextCTerm();
00176         void setIndependentInternal(const bool bit);
00177         void setSemiSpecificInternal(const bool bit);
00178         void makeCustomPropIndexed();
00179 
00180     private:
00181         std::string     title_;
00182         bool            semiSpecific_;
00183 
00184         bool            independent_;
00185         
00186         typedef std::vector< bool* > residue_flags_vector;
00187 
00188         residue_flags_vector cleavageNTerm;
00189         residue_flags_vector cleavageCTerm;
00190         residue_flags_vector restrictNTerm;
00191         residue_flags_vector restrictCTerm;
00192     };// class ms_enzyme
00193 
00194     class ms_filesource;
00195 
00197 
00212     class MS_MASCOTRESFILE_API ms_enzymefile : public ms_errors
00213     {
00214     public:
00216         ms_enzymefile();
00217 
00219         ms_enzymefile(const ms_enzymefile& src);
00220 
00222         ms_enzymefile(const char* filename, const matrix_science::ms_connection_settings * cs = 0);
00223 
00225         ~ms_enzymefile();
00226 
00228         void defaultValues();
00229 
00231         void copyFrom(const ms_enzymefile* right);
00232 
00233 #ifndef SWIG
00234 
00235         ms_enzymefile& operator=(const ms_enzymefile& right);
00236 #endif
00237 
00238         void setFileName(const char* filename);
00239 
00241         std::string getFileName() const;
00242 
00244         void setConnectionSettings(const matrix_science::ms_connection_settings & cs);
00245 
00247         matrix_science::ms_connection_settings getConnectionSettings() const;
00248 
00250         void read_file();
00251 
00253         void read_buffer(const char* buffer);
00254 
00256         void save_file();
00257 
00259         int getNumberOfEnzymes() const;
00260 
00262         void clearEnzymes();
00263 
00265         void appendEnzyme(const ms_enzyme* item);
00266 
00268         const ms_enzyme* getEnzymeByNumber(const int num) const;
00269 
00271         const ms_enzyme* getEnzymeByName(const char* name) const;
00272 
00274         bool isNoneFound() const;
00275 
00277         bool updateEnzymeByNumber(const int num, const ms_enzyme enzyme);
00278 
00280         bool updateEnzymeByName(const char* name, const ms_enzyme enzyme);
00281 
00283         bool deleteEnzymeByNumber(const int num);
00284 
00286         bool deleteEnzymeByName(const char* name);
00287 
00288 
00289     private:
00290 
00291         void read_internal(ms_filesource *pFSource);
00292 
00293         std::string filename_;
00294         std::vector<ms_enzyme*> entries_;
00295         std::vector< std::string > comments_;
00296         bool noneFound_;
00297         ms_connection_settings cs_;
00298 
00299     }; // class ms_enzymefile // end of config_group
00301 } // matrix_science
00302 
00303 #endif // MS_ENZYME_HPP
00304 
00305 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:50