| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* BEGIN software license | ||
| 2 | * | ||
| 3 | * MsXpertSuite - mass spectrometry software suite | ||
| 4 | * ----------------------------------------------- | ||
| 5 | * Copyright (C) 2009--2020 Filippo Rusconi | ||
| 6 | * | ||
| 7 | * http://www.msxpertsuite.org | ||
| 8 | * | ||
| 9 | * This file is part of the MsXpertSuite project. | ||
| 10 | * | ||
| 11 | * The MsXpertSuite project is the successor of the massXpert project. This | ||
| 12 | * project now includes various independent modules: | ||
| 13 | * | ||
| 14 | * - massXpert, model polymer chemistries and simulate mass spectrometric data; | ||
| 15 | * - mineXpert, a powerful TIC chromatogram/mass spectrum viewer/miner; | ||
| 16 | * | ||
| 17 | * This program is free software: you can redistribute it and/or modify | ||
| 18 | * it under the terms of the GNU General Public License as published by | ||
| 19 | * the Free Software Foundation, either version 3 of the License, or | ||
| 20 | * (at your option) any later version. | ||
| 21 | * | ||
| 22 | * This program is distributed in the hope that it will be useful, | ||
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 25 | * GNU General Public License for more details. | ||
| 26 | * | ||
| 27 | * You should have received a copy of the GNU General Public License | ||
| 28 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 29 | * | ||
| 30 | * ***************************************************************************** | ||
| 31 | * This specific code is a port to C++ of the Envemind Python code by Radzinski | ||
| 32 | * and colleagues of IsoSpec fame (Lacki, Startek and company :-) | ||
| 33 | * | ||
| 34 | * See https://github.com/PiotrRadzinski/envemind. | ||
| 35 | * ***************************************************************************** | ||
| 36 | * | ||
| 37 | * END software license | ||
| 38 | */ | ||
| 39 | |||
| 40 | |||
| 41 | #include <QDebug> | ||
| 42 | |||
| 43 | |||
| 44 | #include <pappsomspp/trace/datapoint.h> | ||
| 45 | |||
| 46 | |||
| 47 | #include "Envemind.hpp" | ||
| 48 | |||
| 49 | |||
| 50 | namespace MsXpS | ||
| 51 | { | ||
| 52 | namespace libXpertMass | ||
| 53 | { | ||
| 54 | |||
| 55 | |||
| 56 | ✗ | Envemind::Envemind() | |
| 57 | { | ||
| 58 | ✗ | } | |
| 59 | |||
| 60 | |||
| 61 | ✗ | Envemind::Envemind(const pappso::Trace &trace) : m_trace(trace) | |
| 62 | { | ||
| 63 | ✗ | } | |
| 64 | |||
| 65 | |||
| 66 | ✗ | Envemind::Envemind(const Envemind &other) | |
| 67 | { | ||
| 68 | ✗ | m_trace = other.m_trace; | |
| 69 | ✗ | } | |
| 70 | |||
| 71 | |||
| 72 | ✗ | Envemind::~Envemind() | |
| 73 | { | ||
| 74 | ✗ | } | |
| 75 | |||
| 76 | |||
| 77 | Envemind & | ||
| 78 | ✗ | Envemind::operator=(const Envemind &other) | |
| 79 | { | ||
| 80 | ✗ | m_trace = other.m_trace; | |
| 81 | |||
| 82 | ✗ | return *this; | |
| 83 | } | ||
| 84 | |||
| 85 | |||
| 86 | double | ||
| 87 | ✗ | Envemind::monoIsotopicMassPrediction() | |
| 88 | { | ||
| 89 | ✗ | double mass = 0.0; | |
| 90 | |||
| 91 | ✗ | return mass; | |
| 92 | } | ||
| 93 | |||
| 94 | |||
| 95 | double | ||
| 96 | ✗ | Envemind::getMostAbundant(bool *ok) | |
| 97 | { | ||
| 98 | ✗ | if(ok == nullptr) | |
| 99 | ✗ | qFatal("Pointer cannot be nullptr."); | |
| 100 | |||
| 101 | ✗ | if(!m_trace.size()) | |
| 102 | { | ||
| 103 | ✗ | *ok = false; | |
| 104 | ✗ | return 0.0; | |
| 105 | } | ||
| 106 | |||
| 107 | std::vector<pappso::DataPoint>::iterator iter = | ||
| 108 | ✗ | maxYDataPoint(m_trace.begin(), m_trace.end()); | |
| 109 | |||
| 110 | ✗ | if(iter == m_trace.end()) | |
| 111 | ✗ | qFatal("Failed to find the most intense data point."); | |
| 112 | |||
| 113 | ✗ | return iter->x; | |
| 114 | } | ||
| 115 | |||
| 116 | |||
| 117 | } // namespace libXpertMass | ||
| 118 | |||
| 119 | } // namespace MsXpS | ||
| 120 |