#include <utils.h>
|
static const QString | getLexicalOrderedString (unsigned int num) |
|
static void | writeLexicalOrderedString (QTextStream *p_out, unsigned int num) |
|
static int | zeroDecimalsInValue (pappso_double value) |
| 0.11 would return 0 (no empty decimal) 2.001 would return 2 1000.0001254 would return 3 More...
|
|
static pappso_double | roundToDecimals (pappso_double value, int decimal_places) |
|
static std::string | toUtf8StandardString (const QString &text) |
|
static bool | writeToFile (const QString &text, const QString &file_name) |
|
static bool | appendToFile (const QString &text, const QString &file_name) |
|
static std::size_t | extractScanNumberFromMzmlNativeId (const QString &spectrum_native_id) |
|
static QString | pointerToString (const void *const pointer) |
|
static bool | almostEqual (double value1, double value2, int decimalPlaces=10) |
|
static QString | chronoTimePointDebugString (const QString &msg, std::chrono::system_clock::time_point chrono_time=std::chrono::system_clock::now()) |
|
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()) |
|
static std::vector< double > | splitMzStringToDoubleVectorWithSpaces (const QString &text, std::size_t &error_count) |
|
static std::vector< std::size_t > | splitSizetStringToSizetVectorWithSpaces (const QString &text, std::size_t &error_count) |
|
Definition at line 69 of file utils.h.
◆ almostEqual()
bool pappso::Utils::almostEqual |
( |
double |
value1, |
|
|
double |
value2, |
|
|
int |
decimalPlaces = 10 |
|
) |
| |
|
static |
Tell if both double values, are equal within the double representation capabilities of the platform.
Definition at line 254 of file utils.cpp.
285 tt = std::chrono::system_clock::to_time_t(chrono_time);
288 QString(
"%1 - %2\n").arg(msg).arg(QString::fromLatin1(ctime(&tt)));
References pappso::res.
◆ appendToFile()
bool pappso::Utils::appendToFile |
( |
const QString & |
text, |
|
|
const QString & |
file_name |
|
) |
| |
|
static |
Definition at line 188 of file utils.cpp.
192 qDebug() <<
" " << spectrum_native_id;
193 QStringList native_id_list = spectrum_native_id.split(
"=");
194 if(native_id_list.size() < 2)
196 throw ExceptionNotFound(
197 QObject::tr(
"scan number not found in mzML native id %1")
198 .arg(spectrum_native_id));
◆ chronoIntervalDebugString()
QString pappso::Utils::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() |
|
) |
| |
|
static |
Definition at line 316 of file utils.cpp.
327 QStringList string_list =
328 text.split(QRegularExpression(
"[\\s]+"), QString::SkipEmptyParts);
332 std::vector<double> double_vector;
334 for(
int iter = 0; iter < string_list.size(); ++iter)
336 QString current_string = string_list.at(iter);
340 double current_double = current_string.toDouble(&ok);
◆ chronoTimePointDebugString()
QString pappso::Utils::chronoTimePointDebugString |
( |
const QString & |
msg, |
|
|
std::chrono::system_clock::time_point |
chrono_time = std::chrono::system_clock::now() |
|
) |
| |
|
static |
◆ extractScanNumberFromMzmlNativeId()
std::size_t pappso::Utils::extractScanNumberFromMzmlNativeId |
( |
const QString & |
spectrum_native_id | ) |
|
|
static |
TODO activate this in a future release to ensure scan number for(auto i = 0; i < native_id_list.size(); i += 2) { if(native_id_list[i] == "scan") { return native_id_list[i + 1].toULong(); } }
throw ExceptionNotFound( QObject::tr("scan number not found in mzML native id %1") .arg(spectrum_native_id));
Definition at line 211 of file utils.cpp.
225 return QString(
"%1").arg(
226 (quintptr)pointer, QT_POINTER_SIZE * 2, 16, QChar(
'0'));
◆ getLexicalOrderedString()
const QString pappso::Utils::getLexicalOrderedString |
( |
unsigned int |
num | ) |
|
|
static |
◆ pointerToString()
QString pappso::Utils::pointerToString |
( |
const void *const |
pointer | ) |
|
|
static |
◆ roundToDecimals()
◆ splitMzStringToDoubleVectorWithSpaces()
std::vector< double > pappso::Utils::splitMzStringToDoubleVectorWithSpaces |
( |
const QString & |
text, |
|
|
std::size_t & |
error_count |
|
) |
| |
|
static |
Definition at line 344 of file utils.cpp.
361 QStringList string_list =
362 text.split(QRegularExpression(
"[\\s]+"), QString::SkipEmptyParts);
367 std::vector<std::size_t> sizet_vector;
369 for(
int iter = 0; iter < string_list.size(); ++iter)
371 QString current_string = string_list.at(iter);
◆ splitSizetStringToSizetVectorWithSpaces()
std::vector< std::size_t > pappso::Utils::splitSizetStringToSizetVectorWithSpaces |
( |
const QString & |
text, |
|
|
std::size_t & |
error_count |
|
) |
| |
|
static |
Definition at line 377 of file utils.cpp.
383 sizet_vector.push_back(current_sizet);
◆ toUtf8StandardString()
std::string pappso::Utils::toUtf8StandardString |
( |
const QString & |
text | ) |
|
|
static |
◆ writeLexicalOrderedString()
void pappso::Utils::writeLexicalOrderedString |
( |
QTextStream * |
p_out, |
|
|
unsigned int |
num |
|
) |
| |
|
static |
◆ writeToFile()
bool pappso::Utils::writeToFile |
( |
const QString & |
text, |
|
|
const QString & |
file_name |
|
) |
| |
|
static |
Definition at line 165 of file utils.cpp.
170 QFile file(file_name);
172 if(file.open(QFile::WriteOnly | QFile::Append))
175 QTextStream out(&file);
◆ zeroDecimalsInValue()
0.11 would return 0 (no empty decimal) 2.001 would return 2 1000.0001254 would return 3
Determine the number of zero decimals between the decimal point and the first non-zero decimal.
- Parameters
-
value | the value to be analyzed |
- Returns
- the number of '0' decimals between the decimal separator '.' and the first non-0 decimal
Definition at line 102 of file utils.cpp.
106 if(decimal_places < 0)
109 return ceil((value * pow(10, decimal_places)) - 0.49) /
110 pow(10, decimal_places);
117 std::string env_backup = setlocale(LC_ALL,
"");
◆ endOfLineRegExp
QRegularExpression pappso::Utils::endOfLineRegExp = QRegularExpression("^\\s+$") |
|
static |
◆ mzListDataFormatRegExp
QRegularExpression pappso::Utils::mzListDataFormatRegExp |
|
static |
Regular expression matching <m/z value><non-numerical*>
Definition at line 77 of file utils.h.
◆ sizetListDataFormatRegExp
QRegularExpression pappso::Utils::sizetListDataFormatRegExp |
|
static |
Regular expression matching <size_t><non-numerical*>
Definition at line 80 of file utils.h.
◆ xyMassDataFormatRegExp
QRegularExpression pappso::Utils::xyMassDataFormatRegExp |
|
static |
The documentation for this class was generated from the following files: