Loading...
Searching...
No Matches
pappso::XtandemHyperscoreBis Class Reference

`#include <xtandemhyperscorebis.h>`

## Public Member Functions

| XtandemHyperscoreBis (bool refine_spectrum_synthesis, PrecisionPtr precision, const std::vector< Enums::PeptideIon > &ion_list)
| ~XtandemHyperscoreBis ()
pappso_double | getHyperscore () const
unsigned int | getMatchedIons (Enums::PeptideIon ion_type) const
void | reset ()
bool | computeXtandemHyperscore (const MassSpectrum &spectrum, const Peptide &peptide, unsigned int parent_charge)
unsigned int | getTotalMatchedIons () const

## Private Types

using | AaFactorMap = std::map<char, pappso_double>

## Private Member Functions

unsigned int | getXtandemPredictedIonIntensityFactor (const QString &sequence, Enums::PeptideIon ion_type, unsigned int size) const

## Private Attributes

bool | m_isRefineSpectrumSynthesis
PrecisionPtr | mp_precision
std::vector< Enums::PeptideIon > | m_ionList
unsigned int | m_totalMatchedIons = 0
unsigned int | m_ionCount [PEPTIDE_ION_TYPE_COUNT] = {0}
pappso_double | m_protoHyperscore

## Static Private Attributes

static AaFactorMap | m_aaIonFactorY
static AaFactorMap | m_aaIonFactorBb

## Detailed Description

Definition at line 40 of file xtandemhyperscorebis.h.

## Member Typedef Documentation

## AaFactorMap

using pappso::XtandemHyperscoreBis::AaFactorMap = std::map<char, pappso_double>

private

Definition at line 42 of file xtandemhyperscorebis.h.

## Constructor & Destructor Documentation

## XtandemHyperscoreBis()

XtandemHyperscoreBis::XtandemHyperscoreBis | ( | bool | refine_spectrum_synthesis,
|  | PrecisionPtr | precision,
|  | const std::vector< Enums::PeptideIon > & | ion_list )

Definition at line 50 of file xtandemhyperscorebis.cpp.

{
m_isRefineSpectrumSynthesis = refine_spectrum_synthesis;
mp_precision = precision;
m_ionList = ion_list;
m_totalMatchedIons = 0;
}
pappso::XtandemHyperscoreBis::m_isRefineSpectrumSynthesis
bool m_isRefineSpectrumSynthesis
Definition xtandemhyperscorebis.h:48
pappso::XtandemHyperscoreBis::m_ionList
std::vector< Enums::PeptideIon > m_ionList
Definition xtandemhyperscorebis.h:50
pappso::XtandemHyperscoreBis::mp_precision
PrecisionPtr mp_precision
Definition xtandemhyperscorebis.h:49
pappso::XtandemHyperscoreBis::m_totalMatchedIons
unsigned int m_totalMatchedIons
Definition xtandemhyperscorebis.h:52

References m_ionList, m_isRefineSpectrumSynthesis, m_totalMatchedIons, and mp_precision.

## ~XtandemHyperscoreBis()

XtandemHyperscoreBis::~XtandemHyperscoreBis | ( |  | ) |

Definition at line 61 of file xtandemhyperscorebis.cpp.

{
}

## Member Function Documentation

## computeXtandemHyperscore()

bool XtandemHyperscoreBis::computeXtandemHyperscore | ( | const MassSpectrum & | spectrum,
|  | const Peptide & | peptide,
|  | unsigned int | parent_charge )

Definition at line 84 of file xtandemhyperscorebis.cpp.

{
try
{
unsigned int max_charge = parent_charge;
if(parent_charge > 1)
{
max_charge = parent_charge - 1;
}
// PeptideSpectrumMatch psm (spectrum, peptideSp, max_charge, precision,
// ion_list);
PeptideRawFragmentMasses calc_mass_list(peptide, RawFragmentationMode::full);
std::vector<SimplePeakIonMatch> match_products;
unsigned int charge_i;
for(Enums::PeptideIon &ion : m_ionList)
{
charge_i = max_charge;
while(charge_i > 0)
{
calc_mass_list.pushBackMatchSpectrum(
match_products, spectrum, mp_precision, ion, charge_i);
charge_i--;
}
}
m_totalMatchedIons = match_products.size();
if(m_totalMatchedIons == 0)
{
m_protoHyperscore = 0;
}
else
{
unsigned int charge_ion_count[5][20] = {0};
pappso_double charge_dot_product[5] = {0};
QString sequence = peptide.getSequence();
for(SimplePeakIonMatch &peptide_ion_match : match_products)
{
charge_dot_product[peptide_ion_match.ion_charge] +=
peptide_ion_match.peak.y *
getXtandemPredictedIonIntensityFactor(
sequence, peptide_ion_match.ion_type, peptide_ion_match.ion_size);
charge_ion_count[peptide_ion_match.ion_charge]
[(std::int8_t)peptide_ion_match.ion_type] += 1;
m_ionCount[(std::int8_t)peptide_ion_match.ion_type] += 1;
}
// take the 2 best component
pappso_double sum_intensity = 0;
for(unsigned int i = 1; i <= max_charge; i++)
{
sum_intensity += charge_dot_product[i];
}
for(auto count : m_ionCount)
{
sum_intensity *= factorial(count);
}
m_protoHyperscore = sum_intensity;
}
return true;
}
catch(PappsoException &exception_pappso)
{
QString errorStr = QObject::tr("ERROR computing hyperscore, PAPPSO exception:\n%1")
.arg(exception_pappso.qwhat());
qDebug() << "XtandemHyperscore::XtandemHyperscore PappsoException :\n" << errorStr;
throw PappsoException(errorStr);
}
catch(std::exception &exception_std)
{
QString errorStr =
QObject::tr("ERROR computing hyperscore, std exception:\n%1").arg(exception_std.what());
qDebug() << "XtandemHyperscore::XtandemHyperscore std::exception :\n" << errorStr;
throw PappsoException(errorStr);
}
}
pappso::PappsoException::qwhat
virtual const QString & qwhat() const
Definition pappsoexception.h:66
pappso::Peptide::getSequence
const QString getSequence() const override
print amino acid sequence without modifications
Definition peptide.cpp:255
pappso::XtandemHyperscoreBis::m_protoHyperscore
pappso_double m_protoHyperscore
Definition xtandemhyperscorebis.h:56
pappso::XtandemHyperscoreBis::m_ionCount
unsigned int m_ionCount[PEPTIDE_ION_TYPE_COUNT]
Definition xtandemhyperscorebis.h:53
pappso::XtandemHyperscoreBis::getXtandemPredictedIonIntensityFactor
unsigned int getXtandemPredictedIonIntensityFactor(const QString &sequence, Enums::PeptideIon ion_type, unsigned int size) const
Definition xtandemhyperscorebis.cpp:200
pappso::Enums::PeptideIon
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter).
Definition types.h:286
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:60
pappso::factorial
unsigned int factorial(unsigned int n)
Definition xtandemhyperscore.cpp:43
pappso::RawFragmentationMode::full
@ full
Definition peptiderawfragmentmasses.h:44

References pappso::factorial(), pappso::full, pappso::Peptide::getSequence(), getXtandemPredictedIonIntensityFactor(), m_ionCount, m_ionList, m_protoHyperscore, m_totalMatchedIons, mp_precision, pappso::PeptideRawFragmentMasses::pushBackMatchSpectrum(), and pappso::PappsoException::qwhat().

## getHyperscore()

pappso_double XtandemHyperscoreBis::getHyperscore | ( |  | ) | const

Definition at line 262 of file xtandemhyperscorebis.cpp.

{
try
{
if(m_protoHyperscore == 0)
return 0.0;
return (log10(m_protoHyperscore) * 4);
}
catch(PappsoException &exception_pappso)
{
QString errorStr =
QObject::tr("ERROR in getHyperscore, PAPPSO exception:\n%1").arg(exception_pappso.qwhat());
qDebug() << "XtandemHyperscore::getHyperscore PappsoException :\n" << errorStr;
throw PappsoException(errorStr);
}
catch(std::exception &exception_std)
{
QString errorStr =
QObject::tr("ERROR in getHyperscore, std exception:\n%1").arg(exception_std.what());
qDebug() << "XtandemHyperscore::getHyperscore std::exception :\n" << errorStr;
throw PappsoException(errorStr);
}
}
pappso::Enums::AxisScale::log10
@ log10
Definition types.h:270

References m_protoHyperscore, and pappso::PappsoException::qwhat().

## getMatchedIons()

unsigned int XtandemHyperscoreBis::getMatchedIons | ( | Enums::PeptideIon | ion_type | ) | const

Definition at line 66 of file xtandemhyperscorebis.cpp.

{
return m_ionCount[(std::int8_t)ion_type];
}

References m_ionCount.

## getTotalMatchedIons()

unsigned int XtandemHyperscoreBis::getTotalMatchedIons | ( |  | ) | const

Definition at line 256 of file xtandemhyperscorebis.cpp.

{
return m_totalMatchedIons;
}

References m_totalMatchedIons.

## getXtandemPredictedIonIntensityFactor()

unsigned int XtandemHyperscoreBis::getXtandemPredictedIonIntensityFactor | ( | const QString & | sequence,
|  | Enums::PeptideIon | ion_type,
|  | unsigned int | size ) const

private

Definition at line 200 of file xtandemhyperscorebis.cpp.

{
unsigned int Pi(1);
char last_aa_nter('_'), last_aa_cter('_');
if(peptideIonIsNter(ion_type))
{
last_aa_nter = sequence[ion_size - 1].toLatin1();
last_aa_cter = sequence[ion_size].toLatin1();
if(ion_size == 2)
{
if(last_aa_nter == 'P')
{
Pi *= 10;
}
else
{
Pi *= 3;
}
}
}
else
{
unsigned int offset(sequence.size() - ion_size);
last_aa_nter = sequence[offset - 1].toLatin1();
last_aa_cter = sequence[offset].toLatin1();
if((offset) == 2)
{
if(last_aa_nter == 'P')
{
Pi *= 10;
}
else
{
Pi *= 3;
}
}
}
// QDebug << " last_aa_nter=" << QChar(last_aa_nter) << "
// m_aaIonFactorBb[last_aa_nter]="s ;
// qDebug() << PeptideFragment::getPeptideIonDirectionName(ion_direction) << "
// last_aa_nter=" << last_aa_nter << " m_aaIonFactorBb[last_aa_nter]=" <<
// m_aaIonFactorBb[last_aa_nter] << " last_aa_cter=" << last_aa_cter << "
// m_aaIonFactorY[last_aa_cter]=" << m_aaIonFactorY[last_aa_cter];
if(m_isRefineSpectrumSynthesis)
{
Pi *= m_aaIonFactorBb[last_aa_nter] * m_aaIonFactorY[last_aa_cter];
}
return Pi;
}
pappso::XtandemHyperscoreBis::m_aaIonFactorY
static AaFactorMap m_aaIonFactorY
Definition xtandemhyperscorebis.h:58
pappso::XtandemHyperscoreBis::m_aaIonFactorBb
static AaFactorMap m_aaIonFactorBb
Definition xtandemhyperscorebis.h:59
pappso::peptideIonIsNter
bool peptideIonIsNter(Enums::PeptideIon ion_type)
tells if an ion is Nter
Definition peptide.cpp:87

References m_aaIonFactorBb, m_aaIonFactorY, m_isRefineSpectrumSynthesis, and pappso::peptideIonIsNter().

Referenced by computeXtandemHyperscore().

## reset()

void XtandemHyperscoreBis::reset | ( |  | ) |

Definition at line 73 of file xtandemhyperscorebis.cpp.

{
std::fill(m_ionCount, m_ionCount + PEPTIDE_ION_TYPE_COUNT, 0);
m_totalMatchedIons = 0;
m_protoHyperscore = 0;
}
PEPTIDE_ION_TYPE_COUNT
#define PEPTIDE_ION_TYPE_COUNT
only useful for internal use DO not change this value : it is used to define static array size
Definition types.h:478

References m_ionCount, m_protoHyperscore, m_totalMatchedIons, and PEPTIDE_ION_TYPE_COUNT.

## Member Data Documentation

## m_aaIonFactorBb

XtandemHyperscoreBis::AaFactorMap XtandemHyperscoreBis::m_aaIonFactorBb

static private

Initial value:
= [] {
AaFactorMap ret;
for(long c = 64; c < 126; c++)
{
ret.insert(std::pair<char, pappso_double>(c, pappso_double(1.0)));
}
ret['D'] = pappso_double(5.0);
ret['N'] = pappso_double(2.0);
ret['V'] = pappso_double(3.0);
ret['E'] = pappso_double(3.0);
ret['Q'] = pappso_double(2.0);
ret['I'] = pappso_double(3.0);
ret['L'] = pappso_double(3.0);
return ret;
}()
pappso::XtandemHyperscoreBis::AaFactorMap
std::map< char, pappso_double > AaFactorMap
Definition xtandemhyperscorebis.h:42
pappso::PeptideIonNter::c
@ c
Definition peptide.h:81

Definition at line 59 of file xtandemhyperscorebis.h.

Referenced by getXtandemPredictedIonIntensityFactor().

## m_aaIonFactorY

XtandemHyperscoreBis::AaFactorMap XtandemHyperscoreBis::m_aaIonFactorY

static private

Initial value:
= [] {
AaFactorMap ret;
for(long c = 64; c < 126; c++)
{
ret.insert(std::pair<char, pappso_double>(c, pappso_double(1.0)));
}
ret['P'] = pappso_double(5.0);
return ret;
}()

Definition at line 58 of file xtandemhyperscorebis.h.

Referenced by getXtandemPredictedIonIntensityFactor().

## m_ionCount

unsigned int pappso::XtandemHyperscoreBis::m_ionCount[PEPTIDE_ION_TYPE_COUNT] = {0}

private

Definition at line 53 of file xtandemhyperscorebis.h.

{0};

Referenced by computeXtandemHyperscore(), getMatchedIons(), and reset().

## m_ionList

std::vector<Enums::PeptideIon> pappso::XtandemHyperscoreBis::m_ionList

private

Definition at line 50 of file xtandemhyperscorebis.h.

Referenced by XtandemHyperscoreBis(), and computeXtandemHyperscore().

## m_isRefineSpectrumSynthesis

bool pappso::XtandemHyperscoreBis::m_isRefineSpectrumSynthesis

private

Definition at line 48 of file xtandemhyperscorebis.h.

Referenced by XtandemHyperscoreBis(), and getXtandemPredictedIonIntensityFactor().

## m_protoHyperscore

pappso_double pappso::XtandemHyperscoreBis::m_protoHyperscore

private

Definition at line 56 of file xtandemhyperscorebis.h.

Referenced by computeXtandemHyperscore(), getHyperscore(), and reset().

## m_totalMatchedIons

unsigned int pappso::XtandemHyperscoreBis::m_totalMatchedIons = 0

private

Definition at line 52 of file xtandemhyperscorebis.h.

Referenced by XtandemHyperscoreBis(), computeXtandemHyperscore(), getTotalMatchedIons(), and reset().

## mp_precision

PrecisionPtr pappso::XtandemHyperscoreBis::mp_precision

private

Definition at line 49 of file xtandemhyperscorebis.h.

Referenced by XtandemHyperscoreBis(), and computeXtandemHyperscore().

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

- pappsomspp/core/psm/xtandem/xtandemhyperscorebis.h
- pappsomspp/core/psm/xtandem/xtandemhyperscorebis.cpp