Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_enzyme.hpp
1/*
2##############################################################################
3# file: ms_enzyme.hpp #
4# 'msparser' toolkit #
5# Encapsulates "enzymes"-file that describes available enzymes #
6##############################################################################
7# COPYRIGHT NOTICE #
8# Copyright 1998-2005 Matrix Science Limited All Rights Reserved. #
9# #
10##############################################################################
11# $Archive:: /Mowse/ms_mascotresfile/include/ms_enzyme.hpp $ #
12# $Author: villek@matrixscience.com $ #
13# $Date: 2018-07-30 16:23:53 +0100 $ #
14# $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
15# $NoKeywords:: $ #
16##############################################################################
17*/
18
19#ifndef MS_ENZYME_HPP
20#define MS_ENZYME_HPP
21
22
23#include <string>
24#include <vector>
25
26
27namespace matrix_science {
34
66 class MS_MASCOTRESFILE_API ms_enzyme : public ms_customproperty
67 {
68 friend class ms_enzymefile;
69
70 public:
72
76 {
77 UNDEFINED_CUTTER = 0x0000,
78 NTERM_CUTTER = 0x0001,
79 CTERM_CUTTER = 0x0002
80 };
81
83 ms_enzyme();
84
86 ms_enzyme(const ms_enzyme& src);
87
89 ~ms_enzyme();
90
92 void defaultValues();
93
95 void copyFrom(const ms_enzyme* right);
96
97#ifndef SWIG
99 ms_enzyme& operator=(const ms_enzyme& right);
100#endif
102 bool isValid() const;
103
105 bool verifyEnzyme(ms_errs* errObj) const;
106
108 std::string getTitle() const;
109
111 void setTitle(const char* str);
112
114 bool isSemiSpecific() const;
115
117 void setSemiSpecific(const bool value);
118
120 bool isIndependent() const;
121
123 void setIndependent(const bool bit);
124
126 int getNumberOfCutters() const;
127
129 void clearAllCutters();
130
132 void addCutter(const cuttertype type, const char* cleaveAtStr, const char* restrictStr);
133
135 ms_enzyme::cuttertype getCutterType(const int cutterNum) const;
136
138 std::string getCleave(const int cutterNum) const;
139
141 std::string getRestrict(const int cutterNum) const;
142
144 bool canCleave(const int cutterNum,
145 const char leftResidue,
146 const char rightResidue) const;
147
148#ifdef SUPPRESS_MS_CUSTOMPROPERTY_INHERITANCE
149#include "suppress_ms_customproperty.hpp"
150#endif
151
152 private:
153 void setNTerm(std::string& cleaveStr, std::string& restrictStr);
154 void setCTerm(std::string& cleaveStr, std::string& restrictStr);
155 std::string::size_type prepareNextNTerm();
156 std::string::size_type prepareNextCTerm();
157 void setIndependentInternal(const bool bit);
158 void setSemiSpecificInternal(const bool bit);
159 void makeCustomPropIndexed();
160
161 private:
162 std::string title_;
163 bool semiSpecific_;
164
165 bool independent_;
166
167 typedef std::vector< bool* > residue_flags_vector;
168
169 residue_flags_vector cleavageNTerm;
170 residue_flags_vector cleavageCTerm;
171 residue_flags_vector restrictNTerm;
172 residue_flags_vector restrictCTerm;
173 };// class ms_enzyme
174
175 class ms_filesource;
176
178
193 class MS_MASCOTRESFILE_API ms_enzymefile : public ms_errors
194 {
195 public:
198
200 ms_enzymefile(const ms_enzymefile& src);
201
203 ms_enzymefile(const char* filename, const matrix_science::ms_connection_settings * cs = 0);
204
207
209 void defaultValues();
210
212 void copyFrom(const ms_enzymefile* right);
213
214#ifndef SWIG
216 ms_enzymefile& operator=(const ms_enzymefile& right);
217#endif
219 void setFileName(const char* filename);
220
222 std::string getFileName() const;
223
225 void setConnectionSettings(const matrix_science::ms_connection_settings & cs);
226
228 matrix_science::ms_connection_settings getConnectionSettings() const;
229
231 void read_file();
232
234 void read_buffer(const char* buffer);
235
237 void save_file();
238
240 int getNumberOfEnzymes() const;
241
243 void clearEnzymes();
244
246 void appendEnzyme(const ms_enzyme* item);
247
249 const ms_enzyme* getEnzymeByNumber(const int num) const;
250
252 const ms_enzyme* getEnzymeByName(const char* name) const;
253
255 bool isNoneFound() const;
256
258 bool updateEnzymeByNumber(const int num, const ms_enzyme enzyme);
259
261 bool updateEnzymeByName(const char* name, const ms_enzyme enzyme);
262
264 bool deleteEnzymeByNumber(const int num);
265
267 bool deleteEnzymeByName(const char* name);
268
269
270 private:
271
272 void read_internal(ms_filesource *pFSource);
273
274 std::string filename_;
275 std::vector<ms_enzyme*> entries_;
276 std::vector< std::string > comments_;
277 bool noneFound_;
279
280 }; // class ms_enzymefile // end of config_group
282} // matrix_science
283
284#endif // MS_ENZYME_HPP
285
286/*------------------------------- End of File -------------------------------*/
Settings required to make an HTTP connection to a Mascot server.
Definition: ms_connection_settings.hpp:54
The class is used as a base for property-containing classes, such as ms_mascotoptions.
Definition: ms_customproperty.hpp:91
Represent a single entry in the enzymes file.
Definition: ms_enzyme.hpp:67
cuttertype
Definitions for types of cutter.
Definition: ms_enzyme.hpp:76
Reads and parses the enzymes file that contains multiple enzyme definitions.
Definition: ms_enzyme.hpp:194
This class is used as a base class for several Mascot Parser classes.
Definition: ms_errors.hpp:696
All errors are collected in an instance of this class.
Definition: ms_errors.hpp:37