Loading...
Searching...
No Matches
ionisotoperatioscore.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/psm/experimental/ionisotoperatioscore.cpp
* \date 18/05/2019
* \author Olivier Langella
* \brief psm score computed using ion isotopes
*/
/*******************************************************************************
* Copyright (c) 2019 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/>.
*
******************************************************************************/
#include "ionisotoperatioscore.h"
#include "../peptideisotopespectrummatch.h"
#include "../../trace/linearregression.h"
using namespace pappso;
IonIsotopeRatioScore::IonIsotopeRatioScore(const MassSpectrum &spectrum,
const PeptideSp &peptide_sp,
unsigned int parent_charge,
PrecisionPtr precision,
std::vector<PeptideIon> ion_vector)
{
std::list<PeptideIon> ion_list(ion_vector.begin(), ion_vector.end());
PeptideIsotopeSpectrumMatch psm_match(
spectrum, peptide_sp, parent_charge, precision, ion_list, 1, 1);
Trace scaterplot;
for(PeptideIon ion_type : ion_vector)
{
std::vector<double> mono_th_intensities(peptide_sp.get()->size(), 0);
std::vector<double> isotope_th_intensities(peptide_sp.get()->size(), 0);
std::vector<double> mono_exp_intensities(peptide_sp.get()->size(), 0);
std::vector<double> isotope_exp_intensities(peptide_sp.get()->size(), 0);
for(const PeakIonIsotopeMatch &peak_ion_match :
psm_match.getPeakIonIsotopeMatchList())
{
if(peak_ion_match.getPeptideIonType() == ion_type)
{
std::size_t vector_position =
peak_ion_match.getPeptideFragmentIonSp().get()->size() - 1;
PeptideNaturalIsotopeAverageSp iso_average_sp =
peak_ion_match.getPeptideNaturalIsotopeAverageSp();
if(iso_average_sp.get()->getIsotopeNumber() == 0)
{
mono_th_intensities[vector_position] =
iso_average_sp.get()->getIntensityRatio();
mono_exp_intensities[vector_position] =
peak_ion_match.getPeak().y;
}
else if(iso_average_sp.get()->getIsotopeNumber() == 1)
{
isotope_th_intensities[vector_position] =
iso_average_sp.get()->getIntensityRatio();
isotope_exp_intensities[vector_position] =
peak_ion_match.getPeak().y;
}
}
}
for(std::size_t i = 0; i < mono_th_intensities.size(); i++)
{
if((mono_th_intensities[i] != 0) && (isotope_th_intensities[i] != 0))
{
DataPoint xy(mono_th_intensities[i] / isotope_th_intensities[i],
mono_exp_intensities[i] /
isotope_exp_intensities[i]);
scaterplot.push_back(xy);
}
}
}
scaterplot.sortX();
LinearRegression linear_regression(scaterplot);
m_ionIsotopeRatioScore = linear_regression.getCoefficientOfDetermination();
}
IonIsotopeRatioScore::~IonIsotopeRatioScore()
{
}
pappso::pappso_double
IonIsotopeRatioScore::getIonIsotopeRatioScore() const
{
return m_ionIsotopeRatioScore;
}
pappso::IonIsotopeRatioScore::getIonIsotopeRatioScore
pappso::pappso_double getIonIsotopeRatioScore() const
Definition ionisotoperatioscore.cpp:104
pappso::IonIsotopeRatioScore::IonIsotopeRatioScore
IonIsotopeRatioScore(const MassSpectrum &spectrum, const PeptideSp &peptide_sp, unsigned int parent_charge, PrecisionPtr precision, std::vector< 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:99
pappso::LinearRegression
Definition linearregression.h:33
pappso::LinearRegression::getCoefficientOfDetermination
double getCoefficientOfDetermination() const
get Coefficient of determination (R2)
Definition linearregression.cpp:120
pappso::MassSpectrum
Class to represent a mass spectrum.
Definition massspectrum.h:73
pappso::PeakIonIsotopeMatch
Definition peakionisotopematch.h:47
pappso::PeptideIsotopeSpectrumMatch
Definition peptideisotopespectrummatch.h:40
pappso::PeptideIsotopeSpectrumMatch::getPeakIonIsotopeMatchList
const std::list< PeakIonIsotopeMatch > & getPeakIonIsotopeMatchList() const
Definition peptideisotopespectrummatch.cpp:230
pappso::PrecisionBase
Definition precision.h:44
pappso::Trace
A simple container of DataPoint instances.
Definition trace.h:148
pappso::Trace::sortX
void sortX(SortOrder sort_order=SortOrder::ascending)
Definition trace.cpp:1086
ionisotoperatioscore.h
psm score computed using ion isotopes
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::PeptideIon
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
Definition types.h:432
pappso::MsDataFormat::xy
@ xy
(x,y) format
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:50
pappso::PeptideNaturalIsotopeAverageSp
std::shared_ptr< const PeptideNaturalIsotopeAverage > PeptideNaturalIsotopeAverageSp
Definition peptidenaturalisotopeaverage.h:40
pappso::DataPoint
Definition datapoint.h:22