libpappsomspp
Library for mass spectrometry
types.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/types.h
3 * \date 4/3/2015
4 * \author Olivier Langella
5 * \brief This header contains all the type re-definitions and all
6 * the global variables definitions used in the PAPPSOms++ library.
7 */
8
9/*******************************************************************************
10 * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
11 *
12 * This file is part of the PAPPSOms++ library.
13 *
14 * PAPPSOms++ is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * PAPPSOms++ is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
26 *
27 * Contributors:
28 * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
29 *implementation
30 ******************************************************************************/
31
32#pragma once
33
34#include <map>
35
36#include <QString>
37#include <cstdint>
38
39namespace pappso
40{
41
42/************ Typedefs **************************************************/
43
44/** \var typedef QString PeptideStr
45 \brief A type definition for PeptideStr
46 */
47typedef QString PeptideStr;
48
49/** \var typedef double pappso_double
50 \brief A type definition for doubles
51 */
52typedef double pappso_double;
53
54/** \var typedef float mcq_float
55 \brief A type definition for floats
56 */
57typedef float pappso_float;
58
59typedef unsigned int uint;
60
61/*********** enumerations *********************************/
62
63
64/** \def TimeUnit (s, min, h)
65 */
66enum class TimeUnit
67{
68 none,
69 s,
70 min,
71 h,
72};
73
74
75/** \def PrecisionUnit ppm or dalton
76 *
77 */
78enum class PrecisionUnit
79{
80 none,
81 dalton,
82 ppm,
83 res,
84 mz,
85 last
86};
87extern std::map<PrecisionUnit, QString> precisionUnitMap;
88
89/** \def AtomIsotopeSurvey list of atoms on which isotopes may occurs
90 *
91 */
92enum class AtomIsotopeSurvey : std::int8_t
93{
94 C,
95 H,
96 O,
97 N,
98 S,
99 P,
100 last
101};
102
103
104/** \def Isotope list of isotopes taken into account for peptide abundance
105 * calculation
106 *
107 */
108enum class Isotope
109{
110 C,
111 C13,
112 H,
113 H2,
114 O,
115 O17,
116 O18,
117 N,
118 N15,
119 S,
120 S33,
121 S34,
122 S36,
123 P
124};
125
126
127/** \def MzFormat mz data file format types
128 *
129 */
130enum class MsDataFormat : std::int8_t
131{
132 unknown = 0, ///< unknown format
133 mzML = 1, ///< mzML
134 mzXML = 2, ///< mzXML
135 MGF = 3, ///< Mascot format
136 SQLite3 = 4, ///< SQLite3 format
137 xy = 5, ///< (x,y) format
138 mz5 = 6, //< MZ5 format
139 msn = 7, //< MS_MS2 format
140 abSciexWiff = 8,
141 abSciexT2D = 9,
143 thermoRaw = 11,
144 watersRaw = 12,
145 brukerFid = 13,
146 brukerYep = 14,
147 brukerBaf = 15,
148 brukerTims = 16,
149 brukerBafAscii = 17, // Baf to ascii from Bruker software
150 last = 18
151};
152
153
154/** \def FileReaderType mass data file reader types
155 *
156 */
158{
159 pwiz, ///< using libpwizlite
160 xy,
161 bafascii,
162 tims, ///< TimsMsRunReader : each scan is returned as a mass spectrum
163 tims_frames, ///< TimsFramesMsRunReader : the whole frame is merged in a
164 ///< single spectrum
165 tims_ms2, ///< TimsMsRunReaderMs2 : Spectrum are delivered for each precursor
166 ///< (MS1 or MS2)
167
168 tims_dia, ///< TimsMsRunReaderDia : Spectrum are delivered for DIA window
169 ///< (slice)
170};
171
172
173/** \def AminoAcidChar Amino-acid full name and code correspondence
174 *
175 */
176enum class AminoAcidChar : char
177{
178 alanine = 'A',
179 cysteine = 'C',
180 aspartic_acid = 'D',
181 glutamic_acid = 'E',
182 phenylalanine = 'F',
183 glycine = 'G',
184 histidine = 'H',
185 isoleucine = 'I',
186 lysine = 'K',
187 leucine = 'L',
188 methionine = 'M',
189 asparagine = 'N',
190 proline = 'P',
191 glutamine = 'Q',
192 arginine = 'R',
193 serine = 'S',
194 threonine = 'T',
195 valine = 'V',
196 tryptophan = 'W',
197 tyrosine = 'Y',
198 selenocysteine = 'U',
199 pyrrolysine = 'O',
200};
201
202
203enum class SortType : std::int8_t
204{
205 no_sort = 0,
206 x = 1,
207 y = 2,
208};
209
210
211enum class SortOrder : std::int8_t
212{
213 ascending = 0,
214 descending = 1,
215};
216
217/** \def Data compression types
218 *
219 */
220enum class DataCompression : std::int8_t
221{
222 unset = -1, ///< not net
223 none = 0, ///< no compression
224 zlib = 1, ///< zlib compresssion
225};
226
227
228enum class DataKind : std::int8_t
229{
230 unset = -1, ///< not set
231 rt = 0, ///< Retention time
232 dt = 1, ///< Drift time
233 mz = 2, ///< m/z
234};
235
236
237enum class Axis : std::int8_t
238{
239 unset = 0x000,
240 x = 1 << 0,
241 y = 1 << 1,
242 z = 1 << 2,
243};
244
245
246enum class AxisScale : std::int8_t
247{
248 unset = 0,
249 orig = 1,
250 log10 = 2,
251};
252
253
254/** \def XixExtactMethod method to extract Xic
255 *
256 */
257enum class XicExtractMethod : std::int8_t
258{
259 sum = 1, ///< sum of intensities
260 max = 2 ///< maximum of intensities
261};
262
263
264/*********** Global variables definitions*********************************/
265
266/** \def MHPLUS 1.007276466879
267 \brief The (monoisotopic) mass of the H+ ion
268 https://en.wikipedia.org/wiki/Proton (One Proton alone)
269 1.007276466879
270 */
271const pappso_double MHPLUS(1.007276466879);
272const pappso_double MPROTON(1.007276466879);
273
274/** \def MPROTIUM 1.00782503207
275 \brief The (monoisotopic) mass of the H atom
276 https://en.wikipedia.org/wiki/Isotopes_of_hydrogen (One proton + One electron)
277 1.00782503207
278
279 Note that as of 20191028, that same page says: 1.007825032241
280 */
281const pappso_double MPROTIUM(1.007825032241);
282
283
284/** \def ONEMILLION 1000000
285 \brief One million integer, why not.
286 */
288
289
290/** @file
291 * https://forgemia.inra.fr/pappso/massxpert/-/blob/be60e53480f68d36afa95c809cffd68d4fb46c79/data/polChemDefs/protein-1-letter-libisospec-atomic-data/protein-1-letter-libisospec-atomic-data.xml
292 * abundance of sulfur extracted from 'massXpert' polymer definitions
293 */
294// <name>Sulfur</name>
295// <symbol>S</symbol>
296// <isotope>
297// <mass>31.9720711741</mass>
298// <abund>94.985001199904004920426814351230859756469726562500000000000000</abund>
299// </isotope>
300// <isotope>
301// <mass>32.9714589101</mass>
302// <abund>0.751939844812414937003097747947322204709053039550781250000000</abund>
303// </isotope>
304// <isotope>
305// <mass>33.9678670300</mass>
306// <abund>4.252059835213182203972337447339668869972229003906250000000000</abund>
307// </isotope>
308// <isotope>
309// <mass>35.9670812000</mass>
310// <abund>0.010999120070394368536836893213148869108408689498901367187500</abund>
311// </isotope>
312
313
314const pappso_double MASSOXYGEN(15.99491461956);
317const pappso_double MASSNITROGEN(14.0030740048);
320const pappso_double MASSPHOSPHORUS(30.973761998);
321const pappso_double MASSSULFUR(31.9720711741);
322
323// id: MOD:00696 name: phosphorylated residue H 1 O 3 P 1
325
326// Selenium : warning lot of isotopes
327const pappso_double MASSSELENIUM(79.916520); // 79.916520 //78.971
328
329// CHNOS
330
331/** \def DIFFC12C13 1.0033548378
332 \brief The (monoisotopic) mass difference between C12 (12u) and C13 stable
333 isotope of carbon
334 */
335const pappso_double DIFFC12C13(1.0033548378);
336
337/** \def DIFFS32S33 0.99938776
338 \brief The (monoisotopic) mass difference between S32 (31.97207100u) and S33
339 (32.97145876u) stable isotope of sulfur
340 https://en.wikipedia.org/wiki/Isotopes_of_sulfur
341 */
342const pappso_double DIFFS32S33(32.9714589101 - MASSSULFUR);
343
344/** \def DIFFS32S34 1.9957959
345 \brief The (monoisotopic) mass difference between S32 (31.97207100u) and S34
346 (33.96786690u) stable isotope of sulfur
347 */
348const pappso_double DIFFS32S34(33.9678670300 - MASSSULFUR);
349
350/** \def DIFFS32S36 3.99500976
351 \brief The (monoisotopic) mass difference between S32 (31.97207100u) and S36
352 (35.96708076u) stable isotope of sulfur
353 */
354const pappso_double DIFFS32S36(35.9670812000 - MASSSULFUR);
355
356
357/** \def DIFFH1H2
358 \brief The (monoisotopic) mass difference between H1 and H2 stable isotope of
359 hydrogen
360 */
361const pappso_double DIFFH1H2(2.0141017778 - MPROTIUM);
362
363/** \def DIFFO16O18
364 \brief The (monoisotopic) mass difference between O16 and O18 stable isotope of
365 oxygen
366 */
368
369/** \def DIFFO16O17
370 \brief The (monoisotopic) mass difference between O16 and O17 stable isotope of
371 oxygen
372 */
374
375/** \def DIFFN14N15
376 \brief The (monoisotopic) mass difference between N14 and N15 stable isotope of
377 nitrogen
378 */
379const pappso_double DIFFN14N15(15.0001088982 - MASSNITROGEN);
380
381
382// http://education.expasy.org/student_projects/isotopident/htdocs/motza.html
383/** \def ABUNDANCEH2 0.0156%
384 \brief H2 isotope abundance
385 */
386const pappso_double ABUNDANCEH2(0.00011570983569203332000374651045149221317842602729797363281250);
387
388/** \def ABUNDANCEN15 0.00364
389 \brief N15 isotope abundance
390 */
391const pappso_double ABUNDANCEN15(0.00364198543205827118818262988497735932469367980957031250000000);
392
393/** \def ABUNDANCEO17
394 \brief O17 isotope abundance
395 */
396const pappso_double ABUNDANCEO17(0.00038099847600609595965615028489992255344986915588378906250000);
397
398/** \def ABUNDANCEO18 0.2%
399 \brief O18 isotope abundance
400 */
401const pappso_double ABUNDANCEO18(0.00205139179443282221315669744399201590567827224731445312500000);
402
403/** \def ABUNDANCEC13 1.109%
404 \brief C13 isotope abundance
405 */
406const pappso_double ABUNDANCEC13(0.01078805814953308406245469086570665240287780761718750000000000);
407
408/** \def ABUNDANCEC12 98.89%
409 \brief C12 abundance
410 */
411const pappso_double ABUNDANCEC12(0.98921194185046687152862432412803173065185546875000000000000000);
412
413
414/** \def ABUNDANCES33 0.00750
415 \brief S33 abundance
416 */
417const pappso_double ABUNDANCES33(0.00751939844812414937003097747947322204709053039550781250000000);
418
419/** \def ABUNDANCES34 0.0429
420 \brief S34 abundance
421 */
422const pappso_double ABUNDANCES34(0.04252059835213182203972337447339668869972229003906250000000000);
423
424/** \def ABUNDANCES36 0.00020
425 \brief S36 abundance
426 */
427const pappso_double ABUNDANCES36(0.00010999120070394368536836893213148869108408689498901367187500);
428
429
430/** \brief PeptideIon enum defines all types of ions (Nter or Cter)
431 */
432enum class PeptideIon : std::int8_t
433{
434 b = 0, ///< Nter acylium ions
435 bstar = 1, ///< Nter acylium ions + NH3 loss
436 bo = 2, ///< Nter acylium ions + H2O loss
437 a = 3, ///< Nter aldimine ions
438 astar = 4, ///< Nter aldimine ions + NH3 loss
439 ao = 5, ///< Nter aldimine ions + H2O loss
440 bp = 6,
441 c = 7, ///< Nter amino ions
442 y = 8, ///< Cter amino ions
443 ystar = 9, ///< Cter amino ions + NH3 loss
444 yo = 10, ///< Cter amino ions + H2O loss
445 z = 11, ///< Cter carbocations
446 yp = 12,
447 x = 13 ///< Cter acylium ions
448};
449
450/** \brief only useful for internal use
451 * DO not change this value : it is used to define static array size
452 */
453#define PEPTIDE_ION_TYPE_COUNT 14
454} // namespace pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
const pappso_double MPROTON(1.007276466879)
const pappso_double ABUNDANCEC12(0.98921194185046687152862432412803173065185546875000000000000000)
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
Definition: types.h:433
AminoAcidChar
Definition: types.h:177
MsDataFormat
Definition: types.h:131
@ xy
(x,y) format
@ unknown
unknown format
@ SQLite3
SQLite3 format.
@ MGF
Mascot format.
Axis
Definition: types.h:238
const pappso_double DIFFS32S33(32.9714589101 - MASSSULFUR)
PrecisionUnit
Definition: types.h:79
const pappso_double DIFFS32S34(33.9678670300 - MASSSULFUR)
const pappso_double DIFFO16O17(16.99913150 - MASSOXYGEN)
const pappso_double MASSCARBON(12)
const pappso_double MASSPHOSPHORUS(30.973761998)
const pappso_double MASSSULFUR(31.9720711741)
const pappso_double ABUNDANCES36(0.00010999120070394368536836893213148869108408689498901367187500)
QString PeptideStr
A type definition for PeptideStr.
Definition: types.h:47
DataCompression
Definition: types.h:221
@ zlib
zlib compresssion
const pappso_double MASSCO(MASSCARBON+MASSOXYGEN)
const pappso_double ONEMILLION(1000000)
const pappso_double ABUNDANCEN15(0.00364198543205827118818262988497735932469367980957031250000000)
const pappso_double DIFFS32S36(35.9670812000 - MASSSULFUR)
const pappso_double MASSSELENIUM(79.916520)
const pappso_double MHPLUS(1.007276466879)
AtomIsotopeSurvey
Definition: types.h:93
double pappso_double
A type definition for doubles.
Definition: types.h:52
Isotope
Definition: types.h:109
AxisScale
Definition: types.h:247
SortType
Definition: types.h:204
const pappso_double ABUNDANCEC13(0.01078805814953308406245469086570665240287780761718750000000000)
const pappso_double MPROTIUM(1.007825032241)
const pappso_double MASSH2O((MPROTIUM *2)+MASSOXYGEN)
const pappso_double ABUNDANCEO17(0.00038099847600609595965615028489992255344986915588378906250000)
const pappso_double ABUNDANCEH2(0.00011570983569203332000374651045149221317842602729797363281250)
DataKind
Definition: types.h:229
@ dt
Drift time.
@ rt
Retention time.
const pappso_double MASSNH3((MPROTIUM *3)+MASSNITROGEN)
unsigned int uint
Definition: types.h:59
const pappso_double ABUNDANCES34(0.04252059835213182203972337447339668869972229003906250000000000)
const pappso_double MASSNITROGEN(14.0030740048)
const pappso_double MASSOXYGEN(15.99491461956)
const pappso_double MASSPHOSPHORYLATEDR(MPROTIUM+(MASSOXYGEN *3)+MASSPHOSPHORUS)
FileReaderType
Definition: types.h:158
@ pwiz
using libpwizlite
@ tims
TimsMsRunReader : each scan is returned as a mass spectrum.
const pappso_double ABUNDANCEO18(0.00205139179443282221315669744399201590567827224731445312500000)
const pappso_double DIFFO16O18(17.9991610 - MASSOXYGEN)
std::map< PrecisionUnit, QString > precisionUnitMap
Definition: precision.cpp:43
const pappso_double ABUNDANCES33(0.00751939844812414937003097747947322204709053039550781250000000)
const pappso_double DIFFN14N15(15.0001088982 - MASSNITROGEN)
TimeUnit
Definition: types.h:67
XicExtractMethod
Definition: types.h:258
@ sum
sum of intensities
@ max
maximum of intensities
const pappso_double DIFFC12C13(1.0033548378)
float pappso_float
Definition: types.h:57
SortOrder
Definition: types.h:212
const pappso_double DIFFH1H2(2.0141017778 - MPROTIUM)