libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
peptideobservation.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/masschroq/peptideobservation.cpp
3
* \date 24/09/2024
4
* \author Olivier Langella
5
* \brief peptide model in masschroqlite
6
*/
7
8
/*******************************************************************************
9
* Copyright (c) 2024 Olivier Langella
10
*<Olivier.Langella@universite-paris-saclay.fr>.
11
*
12
* This file is part of MassChroQ.
13
*
14
* MassChroQ 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
* MassChroQ 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 MassChroQ. If not, see <http://www.gnu.org/licenses/>.
26
*
27
******************************************************************************/
28
29
30
#include "
peptideobservation.h
"
31
#include "
pappsomspp/core/pappsoexception.h
"
32
33
34
pappso::masschroq::PeptideObservation::PeptideObservation
(
pappso::masschroq::PeptideSp
peptide)
35
:
msp_peptide
(peptide)
36
{
37
}
38
39
40
pappso::masschroq::PeptideObservation::PeptideObservation
(
const
PeptideObservation
&other)
41
:
msp_peptide
(other.
msp_peptide
)
42
{
43
m_observationList
= other.
m_observationList
;
44
}
45
46
pappso::masschroq::PeptideObservation::~PeptideObservation
()
47
{
48
}
49
50
void
51
pappso::masschroq::PeptideObservation::addObservation
(
52
const
pappso::masschroq::PeptideObservation::Observation
&observation)
53
{
54
m_observationList
.push_back(observation);
55
}
56
std::vector<std::uint8_t>
57
pappso::masschroq::PeptideObservation::getObservedChargeStates
()
const
58
{
59
std::vector<std::uint8_t> charge_list;
60
for
(
auto
&observation :
m_observationList
)
61
{
62
charge_list.push_back(observation.m_charge);
63
}
64
std::sort(charge_list.begin(), charge_list.end());
65
66
charge_list.erase(std::unique(charge_list.begin(), charge_list.end()), charge_list.end());
67
return
charge_list;
68
}
69
70
const
pappso::masschroq::PeptideSp
&
71
pappso::masschroq::PeptideObservation::getPeptideSp
()
const
72
{
73
return
msp_peptide
;
74
}
75
76
double
77
pappso::masschroq::PeptideObservation::getBestRtOverallChargeStates
()
const
78
{
79
double
best_rt = 0;
80
double
intensity = -1;
81
for
(
auto
&observation :
m_observationList
)
82
{
83
if
(observation.msp_precursor.get()->getIntensity() > intensity)
84
{
85
best_rt = observation.msp_precursor.get()->getXicCoordSPtr().get()->rtTarget;
86
intensity = observation.msp_precursor.get()->getIntensity();
87
}
88
}
89
90
return
best_rt;
91
}
92
93
pappso::XicCoordSPtr
94
pappso::masschroq::PeptideObservation::getBestXicCoordSPtrForCharge
(std::uint8_t charge)
const
95
{
96
97
// get XIC coordinates of the most intense precursor
98
pappso::pappso_double
intensity = -1;
99
pappso::XicCoordSPtr
best_xic_coord;
100
101
for
(
auto
&observation :
m_observationList
)
102
{
103
if
(observation.m_charge == charge)
104
{
105
if
(observation.msp_precursor.get()->getIntensity() > intensity)
106
{
107
intensity = observation.msp_precursor.get()->getIntensity();
108
best_xic_coord = observation.msp_precursor.get()->getXicCoordSPtr();
109
qDebug();
110
}
111
}
112
}
113
return
best_xic_coord;
114
}
115
116
pappso::XicCoordSPtr
117
pappso::masschroq::PeptideObservation::getBestXicCoord
()
const
118
{
119
120
// get XIC coordinates of the most intense precursor
121
pappso::pappso_double
intensity = -1;
122
pappso::XicCoordSPtr
best_xic_coord;
123
124
for
(
auto
&observation :
m_observationList
)
125
{
126
if
(observation.msp_precursor.get()->getIntensity() > intensity)
127
{
128
intensity = observation.msp_precursor.get()->getIntensity();
129
best_xic_coord = observation.msp_precursor.get()->getXicCoordSPtr();
130
qDebug();
131
}
132
}
133
return
best_xic_coord;
134
}
135
136
137
std::vector<double>
138
pappso::masschroq::PeptideObservation::getObservedRetentionTimesOverallChargeStates
()
const
139
{
140
std::vector<double> rt_list;
141
for
(
auto
&observation :
m_observationList
)
142
{
143
rt_list.push_back(observation.msp_precursor.get()->getXicCoordSPtr().get()->rtTarget);
144
}
145
146
return
rt_list;
147
}
148
149
const
std::vector<pappso::masschroq::PeptideObservation::Observation> &
150
pappso::masschroq::PeptideObservation::getObservationList
()
const
151
{
152
return
m_observationList
;
153
}
pappso::masschroq::PeptideObservation::getObservationList
const std::vector< Observation > & getObservationList() const
Definition
peptideobservation.cpp:150
pappso::masschroq::PeptideObservation::getBestXicCoord
pappso::XicCoordSPtr getBestXicCoord() const
Definition
peptideobservation.cpp:117
pappso::masschroq::PeptideObservation::~PeptideObservation
virtual ~PeptideObservation()
Definition
peptideobservation.cpp:46
pappso::masschroq::PeptideObservation::getObservedRetentionTimesOverallChargeStates
std::vector< double > getObservedRetentionTimesOverallChargeStates() const
Definition
peptideobservation.cpp:138
pappso::masschroq::PeptideObservation::addObservation
void addObservation(const PeptideObservation::Observation &observation)
Definition
peptideobservation.cpp:51
pappso::masschroq::PeptideObservation::getObservedChargeStates
std::vector< std::uint8_t > getObservedChargeStates() const
Definition
peptideobservation.cpp:57
pappso::masschroq::PeptideObservation::m_observationList
std::vector< Observation > m_observationList
Definition
peptideobservation.h:99
pappso::masschroq::PeptideObservation::getBestRtOverallChargeStates
double getBestRtOverallChargeStates() const
Definition
peptideobservation.cpp:77
pappso::masschroq::PeptideObservation::getPeptideSp
const PeptideSp & getPeptideSp() const
Definition
peptideobservation.cpp:71
pappso::masschroq::PeptideObservation::getBestXicCoordSPtrForCharge
pappso::XicCoordSPtr getBestXicCoordSPtrForCharge(std::uint8_t charge) const
Definition
peptideobservation.cpp:94
pappso::masschroq::PeptideObservation::PeptideObservation
PeptideObservation(PeptideSp peptide)
Definition
peptideobservation.cpp:34
pappso::masschroq::PeptideObservation::msp_peptide
PeptideSp msp_peptide
Definition
peptideobservation.h:98
pappso::masschroq::PeptideSp
std::shared_ptr< Peptide > PeptideSp
Definition
peptide.h:46
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition
types.h:60
pappso::XicCoordSPtr
std::shared_ptr< XicCoord > XicCoordSPtr
Definition
xiccoord.h:44
pappsoexception.h
peptideobservation.h
pappso::masschroq::PeptideObservation::Observation
Definition
peptideobservation.h:70
pappsomspp
core
masschroq
peptideobservation.cpp
Generated on
for libpappsomspp by
1.17.0