libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
utils.cpp
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
3 *
4 * This file is part of the PAPPSOms++ library.
5 *
6 * PAPPSOms++ is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * PAPPSOms++ is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Contributors:
20 * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
21 *implementation
22 ******************************************************************************/
23
24/////////////////////// StdLib includes
25#include <cmath>
26
27
28/////////////////////// Qt includes
29#include <QDebug>
30#include <QFile>
31#include <QTextStream>
32#include <QJsonArray>
33
34
35/////////////////////// Local includes
36#include "pappsomspp/config.h"
37#include "utils.h"
38#include "types.h"
41
42
43namespace pappso
44{
45
46// Matches a double (decimal value, that is, m/z
47// value)
49 QRegularExpression("\\d*\\.?\\d+");
50
51// Matches anything that is not digit, '.', or '-'
52// (that is, matches a separator
53QRegularExpression Utils::anythingButDigitDotDash = QRegularExpression("[^\\d^\\.^-]+");
54
55// Matches a double (with exp notation
56// possibly) and also potentially a '-' sign. This is the intensity.
58 QRegularExpression("-?\\d*\\.?\\d*[e-]?\\d*");
59
60// Matches <number><separator><number>, that is: m/z<separator>intensity.
61QRegularExpression Utils::xyMassDataFormatRegExp =
62 // QRegularExpression("^(\\d*\\.?\\d+)([^\\d^\\.^-]+)(-?\\d*\\.?\\d*[e-]?\\d*)");
63 QRegularExpression(QString("^(%1)(%2)(%3)")
65 .arg(Utils::anythingButDigitDotDash.pattern())
67
68
69QRegularExpression Utils::endOfLineRegExp = QRegularExpression("^\\s+$");
70
71const QString
73{
74 int size = log10(num);
75 size += 97;
76 QLatin1Char latin1_char(size);
77 QString base(latin1_char);
78 base.append(QString().setNum(num));
79 return (base);
80}
81
82
83void
84Utils::writeLexicalOrderedString(QTextStream *p_out, unsigned int num)
85{
86 *p_out << (char)(log10(num) + 97) << num;
87}
88
89
90//! Determine the number of zero decimals between the decimal point and the
91//! first non-zero decimal.
92/*!
93 * 0.11 would return 0 (no empty decimal)
94 * 2.001 would return 2
95 * 1000.0001254 would return 3
96 *
97 * \param value the value to be analyzed
98 * \return the number of '0' decimals between the decimal separator '.' and
99 * the first non-0 decimal
100 */
101int
103{
104 // qDebug() << qSetRealNumberPrecision(10) << "Double value: " << value;
105
106 int intPart = static_cast<int>(value);
107
108 // qDebug() << "int part:" << intPart;
109
110 double decimalPart = value - intPart;
111
112 // qDebug() << qSetRealNumberPrecision(10) << "decimal part: " << decimalPart;
113
114 int count = 0;
115
116 while(decimalPart > 0)
117 {
118 ++count;
119
120 decimalPart *= 10;
121
122 // qDebug() << "Iteration " << count << "decimal part:" << decimalPart;
123
124 if(decimalPart >= 1)
125 {
126 // qDebug() << "Because decimal part " << decimalPart
127 //<< "is >= 1, breaking loop while count is " << count << ".";
128
129 break;
130 }
131 }
132
133 // qDebug() << "Returning count:" << count - 1;
134
135 return count - 1;
136}
137
138
140Utils::roundToDecimals(pappso_double value, int decimal_places)
141{
142 if(decimal_places < 0)
143 return value;
144
145 return ceil((value * pow(10, decimal_places)) - 0.49) / pow(10, decimal_places);
146}
147
148
149long long int
151{
152 pappso::pappso_double test_decimal = 100000000000;
153 if(sizeof(int *) == 4)
154 { // 32bits
155 test_decimal = 100000000;
156 }
157 return (floor(input * test_decimal));
158}
159
160
161// I think this is where the programs that I created for Win11 using MXE
162// crashed upon opening a mzML file. The crash occurred in pwizlite, but
163// my guess is that this is the function where we set the locale that makes
164// the program crash. Just to keep that in mind. Filippo Rusconi 20251209.
165std::string
166Utils::toUtf8StandardString(const QString &text)
167{
168 std::string env_backup;
169 try
170 {
171#ifdef MXE
172 // std::locale::global(std::locale("C")); // set locale to default locale
173 env_backup = std::setlocale(LC_ALL, nullptr);
174 std::setlocale(LC_ALL, "C");
175#else
176 std::locale::global(std::locale("C")); // set locale to default locale
177#endif
178 }
179 catch(std::exception &error)
180 {
182 QObject::tr("Error trying to set local to C : %1").arg(error.what()));
183 }
184 // Now perform the conversion.
185 QByteArray byte_array = text.toUtf8();
186 std::string stdText = "";
187
188 for(char c : byte_array)
189 {
190 stdText += c;
191 }
192
193 try
194 {
195#ifdef MXE
196 // std::locale::global(std::locale("C")); // set locale to default locale
197 std::setlocale(LC_ALL, env_backup.c_str());
198#else // Set back the locale to the backed-up one.
199 std::locale::global(std::locale("")); // sets locale according to OS environment
200#endif
201 }
202 catch(std::exception &error)
203 {
204
206 QObject::tr("Error trying to set local to original system one %1 : %2")
207 .arg(env_backup.c_str())
208 .arg(error.what()));
209 }
210
211 return stdText;
212}
213
214
215bool
216Utils::writeToFile(const QString &text, const QString &file_name)
217{
218
219 QFile file(file_name);
220
221 if(file.open(QFile::WriteOnly | QFile::Truncate))
222 {
223
224 QTextStream out(&file);
225
226 out << text;
227
228 out.flush();
229 file.close();
230
231 return true;
232 }
233
234 return false;
235}
236
237// Typically useful to debug bins...
238bool
239Utils::writeToFile(const std::vector<double> &data, int decimals, const QString &file_name)
240{
241 QFile file(file_name);
242
243 if(file.open(QFile::WriteOnly | QFile::Append))
244 {
245 file.open(QIODevice::WriteOnly);
246
247 QTextStream fileStream(&file);
248
249 for(auto &&value : data)
250 fileStream << QString("%1\n").arg(value, 0, 'f', decimals);
251
252 fileStream.flush();
253 file.close();
254
255 return true;
256 }
257
258 return false;
259}
260
261bool
262Utils::appendToFile(const QString &text, const QString &file_name)
263{
264
265 QFile file(file_name);
266
267 if(file.open(QFile::WriteOnly | QFile::Append))
268 {
269
270 QTextStream out(&file);
271
272 out << text;
273
274 out.flush();
275 file.close();
276
277 return true;
278 }
279
280 return false;
281}
282
283
284std::size_t
285Utils::extractScanNumberFromMzmlNativeId(const QString &spectrum_native_id)
286{
287 qDebug() << " " << spectrum_native_id;
288 QStringList native_id_list = spectrum_native_id.split("=");
289 if(native_id_list.size() < 2)
290 {
291 throw ExceptionNotFound(
292 QObject::tr("scan number not found in mzML native id %1").arg(spectrum_native_id));
293 }
294 else
295 {
296 /** TODO activate this in a future release to ensure scan number
297 for(auto i = 0; i < native_id_list.size(); i += 2)
298 {
299 if(native_id_list[i] == "scan")
300 {
301 return native_id_list[i + 1].toULong();
302 }
303 }
304
305 throw ExceptionNotFound(
306 QObject::tr("scan number not found in mzML native id %1")
307 .arg(spectrum_native_id));
308
309*/
310 return native_id_list.back().toULong();
311 }
312 return 0;
313}
314
315
316QString
317Utils::pointerToString(const void *const pointer)
318{
319 return QString("%1").arg((quintptr)pointer, QT_POINTER_SIZE * 2, 16, QChar('0'));
320}
321
322
323//! Tell if both double values, are equal within the double representation
324//! capabilities of the platform.
325bool
326Utils::almostEqual(double value1, double value2, int decimalPlaces)
327{
328 // QString value1String = QString("%1").arg(value1,
329 // 0, 'f', 60);
330 // QString value2String = QString("%1").arg(value2,
331 // 0, 'f', 60);
332
333 // qWarning() << __FILE__ << __LINE__ << __FUNCTION__
334 //<< "value1:" << value1String << "value2:" << value2String;
335
336 // The machine epsilon has to be scaled to the magnitude of the values used
337 // and multiplied by the desired precision in ULPs (units in the last place)
338 // (decimal places).
339
340 double valueSum = std::abs(value1 + value2);
341 // QString valueSumString = QString("%1").arg(valueSum,
342 // 0, 'f', 60);
343
344 double valueDiff = std::abs(value1 - value2);
345 // QString valueDiffString = QString("%1").arg(valueDiff,
346 // 0, 'f', 60);
347
348 double epsilon = std::numeric_limits<double>::epsilon();
349 // QString epsilonString = QString("%1").arg(epsilon,
350 // 0, 'f', 60);
351
352 double scaleFactor = epsilon * valueSum * decimalPlaces;
353 // QString scaleFactorString = QString("%1").arg(scaleFactor,
354 // 0, 'f', 60);
355
356 // qWarning() << "valueDiff:" << valueDiffString << "valueSum:" <<
357 // valueSumString <<
358 //"epsilon:" << epsilonString << "scaleFactor:" << scaleFactorString;
359
360 bool res = valueDiff < scaleFactor
361 // unless the result is subnormal:
362 || valueDiff < std::numeric_limits<double>::min();
363
364 // qWarning() << __FILE__ << __LINE__ << __FUNCTION__
365 //<< "returning res:" << res;
366
367 return res;
368}
369
370double
371Utils::roundValueToDecimalPlaces(double value, int decimal_places, bool round_up)
372{
373 if(decimal_places < 0)
374 return value;
375
376 double multiplier = std::pow(10.0, decimal_places);
377
378 if(round_up)
379 {
380 // Strict ceiling: round UP.
381 return std::ceil(value * multiplier) / multiplier;
382 }
383 else
384 {
385 // Add a tiny epsilon (1e-9) to counteract the "1.005" floating-point trap
386 return std::round(value * multiplier + 1e-9) / multiplier;
387 }
388}
389
390double
392{
393 return std::nextafter(value, value + 1);
394}
395
396
397QString
399 std::chrono::system_clock::time_point chrono_time)
400{
401
402 time_t tt;
403
404 tt = std::chrono::system_clock::to_time_t(chrono_time);
405
406 QString debug_text = QString("%1 - %2\n").arg(msg).arg(QString::fromLatin1(ctime(&tt)));
407
408 return debug_text;
409}
410
411
412QString
414 std::chrono::system_clock::time_point chrono_start,
415 std::chrono::system_clock::time_point chrono_finish)
416{
417 QString debug_text =
418 QString(
419 "%1 %2 min = %3 s = %4 ms = %5 "
420 "µs\n")
421 .arg(msg)
422 .arg(std::chrono::duration_cast<std::chrono::minutes>(chrono_finish - chrono_start).count())
423 .arg(std::chrono::duration_cast<std::chrono::seconds>(chrono_finish - chrono_start).count())
424 .arg(
425 std::chrono::duration_cast<std::chrono::milliseconds>(chrono_finish - chrono_start).count())
426 .arg(std::chrono::duration_cast<std::chrono::microseconds>(chrono_finish - chrono_start)
427 .count());
428
429 return debug_text;
430}
431
432
433std::vector<double>
434Utils::splitMzStringToDoubleVectorWithSpaces(const QString &text, std::size_t &error_count)
435{
436
437 QStringList string_list = text.split(QRegularExpression("[\\s]+"), Qt::SkipEmptyParts);
438
439 // qDebug() << "string list:" << string_list;
440
441 std::vector<double> double_vector;
442
443 for(int iter = 0; iter < string_list.size(); ++iter)
444 {
445 QString current_string = string_list.at(iter);
446
447 bool ok = false;
448
449 double current_double = current_string.toDouble(&ok);
450
451 if(!current_double && !ok)
452 {
453 ++error_count;
454 continue;
455 }
456
457 double_vector.push_back(current_double);
458 }
459
460 return double_vector;
461}
462
463
464std::vector<std::size_t>
465Utils::splitSizetStringToSizetVectorWithSpaces(const QString &text, std::size_t &error_count)
466{
467 // qDebug() << "Parsing text:" << text;
468
469 QStringList string_list = text.split(QRegularExpression("[\\s]+"), Qt::SkipEmptyParts);
470
471 // qDebug() << "string list size:" << string_list.size()
472 //<< "values:" << string_list;
473
474 std::vector<std::size_t> sizet_vector;
475
476 for(int iter = 0; iter < string_list.size(); ++iter)
477 {
478 QString current_string = string_list.at(iter);
479
480 bool ok = false;
481
482 std::size_t current_sizet = current_string.toUInt(&ok);
483
484 if(!current_sizet && !ok)
485 {
486 ++error_count;
487 continue;
488 }
489
490 sizet_vector.push_back(current_sizet);
491 }
492
493 return sizet_vector;
494}
495QString
497{
498 if(value)
499 return "TRUE";
500 return "FALSE";
501}
502
503QString
505{
506
507 if(mz_format == Enums::MsDataFormat::mzML)
508 return "mzML";
509 else if(mz_format == Enums::MsDataFormat::mzXML)
510 return "mzXML";
511 else if(mz_format == Enums::MsDataFormat::MGF)
512 return "MGF";
513 else if(mz_format == Enums::MsDataFormat::SQLite3)
514 return "SQLite3";
515 else if(mz_format == Enums::MsDataFormat::xy)
516 return "xy";
517 else if(mz_format == Enums::MsDataFormat::mz5)
518 return "mz5";
519 else if(mz_format == Enums::MsDataFormat::msn)
520 return "msn";
521 else if(mz_format == Enums::MsDataFormat::abSciexWiff)
522 return "abSciexWiff";
523 else if(mz_format == Enums::MsDataFormat::abSciexT2D)
524 return "abSciexT2D";
525 else if(mz_format == Enums::MsDataFormat::agilentMassHunter)
526 return "agilentMassHunter";
527 else if(mz_format == Enums::MsDataFormat::thermoRaw)
528 return "thermoRaw";
529 else if(mz_format == Enums::MsDataFormat::watersRaw)
530 return "watersRaw";
531 else if(mz_format == Enums::MsDataFormat::brukerFid)
532 return "brukerFid";
533 else if(mz_format == Enums::MsDataFormat::brukerYep)
534 return "brukerYep";
535 else if(mz_format == Enums::MsDataFormat::brukerBaf)
536 return "brukerBaf";
537 else if(mz_format == Enums::MsDataFormat::brukerTims)
538 return "brukerTims";
539 else if(mz_format == Enums::MsDataFormat::brukerBafAscii)
540 return "brukerBafAscii";
541 else
542 return "unknown";
543}
544
545
546QString
548{
549
550 if(file_reader_type == Enums::FileReaderType::pwiz)
551 return "pwiz";
552 else if(file_reader_type == Enums::FileReaderType::xy)
553 return "xy";
554 else if(file_reader_type == Enums::FileReaderType::tims)
555 return "tims";
556 else if(file_reader_type == Enums::FileReaderType::tims_frames)
557 return "tims_frames";
558 else
559 return "unknown";
560}
561
562QString
564{
565 switch(type)
566 {
568 return "AL";
569 break;
571 return "NA";
572 break;
574 return "RA";
575 break;
576 default:
577 return "ER";
578 }
579}
580
581
582QString
584{
585 switch(m_ionType)
586 {
588 return "y";
589 break;
591 return "yP";
592 break;
594 return "y*";
595 break;
597 return "yO";
598 break;
600 return "b*";
601 break;
603 return "bO";
604 break;
606 return "a";
607 break;
609 return "a*";
610 break;
612 return "aO";
613 break;
615 return "c";
616 break;
617 // SvgIon.moxygen - mN
619 return "z";
620 break;
622 return "b";
623 break;
625 return "bP";
626 break;
628 return "x";
629 break;
630 default:
631 throw PappsoException(QString("Enums::PeptideIon name not implemented"));
632 break;
633 }
634}
635
636
637QString
639{
640 switch(type)
641 {
643 return "both";
644 break;
646 return "native";
647 break;
649 return "symmetric";
650 break;
651 default:
652 return "synthetic";
653 }
654}
655
656QString
658{
659 auto it = precisionUnitMap.find(precision_unit);
660 if(it != precisionUnitMap.end())
661 {
662 return it->second;
663 }
664
665 throw pappso::ExceptionNotFound(QObject::tr("precision unit not found in precisionUnitMap"));
666}
667
668QString
670{
671 QString version(PAPPSOMSPP_VERSION);
672 return version;
673}
674
675
679{
681
682 pappso::AaModificationP oxidation =
683 pappso::AaModification::getInstance("MOD:00425"); // MOD:00425 15.994915
685 pappso::MzRange(oxidation->getMass(), precision).contains(mass))
686 {
687 return oxidation;
688 }
689 pappso::AaModificationP iodoacetamide =
690 pappso::AaModification::getInstance("MOD:00397"); // 57.021465
691 if(pappso::MzRange(iodoacetamide->getMass(), precision).contains(mass))
692 {
693 return iodoacetamide;
694 }
695 pappso::AaModificationP acetylated =
696 pappso::AaModification::getInstance("MOD:00408"); // 42.010567
697 if(pappso::MzRange(acetylated->getMass(), precision).contains(mass))
698 {
699 return acetylated;
700 }
701 pappso::AaModificationP phosphorylated =
702 pappso::AaModification::getInstance("MOD:00696"); // 79.96633
703 if(pappso::MzRange(phosphorylated->getMass(), precision).contains(mass))
704 {
705 return phosphorylated;
706 }
707 pappso::AaModificationP ammonia = pappso::AaModification::getInstance("MOD:01160"); //-17.026548
708 if(pappso::MzRange(ammonia->getMass(), precision).contains(mass))
709 {
710 return ammonia;
711 }
712 pappso::AaModificationP dehydrated =
713 pappso::AaModification::getInstance("MOD:00704"); //-18.010565
714 if(pappso::MzRange(dehydrated->getMass(), precision).contains(mass))
715 {
716 return dehydrated;
717 }
718 pappso::AaModificationP dimethylated =
719 pappso::AaModification::getInstance("MOD:00429"); // 28.0313
720 if(pappso::MzRange(dimethylated->getMass(), precision).contains(mass))
721 {
722 return dimethylated;
723 }
724
725 pappso::AaModificationP dimethylated_medium = pappso::AaModification::getInstance("MOD:00552");
726 if(pappso::MzRange(dimethylated_medium->getMass(), precision).contains(mass))
727 {
728 return dimethylated_medium;
729 }
730
731 pappso::AaModificationP dimethylated_heavy = pappso::AaModification::getInstance("MOD:00638");
732 if(pappso::MzRange(dimethylated_heavy->getMass(), precision).contains(mass))
733 {
734 return dimethylated_heavy;
735 }
736 pappso::AaModificationP DimethylpyrroleAdduct = pappso::AaModification::getInstance("MOD:00628");
737 if(pappso::MzRange(DimethylpyrroleAdduct->getMass(), precision).contains(mass))
738 {
739 return DimethylpyrroleAdduct;
740 }
741
742 // modification not found, creating customized mod :
744
746 QObject::tr("Utils::guessAaModificationPbyMonoisotopicMassDelta => "
747 "modification not found for mass %1")
748 .arg(mass));
749}
750
751
753Utils::translateAaModificationFromUnimod(const QString &unimod_accession)
754{
755 if(unimod_accession == "UNIMOD:1")
756 {
757
758 return pappso::AaModification::getInstance("MOD:00394");
759 }
760 if(unimod_accession == "UNIMOD:4")
761 {
762
763 return pappso::AaModification::getInstance("MOD:00397");
764 }
765 if(unimod_accession == "UNIMOD:7")
766 {
767
768 return pappso::AaModification::getInstance("MOD:00400");
769 }
770 if(unimod_accession == "UNIMOD:27")
771 {
772
773 return pappso::AaModification::getInstance("MOD:00420");
774 }
775 // UNIMOD:28 => MOD:00040
776 if(unimod_accession == "UNIMOD:28")
777 {
778
779 return pappso::AaModification::getInstance("MOD:00040");
780 }
781
782 if(unimod_accession == "UNIMOD:35")
783 {
784
785 return pappso::AaModification::getInstance("MOD:00425");
786 }
787 qInfo() << "unimod_accession:" << unimod_accession << " not found";
788 return nullptr;
789}
790
791
792QJsonArray
793Utils::toJson(const std::vector<double> &myVec)
794{
795 QJsonArray result;
796 for(auto i = myVec.begin(); i != myVec.end(); i++)
797 {
798 result.push_back((*i));
799 }
800 return result;
801}
802
803} // namespace pappso
pappso_double getMass() const
static AaModificationP getInstance(const QString &accession)
static AaModificationP getInstanceCustomizedMod(pappso_double modificationMass)
bool contains(pappso_double) const
Definition mzrange.cpp:115
static PrecisionPtr getDaltonInstance(pappso_double value)
get a Dalton precision pointer
static std::size_t extractScanNumberFromMzmlNativeId(const QString &spectrum_native_id)
Definition utils.cpp:285
static QString chronoTimePointDebugString(const QString &msg, std::chrono::system_clock::time_point chrono_time=std::chrono::system_clock::now())
Definition utils.cpp:398
static QString toString(specglob::SpectralAlignmentType type)
Convenience function to return a string describing the specglob alingment type.
Definition utils.cpp:563
static QString pointerToString(const void *const pointer)
Definition utils.cpp:317
static QString msDataFormatAsString(Enums::MsDataFormat mz_format)
Convenience function to return a string describing the MzFormat of a file.
Definition utils.cpp:504
static pappso_double roundToDecimals(pappso_double value, int decimal_places)
Definition utils.cpp:140
static QRegularExpression anythingButDigitDotDash
Definition utils.h:55
static bool almostEqual(double value1, double value2, int decimalPlaces=10)
Tell if both double values, are equal within the double representation capabilities of the platform.
Definition utils.cpp:326
static AaModificationP guessAaModificationPbyMonoisotopicMassDelta(Enums::AminoAcidChar aa, pappso_double mass)
Definition utils.cpp:677
static std::vector< double > splitMzStringToDoubleVectorWithSpaces(const QString &text, std::size_t &error_count)
Definition utils.cpp:434
static double nearestGreater(double value)
Definition utils.cpp:391
static std::string toUtf8StandardString(const QString &text)
Definition utils.cpp:166
static bool appendToFile(const QString &text, const QString &file_name)
Definition utils.cpp:262
static double roundValueToDecimalPlaces(double value, int decimal_places, bool round_up=true)
Definition utils.cpp:371
static QString fileReaderTypeAsString(Enums::FileReaderType file_reader_type)
Definition utils.cpp:547
static QString booleanToString(bool value)
convenient function to transform a boolean to QString "TRUE" or "FALSE" QString returned is readable ...
Definition utils.cpp:496
static AaModificationP translateAaModificationFromUnimod(const QString &unimod_accession)
Definition utils.cpp:753
static QString chronoIntervalDebugString(const QString &msg, std::chrono::system_clock::time_point chrono_start, std::chrono::system_clock::time_point chrono_finish=std::chrono::system_clock::now())
Definition utils.cpp:413
static long long int roundToDecimal32bitsAsLongLongInt(pappso_double input)
Definition utils.cpp:150
static bool writeToFile(const QString &text, const QString &file_name)
Definition utils.cpp:216
static std::vector< std::size_t > splitSizetStringToSizetVectorWithSpaces(const QString &text, std::size_t &error_count)
Definition utils.cpp:465
static QRegularExpression signedDoubleNumberExponentialRegExp
Definition utils.h:56
static QRegularExpression xyMassDataFormatRegExp
Regular expression matching <numerical value><non-numerical*><numericalvalue>.
Definition utils.h:60
static QRegularExpression unsignedDoubleNumberNoExponentialRegExp
Definition utils.h:54
static const QString getLexicalOrderedString(unsigned int num)
Definition utils.cpp:72
static QJsonArray toJson(const std::vector< double > &myVec)
convert vector of double into json array
Definition utils.cpp:793
static void writeLexicalOrderedString(QTextStream *p_out, unsigned int num)
Definition utils.cpp:84
static int zeroDecimalsInValue(pappso_double value)
Determine the number of zero decimals between the decimal point and the first non-zero decimal.
Definition utils.cpp:102
static QRegularExpression endOfLineRegExp
Regular expression that tracks the end of line in text files.
Definition utils.h:69
static QString getVersion()
Definition utils.cpp:669
#define PAPPSOMSPP_VERSION
Definition config.h:6
@ SQLite3
SQLite3 format.
Definition types.h:153
@ MGF
Mascot format.
Definition types.h:152
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter).
Definition types.h:286
@ a
Nter aldimine ions.
Definition types.h:290
@ y
Cter amino ions.
Definition types.h:295
@ c
Nter amino ions.
Definition types.h:294
@ astar
Nter aldimine ions + NH3 loss.
Definition types.h:291
@ ystar
Cter amino ions + NH3 loss.
Definition types.h:296
@ yo
Cter amino ions + H2O loss.
Definition types.h:297
@ bstar
Nter acylium ions + NH3 loss.
Definition types.h:288
@ b
Nter acylium ions.
Definition types.h:287
@ x
Cter acylium ions.
Definition types.h:300
@ bo
Nter acylium ions + H2O loss.
Definition types.h:289
@ ao
Nter aldimine ions + H2O loss.
Definition types.h:292
@ z
Cter carbocations.
Definition types.h:298
@ pwiz
using libpwizlite
Definition types.h:177
@ tims
TimsMsRunReader : each scan is returned as a mass spectrum.
Definition types.h:181
@ nonAlign
the type of alignment to put in origin matrix NON Alignment (0 - NA)
Definition types.h:49
@ reAlign
Re Alignment (1 - RE).
Definition types.h:51
ExperimentalSpectrumDataPointType
Definition types.h:78
@ both
both, the ion and the complement exists in the original spectrum
Definition types.h:83
@ symmetric
new peak : computed symmetric mass from a corresponding native peak
Definition types.h:81
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
const AaModification * AaModificationP
double pappso_double
A type definition for doubles.
Definition types.h:60
const PrecisionBase * PrecisionPtr
Definition precision.h:122
std::map< Enums::PrecisionUnit, QString > precisionUnitMap
Definition precision.cpp:43