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