libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::PeptideNaturalIsotopeAverage Class Reference

#include <peptidenaturalisotopeaverage.h>

Public Member Functions

 PeptideNaturalIsotopeAverage (const PeptideInterfaceSp &peptide, unsigned int isotopeNumber, unsigned int charge, PrecisionPtr precision)
 fast constructor simple isotope build, not computing isotope ratio
 PeptideNaturalIsotopeAverage (const PeptideInterfaceSp &peptide, unsigned int askedIsotopeRank, unsigned int isotopeLevel, unsigned int charge, PrecisionPtr precision)
 PeptideNaturalIsotopeAverage (const PeptideNaturalIsotopeList &isotopeList, unsigned int askedIsotopeRank, unsigned int isotopeLevel, unsigned int charge, PrecisionPtr precision)
 PeptideNaturalIsotopeAverage (const PeptideNaturalIsotopeAverage &other)
virtual ~PeptideNaturalIsotopeAverage ()
PeptideNaturalIsotopeAverageSp makePeptideNaturalIsotopeAverageSp () const
pappso_double getMz () const
pappso_double getIntensityRatio () const
unsigned int getCharge () const
unsigned int getIsotopeNumber () const
unsigned int getIsotopeRank () const
const std::vector< PeptideNaturalIsotopeSp > & getComponents () const
const PeptideInterfaceSpgetPeptideInterfaceSp () const
PrecisionPtr getPrecision () const
virtual bool matchPeak (pappso_double peak_mz) const final
bool isEmpty () const
virtual QString toString () const

Private Member Functions

void recursiveDepletion (std::vector< PeptideNaturalIsotopeSp > &v_isotope_list, unsigned int rank)

Private Attributes

const PeptideInterfaceSp mcsp_peptideSp
std::vector< PeptideNaturalIsotopeSpm_peptideNaturalIsotopeSpList
pappso_double m_averageMz
pappso_double m_abundanceRatio
unsigned int m_isotopeLevel
unsigned int m_isotopeRank = 1
unsigned int m_z
PrecisionPtr mp_precision = nullptr

Detailed Description

Definition at line 42 of file peptidenaturalisotopeaverage.h.

Constructor & Destructor Documentation

◆ PeptideNaturalIsotopeAverage() [1/4]

pappso::PeptideNaturalIsotopeAverage::PeptideNaturalIsotopeAverage ( const PeptideInterfaceSp & peptide,
unsigned int isotopeNumber,
unsigned int charge,
PrecisionPtr precision )

fast constructor simple isotope build, not computing isotope ratio

Definition at line 34 of file peptidenaturalisotopeaverage.cpp.

38 : mcsp_peptideSp(peptide),
39 m_isotopeLevel(isotopeNumber),
41 m_z(charge),
42 mp_precision(precision)
43{
44
46
47 double diffC13 = ((double)isotopeNumber * DIFFC12C13) / (double)charge;
48
49 m_averageMz = peptide.get()->getMz(charge) + diffC13;
51}
std::vector< PeptideNaturalIsotopeSp > m_peptideNaturalIsotopeSpList
const pappso_double DIFFC12C13(1.0033548378)

References pappso::DIFFC12C13(), getMz(), m_abundanceRatio, m_averageMz, m_isotopeLevel, m_isotopeRank, m_peptideNaturalIsotopeSpList, m_z, mcsp_peptideSp, and mp_precision.

Referenced by PeptideNaturalIsotopeAverage(), and PeptideNaturalIsotopeAverage().

◆ PeptideNaturalIsotopeAverage() [2/4]

pappso::PeptideNaturalIsotopeAverage::PeptideNaturalIsotopeAverage ( const PeptideInterfaceSp & peptide,
unsigned int askedIsotopeRank,
unsigned int isotopeLevel,
unsigned int charge,
PrecisionPtr precision )

Definition at line 53 of file peptidenaturalisotopeaverage.cpp.

59 PeptideNaturalIsotopeList(peptide), askedIsotopeRank, isotopeLevel, charge, precision)
60{
61}
PeptideNaturalIsotopeAverage(const PeptideInterfaceSp &peptide, unsigned int isotopeNumber, unsigned int charge, PrecisionPtr precision)
fast constructor simple isotope build, not computing isotope ratio

References PeptideNaturalIsotopeAverage().

◆ PeptideNaturalIsotopeAverage() [3/4]

pappso::PeptideNaturalIsotopeAverage::PeptideNaturalIsotopeAverage ( const PeptideNaturalIsotopeList & isotopeList,
unsigned int askedIsotopeRank,
unsigned int isotopeLevel,
unsigned int charge,
PrecisionPtr precision )

Definition at line 63 of file peptidenaturalisotopeaverage.cpp.

69 : mcsp_peptideSp(isotopeList.getPeptideInterfaceSp()),
70 m_isotopeLevel(isotope_number),
71 m_isotopeRank(askedIsotopeRank),
72 m_z(charge),
73 mp_precision(precision)
74{ // get the askedIsotopeRank :
75 std::vector<PeptideNaturalIsotopeSp> v_isotope_list(
76 isotopeList.getByIsotopeNumber(isotope_number, m_z));
77
78 qDebug() << "v_isotope_list.size()=" << v_isotope_list.size() << " " << isotope_number << " "
79 << askedIsotopeRank;
81 m_averageMz = 0;
82 if(askedIsotopeRank > v_isotope_list.size())
83 {
84 // there is no isotope at this rank
85 return;
86 // throw PappsoException(QObject::tr("askedIsotopeRank greater than
87 // v_isotope_list.size() %1 vs
88 // %2").arg(askedIsotopeRank).arg(v_isotope_list.size()));
89 }
90 else if(askedIsotopeRank < 1)
91 {
92 throw PappsoException(
93 QObject::tr("askedIsotopeRank must be 1 or more and not %1").arg(askedIsotopeRank));
94 }
95
96 unsigned int rank = 0;
97
98 recursiveDepletion(v_isotope_list, rank);
99
100 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
101}
void recursiveDepletion(std::vector< PeptideNaturalIsotopeSp > &v_isotope_list, unsigned int rank)

References pappso::PeptideNaturalIsotopeList::getByIsotopeNumber(), getPeptideInterfaceSp(), m_abundanceRatio, m_averageMz, m_isotopeLevel, m_isotopeRank, m_z, mcsp_peptideSp, mp_precision, and recursiveDepletion().

◆ PeptideNaturalIsotopeAverage() [4/4]

pappso::PeptideNaturalIsotopeAverage::PeptideNaturalIsotopeAverage ( const PeptideNaturalIsotopeAverage & other)

Definition at line 171 of file peptidenaturalisotopeaverage.cpp.

173 : mcsp_peptideSp(other.mcsp_peptideSp), mp_precision(other.mp_precision)
174{
175
176 qDebug();
177 m_peptideNaturalIsotopeSpList = other.m_peptideNaturalIsotopeSpList;
178
179 m_averageMz = other.m_averageMz;
180 m_abundanceRatio = other.m_abundanceRatio;
181 m_isotopeLevel = other.m_isotopeLevel;
182 m_isotopeRank = other.m_isotopeRank;
183 m_z = other.m_z;
184 qDebug();
185}

References PeptideNaturalIsotopeAverage(), m_abundanceRatio, m_averageMz, m_isotopeLevel, m_isotopeRank, m_peptideNaturalIsotopeSpList, m_z, mcsp_peptideSp, and mp_precision.

◆ ~PeptideNaturalIsotopeAverage()

pappso::PeptideNaturalIsotopeAverage::~PeptideNaturalIsotopeAverage ( )
virtual

Definition at line 187 of file peptidenaturalisotopeaverage.cpp.

188{
189}

Member Function Documentation

◆ getCharge()

unsigned int pappso::PeptideNaturalIsotopeAverage::getCharge ( ) const

Definition at line 204 of file peptidenaturalisotopeaverage.cpp.

205{
206 return m_z;
207}

References m_z.

Referenced by toString().

◆ getComponents()

const std::vector< PeptideNaturalIsotopeSp > & pappso::PeptideNaturalIsotopeAverage::getComponents ( ) const

Definition at line 222 of file peptidenaturalisotopeaverage.cpp.

223{
225}

References m_peptideNaturalIsotopeSpList.

◆ getIntensityRatio()

◆ getIsotopeNumber()

unsigned int pappso::PeptideNaturalIsotopeAverage::getIsotopeNumber ( ) const

◆ getIsotopeRank()

unsigned int pappso::PeptideNaturalIsotopeAverage::getIsotopeRank ( ) const

◆ getMz()

◆ getPeptideInterfaceSp()

const PeptideInterfaceSp & pappso::PeptideNaturalIsotopeAverage::getPeptideInterfaceSp ( ) const

Definition at line 228 of file peptidenaturalisotopeaverage.cpp.

229{
230 return mcsp_peptideSp;
231}

References mcsp_peptideSp.

Referenced by PeptideNaturalIsotopeAverage(), and toString().

◆ getPrecision()

PrecisionPtr pappso::PeptideNaturalIsotopeAverage::getPrecision ( ) const

Definition at line 234 of file peptidenaturalisotopeaverage.cpp.

235{
236 return mp_precision;
237}

References mp_precision.

◆ isEmpty()

bool pappso::PeptideNaturalIsotopeAverage::isEmpty ( ) const

Definition at line 249 of file peptidenaturalisotopeaverage.cpp.

250{
251 return (m_peptideNaturalIsotopeSpList.size() == 0);
252}

References m_peptideNaturalIsotopeSpList.

Referenced by pappso::getByIntensityRatioByIsotopeNumber().

◆ makePeptideNaturalIsotopeAverageSp()

PeptideNaturalIsotopeAverageSp pappso::PeptideNaturalIsotopeAverage::makePeptideNaturalIsotopeAverageSp ( ) const

◆ matchPeak()

bool pappso::PeptideNaturalIsotopeAverage::matchPeak ( pappso_double peak_mz) const
finalvirtual

Definition at line 240 of file peptidenaturalisotopeaverage.cpp.

241{
242 // qDebug() << "PeptideNaturalIsotopeAverage::matchPeak";
243 // qDebug() << "PeptideNaturalIsotopeAverage::matchPeak precision " <<
244 // mp_precision.getDelta(200);
245 return (MzRange(getMz(), mp_precision).contains(peak_mz));
246}

References getMz(), and mp_precision.

Referenced by pappso::PeptideIsotopeSpectrumMatch::getBestPeakIterator().

◆ recursiveDepletion()

void pappso::PeptideNaturalIsotopeAverage::recursiveDepletion ( std::vector< PeptideNaturalIsotopeSp > & v_isotope_list,
unsigned int rank )
private

Definition at line 105 of file peptidenaturalisotopeaverage.cpp.

107{
108 rank++;
109
111 m_averageMz = 0;
113 std::vector<PeptideNaturalIsotopeSp> peptide_list;
114 // select neighbors in the precision range :
115 MzRange mz_range(v_isotope_list[0].get()->getMz(m_z), mp_precision);
116
117 for(auto &isotope_sp : v_isotope_list)
118 {
119 if(mz_range.contains(isotope_sp.get()->getMz(m_z)))
120 {
121 peptide_list.push_back(isotope_sp);
122 m_abundanceRatio += isotope_sp.get()->getIntensityRatio(m_z);
123 m_averageMz += (isotope_sp.get()->getMz(m_z) * isotope_sp.get()->getIntensityRatio(m_z));
124 }
125 }
126
127 if(peptide_list.size() > 0)
128 {
130
131 // depletion
132 auto it_remove =
133 std::remove_if(v_isotope_list.begin(),
134 v_isotope_list.end(),
135 [peptide_list](const PeptideNaturalIsotopeSp &isotope_sp) {
136 auto it = std::find(peptide_list.begin(), peptide_list.end(), isotope_sp);
137 return (it != peptide_list.end());
138 });
139 v_isotope_list.erase(it_remove, v_isotope_list.end());
140
141 if(rank == m_isotopeRank)
142 {
143 m_peptideNaturalIsotopeSpList = peptide_list;
144 return;
145 }
146 else
147 {
148 unsigned int charge = m_z;
149 std::sort(v_isotope_list.begin(),
150 v_isotope_list.end(),
151 [charge](const PeptideNaturalIsotopeSp &m, const PeptideNaturalIsotopeSp &n) {
152 return (m.get()->getIntensityRatio(charge) >
153 n.get()->getIntensityRatio(charge));
154 });
155 recursiveDepletion(v_isotope_list, rank);
156 }
157 }
158 else
159 {
161 m_averageMz = 0;
162 }
163}
std::shared_ptr< const PeptideNaturalIsotope > PeptideNaturalIsotopeSp

References pappso::MzRange::contains(), getMz(), m_abundanceRatio, m_averageMz, m_isotopeRank, m_peptideNaturalIsotopeSpList, m_z, mp_precision, and recursiveDepletion().

Referenced by PeptideNaturalIsotopeAverage(), and recursiveDepletion().

◆ toString()

QString pappso::PeptideNaturalIsotopeAverage::toString ( ) const
virtual

Definition at line 255 of file peptidenaturalisotopeaverage.cpp.

256{
257 return QString("%1 l%2 mz%3 z%4 N%5")
258 .arg(getPeptideInterfaceSp().get()->getSequence())
259 .arg(getPeptideInterfaceSp().get()->size())
260 .arg(getMz())
261 .arg(getCharge())
262 .arg(getIsotopeNumber());
263}
const PeptideInterfaceSp & getPeptideInterfaceSp() const

References getCharge(), getIsotopeNumber(), getMz(), and getPeptideInterfaceSp().

Referenced by pappso::PeptideIsotopeSpectrumMatch::PeptideIsotopeSpectrumMatch().

Member Data Documentation

◆ m_abundanceRatio

pappso_double pappso::PeptideNaturalIsotopeAverage::m_abundanceRatio
private

◆ m_averageMz

pappso_double pappso::PeptideNaturalIsotopeAverage::m_averageMz
private

◆ m_isotopeLevel

unsigned int pappso::PeptideNaturalIsotopeAverage::m_isotopeLevel
private

◆ m_isotopeRank

unsigned int pappso::PeptideNaturalIsotopeAverage::m_isotopeRank = 1
private

◆ m_peptideNaturalIsotopeSpList

std::vector<PeptideNaturalIsotopeSp> pappso::PeptideNaturalIsotopeAverage::m_peptideNaturalIsotopeSpList
private

◆ m_z

unsigned int pappso::PeptideNaturalIsotopeAverage::m_z
private

◆ mcsp_peptideSp

const PeptideInterfaceSp pappso::PeptideNaturalIsotopeAverage::mcsp_peptideSp
private

◆ mp_precision

PrecisionPtr pappso::PeptideNaturalIsotopeAverage::mp_precision = nullptr
private

The documentation for this class was generated from the following files: