libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
ionisotoperatioscore.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/psm/experimental/ionisotoperatioscore.cpp
3
* \date 18/05/2019
4
* \author Olivier Langella
5
* \brief psm score computed using ion isotopes
6
*/
7
8
/*******************************************************************************
9
* Copyright (c) 2019 Olivier Langella <Olivier.Langella@u-psud.fr>.
10
*
11
* This file is part of the PAPPSOms++ library.
12
*
13
* PAPPSOms++ is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation, either version 3 of the License, or
16
* (at your option) any later version.
17
*
18
* PAPPSOms++ is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
22
*
23
* You should have received a copy of the GNU General Public License
24
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25
*
26
******************************************************************************/
27
28
#include "
ionisotoperatioscore.h
"
29
#include "
../peptideisotopespectrummatch.h
"
30
#include "
../../trace/linearregression.h
"
31
32
using namespace
pappso
;
33
34
IonIsotopeRatioScore::IonIsotopeRatioScore
(
const
MassSpectrum
&spectrum,
35
const
PeptideSp
&peptide_sp,
36
unsigned
int
parent_charge,
37
PrecisionPtr
precision,
38
std::vector<Enums::PeptideIon> ion_vector)
39
{
40
std::list<Enums::PeptideIon> ion_list(ion_vector.begin(), ion_vector.end());
41
PeptideIsotopeSpectrumMatch
psm_match(
42
spectrum, peptide_sp, parent_charge, precision, ion_list, 1, 1);
43
44
Trace
scaterplot;
45
46
for
(
Enums::PeptideIon
ion_type : ion_vector)
47
{
48
std::vector<double> mono_th_intensities(peptide_sp.get()->
size
(), 0);
49
std::vector<double> isotope_th_intensities(peptide_sp.get()->
size
(), 0);
50
51
std::vector<double> mono_exp_intensities(peptide_sp.get()->
size
(), 0);
52
std::vector<double> isotope_exp_intensities(peptide_sp.get()->
size
(), 0);
53
for
(
const
PeakIonIsotopeMatch
&peak_ion_match : psm_match.
getPeakIonIsotopeMatchList
())
54
{
55
if
(peak_ion_match.getPeptideIonType() == ion_type)
56
{
57
std::size_t vector_position =
58
peak_ion_match.getPeptideFragmentIonSp().get()->size() - 1;
59
PeptideNaturalIsotopeAverageSp
iso_average_sp =
60
peak_ion_match.getPeptideNaturalIsotopeAverageSp();
61
if
(iso_average_sp.get()->
getIsotopeNumber
() == 0)
62
{
63
mono_th_intensities[vector_position] = iso_average_sp.get()->
getIntensityRatio
();
64
mono_exp_intensities[vector_position] = peak_ion_match.getPeak().y;
65
}
66
else
if
(iso_average_sp.get()->
getIsotopeNumber
() == 1)
67
{
68
isotope_th_intensities[vector_position] =
69
iso_average_sp.get()->
getIntensityRatio
();
70
isotope_exp_intensities[vector_position] = peak_ion_match.getPeak().y;
71
}
72
}
73
}
74
75
for
(std::size_t i = 0; i < mono_th_intensities.size(); i++)
76
{
77
if
((mono_th_intensities[i] != 0) && (isotope_th_intensities[i] != 0))
78
{
79
DataPoint
xy(mono_th_intensities[i] / isotope_th_intensities[i],
80
mono_exp_intensities[i] / isotope_exp_intensities[i]);
81
scaterplot.push_back(xy);
82
}
83
}
84
}
85
86
scaterplot.
sortX
();
87
88
LinearRegression
linear_regression(scaterplot);
89
90
m_ionIsotopeRatioScore
= linear_regression.
getCoefficientOfDetermination
();
91
}
92
93
94
IonIsotopeRatioScore::~IonIsotopeRatioScore
()
95
{
96
}
97
98
pappso::pappso_double
99
IonIsotopeRatioScore::getIonIsotopeRatioScore
()
const
100
{
101
return
m_ionIsotopeRatioScore
;
102
}
pappso::IonIsotopeRatioScore::getIonIsotopeRatioScore
pappso::pappso_double getIonIsotopeRatioScore() const
Definition
ionisotoperatioscore.cpp:99
pappso::IonIsotopeRatioScore::IonIsotopeRatioScore
IonIsotopeRatioScore(const MassSpectrum &spectrum, const PeptideSp &peptide_sp, unsigned int parent_charge, PrecisionPtr precision, std::vector< Enums::PeptideIon > ion_list)
Definition
ionisotoperatioscore.cpp:34
pappso::IonIsotopeRatioScore::m_ionIsotopeRatioScore
pappso::pappso_double m_ionIsotopeRatioScore
Definition
ionisotoperatioscore.h:49
pappso::IonIsotopeRatioScore::~IonIsotopeRatioScore
virtual ~IonIsotopeRatioScore()
Definition
ionisotoperatioscore.cpp:94
pappso::LinearRegression
Definition
linearregression.h:33
pappso::LinearRegression::getCoefficientOfDetermination
double getCoefficientOfDetermination() const
get Coefficient of determination (R2)
Definition
linearregression.cpp:115
pappso::MassSpectrum
Class to represent a mass spectrum.
Definition
massspectrum.h:70
pappso::PeakIonIsotopeMatch
Definition
peakionisotopematch.h:47
pappso::PeptideIsotopeSpectrumMatch
Definition
peptideisotopespectrummatch.h:40
pappso::PeptideIsotopeSpectrumMatch::getPeakIonIsotopeMatchList
const std::list< PeakIonIsotopeMatch > & getPeakIonIsotopeMatchList() const
Definition
peptideisotopespectrummatch.cpp:223
pappso::PeptideNaturalIsotopeAverage::getIntensityRatio
pappso_double getIntensityRatio() const
Definition
peptidenaturalisotopeaverage.cpp:198
pappso::PeptideNaturalIsotopeAverage::getIsotopeNumber
unsigned int getIsotopeNumber() const
Definition
peptidenaturalisotopeaverage.cpp:210
pappso::Peptide::size
unsigned int size() const override
Definition
peptide.cpp:217
pappso::Trace
A simple container of DataPoint instances.
Definition
trace.h:152
pappso::Trace::sortX
void sortX(Enums::SortOrder sort_order=Enums::SortOrder::ascending)
Definition
trace.cpp:1070
ionisotoperatioscore.h
linearregression.h
pappso::Enums::PeptideIon
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter).
Definition
types.h:272
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::PeptideSp
std::shared_ptr< const Peptide > PeptideSp
Definition
aamodification.h:48
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition
types.h:60
pappso::PeptideNaturalIsotopeAverageSp
std::shared_ptr< const PeptideNaturalIsotopeAverage > PeptideNaturalIsotopeAverageSp
Definition
peptidenaturalisotopeaverage.h:40
pappso::PrecisionPtr
const PrecisionBase * PrecisionPtr
Definition
precision.h:122
peptideisotopespectrummatch.h
pappso::DataPoint
Definition
datapoint.h:22
pappsomspp
core
psm
experimental
ionisotoperatioscore.cpp
Generated on
for libpappsomspp by
1.17.0