Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_modfile.hpp
1/*
2##############################################################################
3# file: ms_modfile.hpp #
4# 'msparser' toolkit #
5# Encapsulates "mod_file"-file that defines amino acid modifications #
6##############################################################################
7# COPYRIGHT NOTICE #
8# Copyright 1998-2003 Matrix Science Limited All Rights Reserved. #
9# #
10##############################################################################
11# $Archive:: /Mowse/ms_mascotresfile/include/ms_modfile.hpp $ #
12# $Author: robertog@matrixscience.com $ #
13# $Date: 2024-04-30 14:29:58 +0100 $ #
14# $Revision: 514b75f28c7f9636ba624f627dd5cb3f4e495b2e | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
15# $NoKeywords:: $ #
16##############################################################################
17*/
18
19#ifndef MS_MODFILE_HPP
20#define MS_MODFILE_HPP
21
22
23#include <string>
24#include <vector>
25#include <memory>
26
27namespace msparser_internal {
28 class ms_modification_impl;
29}
30
31namespace matrix_science {
32
33 class ms_masses;
34 class ms_umod_modification;
35
47 {
57 MOD_TYPE_______LAST = 9 // This must always be last....
58 };
59
61
65 {
66 MASS_TYPE_MONO = 0x0000,
67 MASS_TYPE_AVE = 0x0001
68 };
69
71
74 enum
75 {
76 MAX_VAR_MODS = 'W' -'A' + 10
77 };
78
79 typedef std::vector<double> ms_vectorDouble;
80 typedef std::vector< bool > ms_vectorBool;
81
83
133 class MS_MASCOTRESFILE_API ms_modification: public ms_customproperty
134 {
135 friend class ms_modfile;
136 friend class ms_modvector;
137 public:
138
140 ms_modification(const ms_masses* massFile = NULL);
141
144
147
149 void defaultValues();
150
152 void copyFrom(const ms_modification* src);
153
154#ifndef SWIG
156 ms_modification& operator=(const ms_modification& right);
157#endif
158
160 std::string getClassification() const;
161
163 bool getFromUnimod(const char* modName, const ms_umod_configfile *umod_file);
164
166 void setMassFile(const ms_masses* massFile);
167
169 const ms_masses* getMassFile() const;
170
172 void copyMassFile(const ms_masses* massFile);
173
175 std::string getTitle() const;
176
178 void setTitle(const char* value);
179
181 int getModificationType() const;
182
184 void setModificationType(const int type);
185
187 bool isHidden() const;
188
190 void setHidden(const bool value);
191
193 bool inShortList() const;
194
196 void setInShortList(const bool value);
197
199 bool inLongList() const;
200
202 void setInLongList(const bool value);
203
205 bool inErrorTolerant() const;
206
208 void setInErrorTolerant(const bool value);
209
211 bool isSubstitution() const;
212
214 double getDelta(const MASS_TYPE massType) const;
215
217 void setDelta(const double massMono, const double massAve);
218
220 ms_vectorDouble getNeutralLoss(const MASS_TYPE massType) const;
221
223 ms_vectorBool getNeutralLossRequired() const;
224
226 //std::vector< double > getNeutralLossFrequencies() const;
227
229 void setNeutralLoss(const ms_vectorDouble massMono, const ms_vectorDouble massAve, const ms_vectorBool required);
230
232 int getNumberOfModifiedResidues() const;
233
235 char getModifiedResidue(const int n) const;
236
238 bool isResidueModified(const char residue) const;
239
241 double getResidueMass(const MASS_TYPE massType, const char residue) const;
242
244 void clearModifiedResidues();
245
247 void appendModifiedResidue(const char residue, const double massMono, const double massAve);
248
250 double getNTerminusMass(const MASS_TYPE massType) const;
251
253 void setNTerminusMass(const double massMono, const double massAve);
254
256 double getCTerminusMass(const MASS_TYPE massType) const;
257
259 void setCTerminusMass(const double massMono, const double massAve);
260
262 int getNumberOfIgnoreMasses() const;
263
265 double getIgnoreMass(const MASS_TYPE massType, const int idx) const;
266
268 void clearIgnoreMasses();
269
271 void appendIgnoreMass(const double massMono, const double massAve);
272
274 ms_vectorDouble getReqPepNeutralLoss(const MASS_TYPE massType) const;
275
277 void setReqPepNeutralLoss(const ms_vectorDouble valuesMono, const ms_vectorDouble valuesAve);
278
280 ms_vectorDouble getPepNeutralLoss(const MASS_TYPE massType) const;
281
283 void setPepNeutralLoss(const ms_vectorDouble valuesMono, const ms_vectorDouble valuesAve);
284
286 bool isGeneratedMonoLinker() const;
287
289 bool isLoopLinker() const;
290
292 std::string getCode() const;
293
295 std::string getPairsWith() const;
296
298 std::string getMonoLinkTitle() const;
299
301 bool isCrossLinker() const;
302
304 void setIsCrossLinker(const bool value);
305
307 void setIsGeneratedMonoLinker(const bool value);
308
310 void setIsLoopLinker(const bool value);
311
313 int getPositionInUnimodAsNeutralLoss() const;
314
316 void setPositionInUnimodAsNeutralLoss(const int value);
317
319 void setCode(std::string code);
320
322 void setPairsWith(std::string pairsWith);
323
325 void setTitleSource(const char *unimodName, const char *specString);
326
327#ifdef SUPPRESS_MS_CUSTOMPROPERTY_INHERITANCE
328#include "suppress_ms_customproperty.hpp"
329#endif
330
331 private:
332 void setCustomProperty();
333
334 msparser_internal::ms_modification_impl * m_pImpl;
335 }; // ms_modification
336
338 class MS_MASCOTRESFILE_API ms_modvector
339 {
340 friend class ms_modfile;
341 public:
343 ms_modvector();
344
346 ms_modvector(const ms_modvector& src);
347
349 ms_modvector(const ms_umod_modification &src, const ms_umod_configfile &umod_file);
350
353
355 void copyFrom(const ms_modvector* right);
356
358 void copyFrom(const ms_umod_modification* right, const ms_umod_configfile *umod_file);
359
360#ifndef SWIG
362 ms_modvector& operator=(const ms_modvector& right);
363#endif
364
366 int getNumberOfModifications() const;
367
369 void clearModifications();
370
372 void appendModification(const ms_modification* item);
373
375 void appendModifications(ms_modvector &right);
376
378 const ms_modification * getModificationByNumber(const int numMod) const;
379
381 const ms_modification * getModificationByName(const std::string &name) const;
382
383 private:
384 typedef std::vector<ms_modification* > mod_vector;
385
386 mod_vector entries_;
387 }; // class ms_modvector
388
390
406 class MS_MASCOTRESFILE_API ms_modfile: public ms_errors
407 {
408 public:
410 ms_modfile();
411
413 ms_modfile(const ms_modfile& src);
414
415
418 const unsigned int flags = ms_umod_configfile::MODFILE_FLAGS_ALL);
419
421 ms_modfile(const char* filename,
422 const ms_masses* massFile,
423 const bool fromSubstitutions = false,
424 const ms_connection_settings * cs = 0);
425
427 ~ms_modfile();
428
430 void defaultValues();
431
433 void copyFrom(const ms_modfile* right);
434
436 void copyFrom(const ms_umod_configfile* right,
437 const unsigned int flags = ms_umod_configfile::MODFILE_FLAGS_ALL);
438
439#ifndef SWIG
441 ms_modfile& operator=(const ms_modfile& right);
442#endif
444 void setFileName(const char* name);
445
447 std::string getFileName() const;
448
450 void setConnectionSettings(const ms_connection_settings & cs);
451
453 ms_connection_settings getConnectionSettings() const;
454
456 void setMassFile(const ms_masses* massFile);
457
459 const ms_masses* getMassFile() const;
460
462 bool isFromSubstitutions() const;
463
465 void setFromSubstitutions(const bool value);
466
468 void read_file();
469
471 void save_file();
472#ifndef SWIG
474 void saveToString(std::string & modfileAsStr);
475#else // SWIG Multiple return values
476 void saveToString(std::string & OUTPUT);
477#endif
479 void sortModifications();
480
482 int getNumberOfModifications() const;
483
485 void clearModifications();
486
488 void appendModification(const ms_modification* item);
489
491 const ms_modification * getModificationByNumber(const int numMod) const;
492
494 const ms_modification * getModificationByName(const char* nameMod) const;
495
497 bool updateModificationByNumber(const int num, const ms_modification mod);
498
500 bool updateModificationByName(const char* name, const ms_modification mod);
501
503 bool deleteModificationByNumber(const int num);
504
506 bool deleteModificationByName(const char* name);
507
508 private:
509 void read_text();
510 void save_text();
511 void applyVisibility(const ms_session *session);
512
513 typedef std::vector<ms_modification* > entries_vector;
514 entries_vector entries;
515
516 std::string filename_;
517 std::unique_ptr<ms_masses> m_massFile;
518 std::vector< std::string > comments_;
519 bool bFromSubstitutions_;
521
522 }; // ms_modfile // end of config_group
524} // namespace matrix_science
525
526#endif // MS_MODFILE_HPP
527
528/*------------------------------- 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
This class is used as a base class for several Mascot Parser classes.
Definition: ms_errors.hpp:696
Reads and parses the masses file with residue and atom masses.
Definition: ms_masses.hpp:48
Use this class in order to read in the amino acid modification file.
Definition: ms_modfile.hpp:407
The class represents a single modification-entry in mod_file.
Definition: ms_modfile.hpp:134
General usage class for creating lists of modifications to be passed as parameters.
Definition: ms_modfile.hpp:339
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
This class represents the file unimod.xml.
Definition: ms_umod_configfile.hpp:54
Represents a modif object in unimod.xml.
Definition: ms_umod_modification.hpp:47
MOD_TYPES
Definition: ms_modfile.hpp:47
MASS_TYPE
All possible mass types.
Definition: ms_modfile.hpp:65
@ MOD_TYPE_N_TERM
Applies to the peptide N-terminus, independent of residue identity.
Definition: ms_modfile.hpp:49
@ MOD_TYPE_N_TERM_RESIDUE
Applies to a specific residue only when that residue is at N-terminus.
Definition: ms_modfile.hpp:53
@ MOD_TYPE_N_PROTEIN_RESIDUE
Applies to a specific residue only when that residue is at N-terminus of a protein.
Definition: ms_modfile.hpp:55
@ MOD_TYPE_N_PROTEIN
Applies to the protein N-terminus, independent of residue identity.
Definition: ms_modfile.hpp:51
@ MOD_TYPE_C_TERM
Applies to the peptide C-terminus, independent of residue identity.
Definition: ms_modfile.hpp:50
@ MOD_TYPE_C_PROTEIN_RESIDUE
Applies to a specific residue only when that residue is at C-terminus of a protein.
Definition: ms_modfile.hpp:56
@ MOD_TYPE_C_PROTEIN
Applies to the protein C-terminus, independent of residue identity.
Definition: ms_modfile.hpp:52
@ MOD_TYPE_C_TERM_RESIDUE
Applies to a specific residue only when that residue is at C-terminus.
Definition: ms_modfile.hpp:54
@ MOD_TYPE_RESIDUE
Applies to specific residues, independent of position within the peptide.
Definition: ms_modfile.hpp:48
@ MAX_VAR_MODS
The results file uses 1..9 and A..W (1..32).
Definition: ms_modfile.hpp:76
@ MASS_TYPE_MONO
monoisotopic mass index
Definition: ms_modfile.hpp:66
@ MASS_TYPE_AVE
average mass index
Definition: ms_modfile.hpp:67