Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_masses.hpp
1/*
2##############################################################################
3# file: ms_masses.hpp #
4# 'msparser' toolkit #
5# Encapsulates "masses"-file that defines atom and residue masses #
6# about several consecutive erros #
7##############################################################################
8# COPYRIGHT NOTICE #
9# Copyright 1998-2003 Matrix Science Limited All Rights Reserved. #
10# #
11##############################################################################
12# $Archive:: /Mowse/ms_mascotresfile/include/ms_masses.hpp $ #
13# $Author: villek@matrixscience.com $ #
14# $Date: 2024-08-19 15:33:52 +0100 $ #
15# $Revision: d48a6aa34bb34c80a33469ce907f789f718e62a6 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
16# $NoKeywords:: $ #
17##############################################################################
18*/
19
20#ifndef MS_MASSES_HPP
21#define MS_MASSES_HPP
22
23
24#include <string>
25
26
27namespace matrix_science {
28
29 class ms_umod_configfile; // forward declaration
30 class ms_quant_component; // forward declaration
31
38
47 class MS_MASCOTRESFILE_API ms_masses: public ms_errors
48 {
49 public:
51 ms_masses();
52
54 ms_masses(const ms_masses& src);
55
57 ms_masses(const ms_umod_configfile& src, bool addMissingResidueMasses=true);
58
60 ms_masses(const ms_umod_configfile& src, const ms_quant_component& quantComp);
61
63 ms_masses(const char* filename, const matrix_science::ms_connection_settings * cs = 0);
64
66 ~ms_masses();
67
69 void defaultValues(bool useDefaultResidueMasses=true);
70
72 void copyFrom(const ms_masses* right);
73
75 void copyFrom(const ms_umod_configfile *right, bool addMissingResidueMasses=true);
76
78 ms_modvector applyFixedMods(const ms_modvector *mods, ms_errs *err);
79
81 void applyIsotopes(const ms_umod_configfile *umodFile, const ms_quant_component *quantComp);
82
84 bool isSame(const ms_masses& other, const MASS_TYPE massType) const;
85
86#ifndef SWIG
88 ms_masses& operator=(const ms_masses& right);
89#endif
91 std::string getFileName() const;
92
94 void setFileName(const char* name);
95
97 void setConnectionSettings(const matrix_science::ms_connection_settings & cs);
98
100 matrix_science::ms_connection_settings getConnectionSettings() const;
101
103 void read_file();
104
106 void save_file();
107
108#ifndef SWIG
110 void saveToString(std::string & modfileAsStr);
111#else // SWIG Multiple return values
112 void saveToString(std::string & OUTPUT);
113#endif
114
116 double getResidueMass(const matrix_science::MASS_TYPE massType, const char residue) const;
117
119 void setResidueMasses(const char residue, const double massMono, const double massAve);
120
122 double getNtermDelta(const matrix_science::MASS_TYPE massType) const;
123
125 double getNterminalMass(const matrix_science::MASS_TYPE massType) const;
126
128 double getNtermNeutralLoss(const matrix_science::MASS_TYPE massType) const;
129
131 void setNtermModification(const double monoDelta,
132 const double aveDelta,
133 const double monoNeutralLoss = 0.0,
134 const double aveNeutralLoss = 0.0);
135
137 double getCtermDelta(const matrix_science::MASS_TYPE massType) const;
138
140 double getCterminalMass(const matrix_science::MASS_TYPE massType) const;
141
143 double getCtermNeutralLoss(const matrix_science::MASS_TYPE massType) const;
144
146 void setCtermModification(const double monoDelta,
147 const double aveDelta,
148 const double monoNeutralLoss = 0.0,
149 const double aveNeutralLoss = 0.0);
150
152 double getFragResidueMass(const matrix_science::MASS_TYPE massType, const char residue) const;
153
155 bool isResidueModified(const char residue) const;
156
158 void setResidueModification(const double monoDelta,
159 const double aveDelta,
160 const double monoNeutralLoss,
161 const double aveNeutralLoss,
162 const char *residues);
163
165 double getHydrogenMass(const matrix_science::MASS_TYPE massType) const;
166
168 void setHydrogenMass(const double massMono, const double massAve);
169
171 double getCarbonMass(const matrix_science::MASS_TYPE massType) const;
172
174 void setCarbonMass(const double massMono, const double massAve);
175
177 double getNitrogenMass(const matrix_science::MASS_TYPE massType) const;
178
180 void setNitrogenMass(const double massMono, const double massAve);
181
183 double getOxygenMass(const matrix_science::MASS_TYPE massType) const;
184
186 void setOxygenMass(const double massMono, const double massAve);
187
189 double getElectronMass() const;
190
192 void setElectronMass(const double mass);
193
195 void setStorage(double* res_mono,
196 double* res_ave,
197 double* hydrogen,
198 double* carbon,
199 double* nitrogen,
200 double* oxygen,
201 double* electron);
202
204 void defaultMasses(double* res_mono,
205 double* res_ave,
206 double* hydrogen,
207 double* carbon,
208 double* nitrogen,
209 double* oxygen,
210 double* electron,
211 bool useDefaultResidueMasses = true);
212
213 private:
214
215 bool getTwoMasses(char * line,
216 char *lineForError,
217 double *pMono,
218 double *pAve,
219 const double dMin,
220 const double dMax);
221
222 void setCustomProperty();
223
224 private:
225 // final destinations - they are assigned either
226 // 1) supplied array pointers
227 // 2) the internal storages
228 double* res_mono;
229 double* res_ave;
230
231 // mass combined with neutral loss for residue-specific mods
232 bool res_mod[26];
233 double* frag_res_mono;
234 double* frag_res_ave;
235
236 // masses of terminal groups for terminus mods
237 double ntermDelta[2];
238 double ctermDelta[2];
239
240 // neutral losses on terminal groups for terminus mods
241 double neutralLossNterm[2];
242 double neutralLossCterm[2];
243
244 double* hydrogen;
245 double* carbon;
246 double* nitrogen;
247 double* oxygen;
248
249 double* electron;
250
251 // internal storages in case they are not supplied with a proper constructor
252 double _res_mono[26];
253 double _res_ave[26];
254 double _frag_res_mono[26];
255 double _frag_res_ave[26];
256
257 double _hydrogen[2];
258 double _carbon[2];
259 double _nitrogen[2];
260 double _oxygen[2];
261
262 double _electron;
263
264 std::string _fn;
265 ms_customproperty _custprop;
267 }; // class ms_masses // end of config_group
269}
270
271#endif // MS_MASSES_HPP
272
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
All errors are collected in an instance of this class.
Definition: ms_errors.hpp:37
Reads and parses the masses file with residue and atom masses.
Definition: ms_masses.hpp:48
General usage class for creating lists of modifications to be passed as parameters.
Definition: ms_modfile.hpp:339
An object of this class represent a single component element in quantitation.xml.
Definition: ms_quant_component.hpp:48
This class represents the file unimod.xml.
Definition: ms_umod_configfile.hpp:54
MASS_TYPE
All possible mass types.
Definition: ms_modfile.hpp:65