Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_umod_configfile.hpp
1/*
2##############################################################################
3# file: ms_umod_configfile.hpp #
4# 'msparser' toolkit #
5# Represents unimod.xml file #
6##############################################################################
7# COPYRIGHT NOTICE #
8# Copyright 1998-2003 Matrix Science Limited All Rights Reserved. #
9# #
10##############################################################################
11# $Archive:: /Mowse/ms_mascotresfile/include/ms_umod_configfile.hpp $ #
12# $Author: francoisr@matrixscience.com $ #
13# $Date: 2019-03-08 13:54:54 +0000 $ #
14# $Revision: 7979cc541377e595bc9460c7439a78c7ed72e3d9 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
15# $NoKeywords:: $ #
16##############################################################################
17*/
18
19#ifndef MS_UMOD_CONFIGFILE_HPP
20#define MS_UMOD_CONFIGFILE_HPP
21
22
23#include <string>
24#include <vector>
25
26
27namespace matrix_science {
28
29 class ms_umod_element; // forward declaration
30 class ms_umod_modification; // forward declaration
31 class ms_umod_aminoacid; // forward declaration
32 class ms_umod_modbrick; // forward declaration
33 class ms_session;
34
41
53 class MS_MASCOTRESFILE_API ms_umod_configfile: public ms_errors
54 {
55 public:
57
65 {
66 MODFILE_FLAGS_EMPTY = 0x00000000,
67 MODFILE_FLAGS_REGULAR = 0x00000001,
68 MODFILE_FLAGS_HIDDEN = 0x00000002,
69 MODFILE_FLAGS_AASUBST = 0x00000004,
70 MODFILE_FLAGS_ALL = 0x7FFFFFFF
71 };
72
75
77 ms_umod_configfile(const char* fileName, const char* schemaFileName,
78 const ms_connection_settings * cs = 0, bool useSchema = true);
79
82
84 virtual ~ms_umod_configfile();
85
86#ifndef SWIG
88 ms_umod_configfile& operator=(const ms_umod_configfile& right);
89#endif
91 void copyFrom(const ms_umod_configfile* right);
92
94 virtual void defaultValues();
95
97 void updateMasses();
98
99
101 std::string getFileName() const;
102
104 void setFileName(const char* filename);
105
106
108 void setSchemaFileName(const char* name);
109
111 std::string getSchemaFileName() const;
112
114 static std::string getDefaultSchemaFileName();
115
117 void setConnectionSettings(const ms_connection_settings & cs);
118
120 ms_connection_settings getConnectionSettings() const;
121
122
124 void read_file();
125
127 void save_file();
128
130 void applyVisibility( const ms_session *session);
131
133 void applyVisibility(const std::vector<int> & groupIds);
134
136 void read_buffer(const char* buffer);
137
139 std::string save_buffer(bool validateAgainstSchema = true);
140
141
143 std::string validateDocument() const;
144
145
147 int getNumberOfElements() const;
148
150 void clearElements();
151
153 void appendElement(const ms_umod_element *elem);
154
156 const ms_umod_element * getElementByNumber(const int idx) const;
157
159 const ms_umod_element * getElementByName(const char *name) const;
160
162 bool updateElementByNumber(const int idx, const ms_umod_element* element);
163
165 bool updateElementByName(const char *name, const ms_umod_element* element);
166
168 bool deleteElementByNumber(const int idx);
169
171 bool deleteElementByName(const char *name);
172
173
175 std::vector< std::string > getModFileList(const unsigned int flags = MODFILE_FLAGS_ALL) const;
176
178 int findModFileName(const char * modFileName) const;
179
181 int findModification(const char* modName) const;
182
183
185 int getNumberOfModifications() const;
186
188 void clearModifications();
189
191 void appendModification(const ms_umod_modification *mod);
192
194 const ms_umod_modification * getModificationByNumber(const int idx) const;
195
197 const ms_umod_modification * getModificationByName(const char *name) const;
198
200 bool updateModificationByNumber(const int idx, const ms_umod_modification *mod);
201
203 bool updateModificationByName(const char *name, const ms_umod_modification *mod);
204
206 bool deleteModificationByNumber(const int idx);
207
209 bool deleteModificationByName(const char *name);
210
211
213 int getNumberOfAminoAcids() const;
214
216 void clearAminoAcids();
217
219 void appendAminoAcid(const ms_umod_aminoacid *aa);
220
222 const ms_umod_aminoacid * getAminoAcidByNumber(const int idx) const;
223
225 const ms_umod_aminoacid * getAminoAcidByName(const char *name) const;
226
228 bool updateAminoAcidByNumber(const int idx, const ms_umod_aminoacid *aa);
229
231 bool updateAminoAcidByName(const char *name, const ms_umod_aminoacid *aa);
232
234 bool deleteAminoAcidByNumber(const int idx);
235
237 bool deleteAminoAcidByName(const char *name);
238
239
241 int getNumberOfModBricks() const;
242
244 void clearModBricks();
245
247 void appendModBrick(const ms_umod_modbrick *brick);
248
250 const ms_umod_modbrick * getModBrickByNumber(const int idx) const;
251
253 const ms_umod_modbrick * getModBrickByName(const char *name) const;
254
256 bool updateModBrickByNumber(const int idx, const ms_umod_modbrick *brick);
257
259 bool updateModBrickByName(const char *name, const ms_umod_modbrick *brick);
260
262 bool deleteModBrickByNumber(const int idx);
263
265 bool deleteModBrickByName(const char *name);
266
268 std::string getMajorVersion() const;
269
271 std::string getMinorVersion() const;
272
274 void setMajorVersion(const std::string & version);
275
277 void setMinorVersion(const std::string & version);
278 private:
279
280 void applyVisibilityHelper();
281
282 std::string m_fileName;
283 std::string m_schemaFileName;
285
286 typedef std::vector< ms_umod_element* > element_vector;
287 element_vector m_elements;
288
289 typedef std::vector< ms_umod_modification* > modification_vector;
290 modification_vector m_modifications;
291 typedef std::map<std::string, size_t> modification_index_map;
292 modification_index_map m_modifications_nameToIndex;
293
294 typedef std::vector< ms_umod_aminoacid* > aminoacid_vector;
295 aminoacid_vector m_aminoacids;
296
297 typedef std::vector< ms_umod_modbrick* > modbrick_vector;
298 modbrick_vector m_modbricks;
299
300 std::string m_majorVersion;
301 std::string m_minorVersion;
302
303 std::string m_encodingName;
304 bool m_useSchema;
305 }; // class ms_umod_configfile
306 // end of config_group
308
309} // namespace matrix_science
310
311#endif // MS_UMOD_CONFIGFILE_HPP
312/*------------------------------- End of File -------------------------------*/
Settings required to make an HTTP connection to a Mascot server.
Definition: ms_connection_settings.hpp:54
This class is used as a base class for several Mascot Parser classes.
Definition: ms_errors.hpp:696
Use this class to determine if a user is logged in and if they have 'permission' to perform tasks.
Definition: ms_security_session.hpp:123
Represents an "amino acid" object in unimod.xml.
Definition: ms_umod_aminoacid.hpp:41
This class represents the file unimod.xml.
Definition: ms_umod_configfile.hpp:54
MODFILE_FLAGS
Flags for the type of modifications to retrieve.
Definition: ms_umod_configfile.hpp:65
Represents an element object in unimod.xml.
Definition: ms_umod_element.hpp:40
Represents a modification brick object in unimod.xml.
Definition: ms_umod_modbrick.hpp:41
Represents a modif object in unimod.xml.
Definition: ms_umod_modification.hpp:47