Loading...
Searching...
No Matches
qualifiedmassspectrum.h
Go to the documentation of this file.
/*******************************************************************************
* Copyright (c) 2015 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of the PAPPSOms++ library.
*
* PAPPSOms++ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms++ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
/////////////////////// StdLib includes
#include <memory>
/////////////////////// Qt includes
/////////////////////// Local includes
#include "pappsomspp/export-import-config.h"
#include "pappsomspp/core/types.h"
#include "massspectrum.h"
#include "massspectrumid.h"
namespace pappso
{
// Forward declaration.
class QualifiedMassSpectrum;
typedef std::shared_ptr<QualifiedMassSpectrum> QualifiedMassSpectrumSPtr;
typedef std::shared_ptr<const QualifiedMassSpectrum>
QualifiedMassSpectrumCstSPtr;
enum class QualifiedMassSpectrumParameter
{
IonMobOneOverK0, ///< 1/kO value
IonMobOneOverK0Begin, ///< 1/K0 range's begin value
IonMobOneOverK0End, ///< 1/K0 range's end value
TimsIonMobScanIndex,
TimsFrameIonMobScanIndexBegin,
TimsFrameIonMobScanIndexEnd,
IsolationMz, ///< Isolation m/z value
IsolationMzWidth, ///< m/z isolation window width (left + right)
CollisionEnergy, ///< Bruker's timsTOF collision energy
BrukerPrecursorIndex, ///< Bruker's timsTOF precursor index
TimsFrameScansCount, ///< Bruker's timsTOF frame's total ion mobility slots
TimsFrameMzIndexBegin, ///< Bruker's timsTOF mz index frame start range
TimsFrameMzIndexEnd, ///< Bruker's timsTOF mz index frame end range
ScanNumber, ///< Scan number: Ordinal number of the scan indicating its order
///< of acquisition within a mass spectrometry acquisition run.
///< MS_scan_number = 1003057,
last
};
struct PrecursorIonData
{
double mz = 0;
int charge = 0;
double intensity = 0;
// Constructor
PrecursorIonData(double mz_value = 0,
int charge_value = 0,
double intensity_value = 0)
{
mz = mz_value;
charge = charge_value;
intensity = intensity_value;
};
};
//! Class representing a fully specified mass spectrum.
/*!
* The member data that qualify the MassSpectrum \c msp_massSpectrum member
* allow to unambiguously characterize the mass spectrum.
* \sa MassSpectrum
*/
class PMSPP_LIB_DECL QualifiedMassSpectrum
{
public:
QualifiedMassSpectrum();
QualifiedMassSpectrum(const MassSpectrumId &id);
QualifiedMassSpectrum(MassSpectrumSPtr mass_spectrum_SPtr);
QualifiedMassSpectrum(const QualifiedMassSpectrum &other);
~QualifiedMassSpectrum();
QualifiedMassSpectrum &operator=(const QualifiedMassSpectrum &other);
/** @brief clone the mass spectrum contained in Qualified Mass Spectrum
*/
const QualifiedMassSpectrum &cloneMassSpectrumSPtr();
QualifiedMassSpectrumSPtr makeQualifiedMassSpectrumSPtr() const;
QualifiedMassSpectrumCstSPtr makeQualifiedMassSpectrumCstSPtr() const;
void setMassSpectrumSPtr(MassSpectrumSPtr massSpectrum);
MassSpectrumSPtr getMassSpectrumSPtr() const;
MassSpectrumCstSPtr getMassSpectrumCstSPtr() const;
void setMassSpectrumId(const MassSpectrumId &iD);
const MassSpectrumId &getMassSpectrumId() const;
MassSpectrumId &getMassSpectrumId();
void setEmptyMassSpectrum(bool is_empty_mass_spectrum);
bool isEmptyMassSpectrum() const;
void setMsLevel(uint ms_level);
uint getMsLevel() const;
void setRtInSeconds(pappso_double rt);
pappso_double getRtInSeconds() const;
pappso_double getRtInMinutes() const;
void setDtInMilliSeconds(pappso_double rt);
pappso_double getDtInMilliSeconds() const;
/** @brief get precursor mz
* @param ok pointer on boolean, false if precursor mz is not defined
* @return precursor mz
*/
pappso_double getPrecursorMz(bool *ok = nullptr) const;
/** @brief get precursor mass given the charge stats and precursor mz
* @param ok pointer on boolean, false if precursor mz is not defined
* @return precursor mass (neutral mass without H+)
*/
double getPrecursorMass(bool *ok_p = nullptr) const;
QString getPrecursorDataMzValuesAsString(
const std::vector<PrecursorIonData> &precursor_ion_data_vector,
const QString &separator = "\n") const;
QString
getPrecursorDataMzValuesAsString(const QString &separator = "\n") const;
QString getMzSortedPrecursorDataMzValuesAsString(
const QString &separator = "\n") const;
/** @brief get precursor charge
* @param ok pointer on boolean, false if precursor charge is not defined
* @return precursor charge
*/
uint getPrecursorCharge(bool *ok = nullptr) const;
QString getPrecursorDataChargeValuesAsString(
const std::vector<PrecursorIonData> &precursor_ion_data_vector,
const QString &separator = "\n") const;
QString
getPrecursorDataChargeValuesAsString(const QString &separator = "\n") const;
QString getMzSortedPrecursorDataChargeValuesAsString(
const QString &separator = "\n") const;
/** @brief get precursor intensity
* @param ok pointer on boolean, false if precursor intensity is not defined
* @return precursor intensity
*/
pappso_double getPrecursorIntensity(bool *ok = nullptr) const;
void setPrecursorSpectrumIndex(std::size_t precursor_scan_num);
std::size_t getPrecursorSpectrumIndex() const;
void setPrecursorNativeId(const QString &native_id);
const QString &getPrecursorNativeId() const;
void appendPrecursorIonData(const PrecursorIonData &precursor_ion_data);
const std::vector<PrecursorIonData> &getPrecursorIonData() const;
std::vector<PrecursorIonData> getPrecursorIonDataSortedWithMz() const;
void setParameterValue(QualifiedMassSpectrumParameter parameter,
const QVariant &value);
const QVariant
getParameterValue(QualifiedMassSpectrumParameter parameter) const;
std::size_t size() const;
QString toString(bool with_data = false) const;
protected:
//! Shared pointer to the mass spectrum.
MassSpectrumSPtr msp_massSpectrum = nullptr;
//! Id of the mass spectrum.
MassSpectrumId m_massSpectrumId;
bool m_isEmptyMassSpectrum = false;
//! Mass spectrometry level of this mass spectrum.
unsigned int m_msLevel = 0;
//! Retention time (in seconds) at which this mass spectrum was acquired.
pappso_double m_rt = -1;
//! Drift time (in milliseconds) at which this mass spectrum was acquired.
pappso_double m_dt = -1;
//! Index of the spectrum of the precusor ion that was fragmented to yield
// this mass spectrum.
std::size_t m_precursorSpectrumIndex =
std::numeric_limits<std::size_t>::max();
//! Native XML id of the spectrum relative to the mz data native file
QString m_precursorNativeId;
//! vector of precursor ion data of the precursors that were fragmented to
//! yield this mass spectrum.
std::vector<PrecursorIonData> m_precursorIonData;
//! map containing any parameter value for this spectrum
std::map<QualifiedMassSpectrumParameter, QVariant> m_paramsMap;
};
} // namespace pappso
pappso::MassSpectrumId
Definition massspectrumid.h:41
pappso::QualifiedMassSpectrum
Class representing a fully specified mass spectrum.
Definition qualifiedmassspectrum.h:99
pappso::QualifiedMassSpectrum::getMsLevel
uint getMsLevel() const
Get the mass spectrum level.
Definition qualifiedmassspectrum.cpp:189
pappso::QualifiedMassSpectrum::operator=
QualifiedMassSpectrum & operator=(const QualifiedMassSpectrum &other)
Definition qualifiedmassspectrum.cpp:81
pappso::QualifiedMassSpectrum::getMassSpectrumCstSPtr
MassSpectrumCstSPtr getMassSpectrumCstSPtr() const
Get the MassSpectrumCstSPtr.
Definition qualifiedmassspectrum.cpp:138
pappso::QualifiedMassSpectrum::m_isEmptyMassSpectrum
bool m_isEmptyMassSpectrum
Definition qualifiedmassspectrum.h:203
pappso::QualifiedMassSpectrum::m_precursorIonData
std::vector< PrecursorIonData > m_precursorIonData
vector of precursor ion data of the precursors that were fragmented to yield this mass spectrum.
Definition qualifiedmassspectrum.h:224
pappso::QualifiedMassSpectrum::getPrecursorIonDataSortedWithMz
std::vector< PrecursorIonData > getPrecursorIonDataSortedWithMz() const
Definition qualifiedmassspectrum.cpp:457
pappso::QualifiedMassSpectrum::setPrecursorNativeId
void setPrecursorNativeId(const QString &native_id)
Set the scan native id of the precursor ion.
Definition qualifiedmassspectrum.cpp:430
pappso::QualifiedMassSpectrum::m_precursorSpectrumIndex
std::size_t m_precursorSpectrumIndex
Index of the spectrum of the precusor ion that was fragmented to yield.
Definition qualifiedmassspectrum.h:216
pappso::QualifiedMassSpectrum::getDtInMilliSeconds
pappso_double getDtInMilliSeconds() const
Get the drift time in milliseconds.
Definition qualifiedmassspectrum.cpp:232
pappso::QualifiedMassSpectrum::getPrecursorIonData
const std::vector< PrecursorIonData > & getPrecursorIonData() const
Definition qualifiedmassspectrum.cpp:450
pappso::QualifiedMassSpectrum::getPrecursorCharge
uint getPrecursorCharge(bool *ok=nullptr) const
get precursor charge
Definition qualifiedmassspectrum.cpp:336
pappso::QualifiedMassSpectrum::getRtInMinutes
pappso_double getRtInMinutes() const
Get the retention time in minutes.
Definition qualifiedmassspectrum.cpp:213
pappso::QualifiedMassSpectrum::m_msLevel
unsigned int m_msLevel
Mass spectrometry level of this mass spectrum.
Definition qualifiedmassspectrum.h:206
pappso::QualifiedMassSpectrum::setDtInMilliSeconds
void setDtInMilliSeconds(pappso_double rt)
Set the drift time in milliseconds.
Definition qualifiedmassspectrum.cpp:221
pappso::QualifiedMassSpectrum::getPrecursorNativeId
const QString & getPrecursorNativeId() const
Definition qualifiedmassspectrum.cpp:436
pappso::QualifiedMassSpectrum::m_rt
pappso_double m_rt
Retention time (in seconds) at which this mass spectrum was acquired.
Definition qualifiedmassspectrum.h:209
pappso::QualifiedMassSpectrum::m_dt
pappso_double m_dt
Drift time (in milliseconds) at which this mass spectrum was acquired.
Definition qualifiedmassspectrum.h:212
pappso::QualifiedMassSpectrum::getPrecursorIntensity
pappso_double getPrecursorIntensity(bool *ok=nullptr) const
get precursor intensity
Definition qualifiedmassspectrum.cpp:396
pappso::QualifiedMassSpectrum::getPrecursorMass
double getPrecursorMass(bool *ok_p=nullptr) const
get precursor mass given the charge stats and precursor mz
Definition qualifiedmassspectrum.cpp:260
pappso::QualifiedMassSpectrum::toString
QString toString(bool with_data=false) const
Definition qualifiedmassspectrum.cpp:513
pappso::QualifiedMassSpectrum::appendPrecursorIonData
void appendPrecursorIonData(const PrecursorIonData &precursor_ion_data)
Definition qualifiedmassspectrum.cpp:443
pappso::QualifiedMassSpectrum::m_paramsMap
std::map< QualifiedMassSpectrumParameter, QVariant > m_paramsMap
map containing any parameter value for this spectrum
Definition qualifiedmassspectrum.h:227
pappso::QualifiedMassSpectrum::msp_massSpectrum
MassSpectrumSPtr msp_massSpectrum
Shared pointer to the mass spectrum.
Definition qualifiedmassspectrum.h:198
pappso::QualifiedMassSpectrum::getMassSpectrumId
const MassSpectrumId & getMassSpectrumId() const
Get the MassSpectrumId.
Definition qualifiedmassspectrum.cpp:154
pappso::QualifiedMassSpectrum::getPrecursorDataChargeValuesAsString
QString getPrecursorDataChargeValuesAsString(const std::vector< PrecursorIonData > &precursor_ion_data_vector, const QString &separator="\n") const
Definition qualifiedmassspectrum.cpp:353
pappso::QualifiedMassSpectrum::setMassSpectrumId
void setMassSpectrumId(const MassSpectrumId &iD)
Set the MassSpectrumId.
Definition qualifiedmassspectrum.cpp:146
pappso::QualifiedMassSpectrum::setMsLevel
void setMsLevel(uint ms_level)
Set the mass spectrum level.
Definition qualifiedmassspectrum.cpp:181
pappso::QualifiedMassSpectrum::setPrecursorSpectrumIndex
void setPrecursorSpectrumIndex(std::size_t precursor_scan_num)
Set the scan number of the precursor ion.
Definition qualifiedmassspectrum.cpp:414
pappso::QualifiedMassSpectrum::getPrecursorDataMzValuesAsString
QString getPrecursorDataMzValuesAsString(const std::vector< PrecursorIonData > &precursor_ion_data_vector, const QString &separator="\n") const
Definition qualifiedmassspectrum.cpp:283
pappso::QualifiedMassSpectrum::makeQualifiedMassSpectrumCstSPtr
QualifiedMassSpectrumCstSPtr makeQualifiedMassSpectrumCstSPtr() const
Definition qualifiedmassspectrum.cpp:114
pappso::QualifiedMassSpectrum::isEmptyMassSpectrum
bool isEmptyMassSpectrum() const
Definition qualifiedmassspectrum.cpp:173
pappso::QualifiedMassSpectrum::getPrecursorMz
pappso_double getPrecursorMz(bool *ok=nullptr) const
get precursor mz
Definition qualifiedmassspectrum.cpp:240
pappso::QualifiedMassSpectrum::cloneMassSpectrumSPtr
const QualifiedMassSpectrum & cloneMassSpectrumSPtr()
clone the mass spectrum contained in Qualified Mass Spectrum
Definition qualifiedmassspectrum.cpp:99
pappso::QualifiedMassSpectrum::getMzSortedPrecursorDataMzValuesAsString
QString getMzSortedPrecursorDataMzValuesAsString(const QString &separator="\n") const
Definition qualifiedmassspectrum.cpp:323
pappso::QualifiedMassSpectrum::getMassSpectrumSPtr
MassSpectrumSPtr getMassSpectrumSPtr() const
Get the MassSpectrumSPtr.
Definition qualifiedmassspectrum.cpp:130
pappso::QualifiedMassSpectrum::getMzSortedPrecursorDataChargeValuesAsString
QString getMzSortedPrecursorDataChargeValuesAsString(const QString &separator="\n") const
Definition qualifiedmassspectrum.cpp:383
pappso::QualifiedMassSpectrum::m_precursorNativeId
QString m_precursorNativeId
Native XML id of the spectrum relative to the mz data native file.
Definition qualifiedmassspectrum.h:220
pappso::QualifiedMassSpectrum::makeQualifiedMassSpectrumSPtr
QualifiedMassSpectrumSPtr makeQualifiedMassSpectrumSPtr() const
Definition qualifiedmassspectrum.cpp:107
pappso::QualifiedMassSpectrum::m_massSpectrumId
MassSpectrumId m_massSpectrumId
Id of the mass spectrum.
Definition qualifiedmassspectrum.h:201
pappso::QualifiedMassSpectrum::setParameterValue
void setParameterValue(QualifiedMassSpectrumParameter parameter, const QVariant &value)
Definition qualifiedmassspectrum.cpp:472
pappso::QualifiedMassSpectrum::QualifiedMassSpectrum
QualifiedMassSpectrum()
Construct an uninitialized QualifiedMassSpectrum.
Definition qualifiedmassspectrum.cpp:39
pappso::QualifiedMassSpectrum::size
std::size_t size() const
Definition qualifiedmassspectrum.cpp:502
pappso::QualifiedMassSpectrum::setMassSpectrumSPtr
void setMassSpectrumSPtr(MassSpectrumSPtr massSpectrum)
Set the MassSpectrumSPtr.
Definition qualifiedmassspectrum.cpp:122
pappso::QualifiedMassSpectrum::getPrecursorSpectrumIndex
std::size_t getPrecursorSpectrumIndex() const
Get the scan number of the precursor ion.
Definition qualifiedmassspectrum.cpp:422
pappso::QualifiedMassSpectrum::setRtInSeconds
void setRtInSeconds(pappso_double rt)
Set the retention time in seconds.
Definition qualifiedmassspectrum.cpp:197
pappso::QualifiedMassSpectrum::getRtInSeconds
pappso_double getRtInSeconds() const
Get the retention time in seconds.
Definition qualifiedmassspectrum.cpp:205
pappso::QualifiedMassSpectrum::setEmptyMassSpectrum
void setEmptyMassSpectrum(bool is_empty_mass_spectrum)
Definition qualifiedmassspectrum.cpp:166
pappso::QualifiedMassSpectrum::getParameterValue
const QVariant getParameterValue(QualifiedMassSpectrumParameter parameter) const
Definition qualifiedmassspectrum.cpp:487
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
massspectrum.h
massspectrumid.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::QualifiedMassSpectrumSPtr
std::shared_ptr< QualifiedMassSpectrum > QualifiedMassSpectrumSPtr
Definition qualifiedmassspectrum.h:43
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:60
pappso::QualifiedMassSpectrumCstSPtr
std::shared_ptr< const QualifiedMassSpectrum > QualifiedMassSpectrumCstSPtr
Definition qualifiedmassspectrum.h:45
pappso::MassSpectrumCstSPtr
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
Definition massspectrum.h:54
pappso::QualifiedMassSpectrumParameter
QualifiedMassSpectrumParameter
Definition qualifiedmassspectrum.h:48
pappso::QualifiedMassSpectrumParameter::IsolationMzWidth
@ IsolationMzWidth
m/z isolation window width (left + right)
Definition qualifiedmassspectrum.h:59
pappso::QualifiedMassSpectrumParameter::TimsFrameIonMobScanIndexBegin
@ TimsFrameIonMobScanIndexBegin
Definition qualifiedmassspectrum.h:55
pappso::QualifiedMassSpectrumParameter::TimsIonMobScanIndex
@ TimsIonMobScanIndex
Definition qualifiedmassspectrum.h:54
pappso::QualifiedMassSpectrumParameter::ScanNumber
@ ScanNumber
Definition qualifiedmassspectrum.h:68
pappso::QualifiedMassSpectrumParameter::TimsFrameIonMobScanIndexEnd
@ TimsFrameIonMobScanIndexEnd
Definition qualifiedmassspectrum.h:56
pappso::QualifiedMassSpectrumParameter::last
@ last
Definition qualifiedmassspectrum.h:71
pappso::QualifiedMassSpectrumParameter::TimsFrameMzIndexBegin
@ TimsFrameMzIndexBegin
Bruker's timsTOF mz index frame start range.
Definition qualifiedmassspectrum.h:65
pappso::QualifiedMassSpectrumParameter::CollisionEnergy
@ CollisionEnergy
Bruker's timsTOF collision energy.
Definition qualifiedmassspectrum.h:61
pappso::QualifiedMassSpectrumParameter::IonMobOneOverK0Begin
@ IonMobOneOverK0Begin
1/K0 range's begin value
Definition qualifiedmassspectrum.h:51
pappso::QualifiedMassSpectrumParameter::IonMobOneOverK0End
@ IonMobOneOverK0End
1/K0 range's end value
Definition qualifiedmassspectrum.h:52
pappso::QualifiedMassSpectrumParameter::IsolationMz
@ IsolationMz
Isolation m/z value.
Definition qualifiedmassspectrum.h:58
pappso::QualifiedMassSpectrumParameter::TimsFrameScansCount
@ TimsFrameScansCount
Bruker's timsTOF frame's total ion mobility slots.
Definition qualifiedmassspectrum.h:63
pappso::QualifiedMassSpectrumParameter::TimsFrameMzIndexEnd
@ TimsFrameMzIndexEnd
Bruker's timsTOF mz index frame end range.
Definition qualifiedmassspectrum.h:66
pappso::QualifiedMassSpectrumParameter::BrukerPrecursorIndex
@ BrukerPrecursorIndex
Bruker's timsTOF precursor index.
Definition qualifiedmassspectrum.h:62
pappso::QualifiedMassSpectrumParameter::IonMobOneOverK0
@ IonMobOneOverK0
1/kO value
Definition qualifiedmassspectrum.h:50
pappso::uint
unsigned int uint
Definition types.h:67
pappso::MassSpectrumSPtr
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
Definition massspectrum.h:53
pappso::PrecursorIonData
Definition qualifiedmassspectrum.h:75
pappso::PrecursorIonData::PrecursorIonData
PrecursorIonData(double mz_value=0, int charge_value=0, double intensity_value=0)
Definition qualifiedmassspectrum.h:81
pappso::PrecursorIonData::mz
double mz
Definition qualifiedmassspectrum.h:76
pappso::PrecursorIonData::intensity
double intensity
Definition qualifiedmassspectrum.h:78
pappso::PrecursorIonData::charge
int charge
Definition qualifiedmassspectrum.h:77
types.h