libpappsomspp
Library for mass spectrometry
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
31
32using namespace pappso;
33
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());
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
91}
92
93
97
pappso::pappso_double getIonIsotopeRatioScore() const
IonIsotopeRatioScore(const MassSpectrum &spectrum, const PeptideSp &peptide_sp, unsigned int parent_charge, PrecisionPtr precision, std::vector< Enums::PeptideIon > ion_list)
pappso::pappso_double m_ionIsotopeRatioScore
double getCoefficientOfDetermination() const
get Coefficient of determination (R2)
Class to represent a mass spectrum.
const std::list< PeakIonIsotopeMatch > & getPeakIonIsotopeMatchList() const
unsigned int size() const override
Definition peptide.cpp:217
A simple container of DataPoint instances.
Definition trace.h:152
void sortX(Enums::SortOrder sort_order=Enums::SortOrder::ascending)
Definition trace.cpp:1071
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter).
Definition types.h:286
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::shared_ptr< const Peptide > PeptideSp
double pappso_double
A type definition for doubles.
Definition types.h:60
std::shared_ptr< const PeptideNaturalIsotopeAverage > PeptideNaturalIsotopeAverageSp
const PrecisionBase * PrecisionPtr
Definition precision.h:122