Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_datfile.hpp
1/*
2##############################################################################
3# file: ms_datfile.hpp #
4# 'msparser' toolkit #
5# Encapsulates "mascot.dat"-file that describes most important parameters #
6##############################################################################
7# COPYRIGHT NOTICE #
8# Copyright 1998-2003 Matrix Science Limited All Rights Reserved. #
9# #
10##############################################################################
11# $Archive:: /Mowse/ms_mascotresfile/include/ms_datfile.hpp $ #
12# $Author: robertog@matrixscience.com $ #
13# $Date: 2024-08-27 16:16:41 +0100 $ #
14# $Revision: 5566e3f2f102c2aae2dea328044e0e4030755ddd | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
15# $NoKeywords:: $ #
16##############################################################################
17*/
18
19#ifndef MS_DATFILE_HPP
20#define MS_DATFILE_HPP
21
22
23#include <string>
24#include <vector>
25
26
27namespace matrix_science {
28
29 class ms_filesource;
30
37
46 class MS_MASCOTRESFILE_API ms_datfile : public ms_errors
47 {
48 public:
49
51
54 enum WST
55 {
56 WST_APACHE=0,
57 WST_IIS=1
58 };
59
61
67 {
68 // Anything in the lower 16 bits (1..16) should result in asking the user to confirm that they want to update
69 SEQDB_INSTALL_SHOULD_QUERY_USER = 0x0000FFFF,
70 SEQDB_INSTALL_CUSTOMISED = 0x00000001,
71 SEQDB_INSTALL_INACTIVE = 0x00000002,
72 SEQDB_INSTALL_INVALID_CONFIG = 0x00000004,
73 SEQDB_INSTALL_EXISTING_LARGER = 0x00000010,
74
75 // Bit 32 for something really bad.
76 SEQDB_INSTALL_INVALID_DBNAME = 0x00000000,
77
78 // Further information that may be useful in bits 16 to 31
79 SEQDB_INSTALL_MUST_UPDATE_CFG = 0x000F000F,
80 SEQDB_INSTALL_MISSING_CONFIG = 0x00010000,
81 SEQDB_INSTALL_OLD_RULES = 0x00020000,
82 SEQDB_INSTALL_WRONG_WILDCARD = 0x00040000,
83
84 // Additional information, but no need to update
85 SEQDB_INSTALL_CURRENT_RULES = 0x01000000
86 };
87
89
93 {
94 IFLG_UPDATETAXONOMY = 0x00000001,
95 IFLG_UPDATEPARSERULES = 0x00000002,
96 IFLG_UPDATESWISSPROT = 0x00000004,
97 IFLG_UPDATECLUSTER = 0x00000008,
98 IFLG_UPDATEESTTAX = 0x00000010,
99 IFLG_ADDMISSINGOPTIONS = 0x00000020,
100 IFLG_ADDREPORTAUTO = 0x00000040,
101 IFLG_UPDATEAPACHEFORKOPT = 0x00000080,
102 IFLG_ADDPERCOLATOROPT = 0x00000100,
103 IFLG_UPDATENCBIHTTPS = 0x00000200,
104 IFLG_UPDATEPRIDECONTAMINANTS = 0x00000400,
105 IFLG_UPDATEDBMANAGERPERLPATH = 0x00000800,
106 IFLG_UPDATEMSPEPSEARCHOPTS = 0x00001000,
107 IFLG_UPDATEEXECAFTERSEARCH = 0x00002000,
108 IFLG_UPDATEPERCOLATORFEATS = 0x00004000,
109 IFLG_UPDATEPROTFAMILYSWITCH = 0x00008000,
110 IFLG_UPDATEPERCOLATORUSERT = 0x00010000,
111 IFLG_UPDATESPLITNUMOFQUERIES = 0x00020000,
112 IFLG_UPDATESPLITDATAFILESIZE = 0x00040000,
113 IFLG_UPDATERESULTSCACHE = 0x00080000, //<!Update ResultsCache
114
115 IFLG_DEFAULTNEWINSTALL = IFLG_UPDATECLUSTER |
116 IFLG_UPDATEAPACHEFORKOPT,
117 IFLG_DEFAULTUPGRADE = IFLG_UPDATETAXONOMY |
118 IFLG_UPDATEPARSERULES |
119 IFLG_UPDATEESTTAX |
120 IFLG_ADDMISSINGOPTIONS |
121 IFLG_ADDREPORTAUTO |
122 IFLG_UPDATEAPACHEFORKOPT |
123 IFLG_ADDPERCOLATOROPT |
124 IFLG_UPDATEPERCOLATORFEATS |
125 IFLG_UPDATEPERCOLATORUSERT |
126 IFLG_UPDATENCBIHTTPS |
127 IFLG_UPDATEDBMANAGERPERLPATH |
128 IFLG_UPDATEMSPEPSEARCHOPTS |
129 IFLG_UPDATEEXECAFTERSEARCH |
130 IFLG_UPDATERESULTSCACHE |
131 IFLG_UPDATESPLITNUMOFQUERIES |
132 IFLG_UPDATESPLITDATAFILESIZE |
133 IFLG_UPDATEPROTFAMILYSWITCH
134 };
135
137 ms_datfile();
138
140 ms_datfile(const ms_datfile& src);
141
143 ms_datfile(const char* filename, const int timeoutSec = 0,
145
147 ~ms_datfile();
148
150 void defaultValues();
151
153 void copyFrom(const ms_datfile* right);
154
155#ifndef SWIG
157 ms_datfile& operator=(const ms_datfile& right);
158#endif
160 std::string getFileName() const;
161
163 void setFileName(const char* name);
164
166 void setConnectionSettings(const matrix_science::ms_connection_settings & cs);
167
169 matrix_science::ms_connection_settings getConnectionSettings() const;
170
172 void read_file();
173
174 void read_buffer(const char * buffer);
175
177 void save_file();
178
180 bool editedByDatabaseManager() const;
181
183 const ms_databases* getDatabases() const;
184
186 void setDatabases(const ms_databases* dbs);
187
189 const ms_libraryoptions* getLibraryOptions() const;
190
192 void setLibraryOptions(const ms_libraryoptions* spectralLibraryOptions);
193
195 const ms_parseoptions* getParseOptions() const;
196
198 void setParseOptions(const ms_parseoptions* rules);
199
201 const ms_wwwoptions* getWWWOptions() const;
202
204 void setWWWOptions(const ms_wwwoptions* www);
205
207 const ms_processoroptions* getProcessors() const;
208
210 void setProcessors(const ms_processoroptions* info);
211
213 const ms_taxonomyrules* getTaxonomyRules(const int idx) const;
214
216 void setTaxonomyRules(const int idx, const ms_taxonomyrules* rules);
217
219 int getMaxTaxonomyRules() const;
220
222 const ms_clusterparams* getClusterParams() const;
223
225 void setClusterParams(const ms_clusterparams* params);
226
228 const ms_unigeneoptions* getUniGeneOptions() const;
229
231 void setUniGeneOptions(const ms_unigeneoptions * uoptions);
232
234 const ms_mascotoptions* getMascotOptions() const;
235
237 void setMascotOptions(const ms_mascotoptions* opt);
238
240 const ms_cronoptions* getCronOptions() const;
241
243 void setCronOptions(const ms_cronoptions* options);
244
246 const ms_mascotfiles* getMascotFiles() const;
247
249 void setMascotFiles(const ms_mascotfiles* src);
250
252 void setFindFileTimeout(const int seconds);
253
255 int getFindFileTimeout() const;
256
258 unsigned int checkSeqDBInstallRequest(const std::string & dbName,
259 const double newFastaSize) const;
260
262 bool updateForInstaller(ms_errs & log,
263 const char * not_mascot_dat_path,
264 const char * mascot_dat_path,
265 const char * licenseFilePath,
266 const char * pathToMascot,
267 const char * mascotURL,
268 const char * sequenceDatabases,
269 const bool clusterEnable,
270 const WST wst,
271 const char * NTGuestName,
272 const char * NTAdminName,
273 const unsigned int flags);
274
276 std::string getHeaderComments() const;
277
279 void setHeaderComments(const std::string headerComments);
280
281 private:
282 std::string filename_;
283
284 int findFileTimeout_;
285
286 ms_databases Databases;
287
288 ms_libraryoptions libraryOptions;
289
290 ms_parseoptions parseOptions;
291
292 ms_wwwoptions wwwOptions;
293
294 ms_processoroptions Processors;
295
296 ms_taxonomyrules **taxonomyRules;
297
298 ms_clusterparams clusterParams;
299
300 ms_unigeneoptions unigeneOptions;
301
302 ms_mascotoptions Options;
303
304 ms_cronoptions cronOptions;
305
306 ms_mascotfiles MascotFiles;
307
308 std::string headerComments_;
309 std::string footerComments_;
310
312
313 private:
314 void defaultFileName();
315
316 void defaultTaxonomyRules();
317 void copyTaxonomyRules(const ms_datfile* right);
318
319 void get_db_info(ms_filesource *f);
320 void save_db_info(void *f);
321
322 void get_library_options(ms_filesource *f, const std::string & preceedingComments);
323 void save_library_options(void *f);
324
325 void get_parse_rules(ms_filesource *f, const std::string & preceedingComments);
326 void save_parse_rules(void *f);
327
328 void get_www(ms_filesource *f, const std::string & preceedingComments);
329 void save_www(void *f);
330
331 void get_taxonomy_rules(ms_filesource *f, const char * sectionTitle, const std::string & preceedingComments);
332 void save_taxonomy(void *f, const int index);
333
334 void get_cluster_params(ms_filesource *f, const std::string & preceedingComments);
335 void save_cluster_params(void *f);
336
337 void get_unigene_options(ms_filesource *f, const std::string & preceedingComments);
338 void save_unigene_options(void *f);
339
340 void get_processors(ms_filesource *f, const std::string & preceedingComments);
341 void save_processors(void *f);
342
343 void get_options(ms_filesource *f, const std::string & preceedingComments);
344 void save_options(void *f);
345
346 void get_cron_job_list(ms_filesource *f, const std::string & preceedingComments);
347 void save_cron_job_list(void *f);
348
349 bool get_parse_rule_plus(const char *lineForError, char *pSrc, ms_parserule_plus *pRulePlus);
350 void setIamParameter();
351 void checkAndCompileParseRules();
352 bool parseStringIntoCron(const char *szBuf, ms_cronjob & cron);
353
354 int parseIntoArray(const char * szBufCopy,
355 bool * array,
356 int minVal,
357 int maxVal,
358 int starMeans,
359 const char * wholeLine);
360
361 bool skipToEndOfSection(ms_filesource *f);
362 bool getStringExcludingQuotes(const char *line, char *pDst);
363 void readToEndOfLine(const char * pSrc, char * pDst, int maximumLength);
364 void replaceHashes(matrix_science::ms_customproperty & section,
365 const std::string & localPath,
366 const std::string & hostname,
367 const std::string & url);
368
369 void read_filesource(ms_filesource & fsource);
370 bool updateForInstallerDatabase(ms_errs & log,
371 const std::string & dbName,
372 const std::string & defaultWildcard,
373 ms_databases & dbs,
374 const ms_databases * not_dbs,
375 ms_parseoptions & thisParse,
376 const ms_parseoptions * notMascotDatParse);
377 void updateForInstaller_ExecAfterSearch(ms_errs & log, matrix_science::ms_mascotoptions & options, const std::string & createPipCompleteString);
378 }; // class ms_datfile // end of config_group
380} // namespace matrix_science
381
382#endif // MS_DATFILE_HPP
383
384/*------------------------------- End of File -------------------------------*/
An instance of this class represents all the parameters specified in the Cluster section of mascot....
Definition: ms_clusterparams.hpp:72
Settings required to make an HTTP connection to a Mascot server.
Definition: ms_connection_settings.hpp:54
Represents a single entry from the cron section of mascot.dat.
Definition: ms_cronoptions.hpp:38
Contains parameters from the cron section of mascot.dat.
Definition: ms_cronoptions.hpp:150
The class is used as a base for property-containing classes, such as ms_mascotoptions.
Definition: ms_customproperty.hpp:91
An instance of this class represents the Databases section of mascot.dat.
Definition: ms_databaseoptions.hpp:225
Encapsulates the mascot.dat file that contains the most important parameters.
Definition: ms_datfile.hpp:47
SEQDB_INSTALL
Flags for checkSeqDBInstallRequest().
Definition: ms_datfile.hpp:67
WST
Web server type for the updateForInstaller() function.
Definition: ms_datfile.hpp:55
INST_FLAGS
Flags for the updateForInstaller() function.
Definition: ms_datfile.hpp:93
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
Represents the LibraryOptions section of mascot.dat.
Definition: ms_libraryoptions.hpp:53
An instance of this class contains configuration files paths (except for mascot.dat).
Definition: ms_mascotfiles.hpp:53
An instance of this class represents all the parameters specified in the Options section of mascot....
Definition: ms_mascotoptions.hpp:91
Represents the PARSE section of mascot.dat.
Definition: ms_parserule.hpp:102
Represents regular expression parse rule plus some additional parameters.
Definition: ms_taxonomyrules.hpp:153
An instance of this class represents all the parameters specified in the Processors section of mascot...
Definition: ms_processoroptions.hpp:109
This class represents a single Taxonomy_XXX section in mascot.dat.
Definition: ms_taxonomyrules.hpp:247
An instance of this class represents all the parameters specified in UniGene section of mascot....
Definition: ms_unigeneoptions.hpp:59
Represents the whole WWW section.
Definition: ms_wwwoptions.hpp:157