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

`#include <xtandemhyperscore.h>`

## Public Types

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

## Public Member Functions

| XtandemHyperscore (const MassSpectrum &spectrum, pappso::PeptideSp peptideSp, unsigned int parent_charge, PrecisionPtr precision, std::list< PeptideIon > ion_list, bool refine_spectrum_synthesis)
| XtandemHyperscore (const XtandemHyperscore &other)
| ~XtandemHyperscore ()
pappso_double | getHyperscore () const
unsigned int | getMatchedIons (PeptideIon ion_type) const

## Private Member Functions

unsigned int | getXtandemPredictedIonIntensityFactor (const QString &sequence, PeptideDirection ion_direction, unsigned int ion_size) const

## Private Attributes

bool | _refine_spectrum_synthesis
pappso_double | _proto_hyperscore
std::map< PeptideIon, unsigned int > | _ion_count

## Static Private Attributes

static AaFactorMap | _aa_ion_factor_y
static AaFactorMap | _aa_ion_factor_b

## Detailed Description

Definition at line 42 of file xtandemhyperscore.h.

## Member Typedef Documentation

## AaFactorMap

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

Definition at line 45 of file xtandemhyperscore.h.

## Constructor & Destructor Documentation

## XtandemHyperscore() [1/2]

pappso::XtandemHyperscore::XtandemHyperscore | ( | const MassSpectrum & | spectrum,
|  | pappso::PeptideSp | peptideSp,
|  | unsigned int | parent_charge,
|  | PrecisionPtr | precision,
|  | std::list< PeptideIon > | ion_list,
|  | bool | refine_spectrum_synthesis
| ) |  |

Definition at line 51 of file xtandemhyperscore.cpp.

: _refine_spectrum_synthesis(refine_spectrum_synthesis)
{
try
{
/*
if ((peptide_ion_sp.get()->getPeptideIonType() == PeptideIon::c) ||
(peptide_ion_sp.get()->getPeptideIonType() == PeptideIon::z)) {
if(current_max_charge > 2) {
current_max_charge--;
}
}*/
unsigned int max_charge = parent_charge;
if(parent_charge > 1)
{
max_charge = parent_charge - 1;
}
PeptideSpectrumMatch psm(
spectrum, peptideSp, max_charge, precision, ion_list);
_ion_count = {{PeptideIon::a, 0},
{PeptideIon::b, 0},
{PeptideIon::bo, 0},
{PeptideIon::bstar, 0},
{PeptideIon::c, 0},
{PeptideIon::y, 0},
{PeptideIon::yo, 0},
{PeptideIon::ystar, 0},
{PeptideIon::z, 0}};
std::map<PeptideIon, unsigned int> ion_count;
for(auto &&ion_type : ion_list)
{
ion_count.insert(std::pair<PeptideIon, unsigned int>(ion_type, 0));
}
std::map<unsigned int, pappso_double> charge_dot_product;
std::map<unsigned int, std::map<PeptideIon, unsigned int>>
charge_ion_count;
for(unsigned int i = 1; i <= max_charge; i++)
{
charge_dot_product.insert(
std::pair<unsigned int, pappso_double>(i, 0));
charge_ion_count.insert(
std::pair<unsigned int, std::map<PeptideIon, unsigned int>>(
i, ion_count));
}
QString sequence = peptideSp.get()->getSequence();
for(auto &&peptide_ion_match : psm)
{
PeptideIon ion_type = peptide_ion_match.getPeptideIonType();
unsigned int charge = peptide_ion_match.getCharge();
charge_dot_product[charge] +=
peptide_ion_match.getPeak().y *
getXtandemPredictedIonIntensityFactor(
sequence,
peptide_ion_match.getPeptideIonDirection(),
peptide_ion_match.getPeptideFragmentIonSp().get()->size());
charge_ion_count[charge][ion_type] += 1;
_ion_count[ion_type] += 1;
}
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
<< " _ion_count[PeptideIon::y]=" << _ion_count[PeptideIon::y];
// 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 : _ion_count)
{
sum_intensity *= factorial(count.second);
}
_proto_hyperscore = sum_intensity;
}
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::XtandemHyperscore::_refine_spectrum_synthesis
bool _refine_spectrum_synthesis
Definition xtandemhyperscore.h:59
pappso::XtandemHyperscore::getXtandemPredictedIonIntensityFactor
unsigned int getXtandemPredictedIonIntensityFactor(const QString &sequence, PeptideDirection ion_direction, unsigned int ion_size) const
Definition xtandemhyperscore.cpp:201
pappso::XtandemHyperscore::_proto_hyperscore
pappso_double _proto_hyperscore
Definition xtandemhyperscore.h:66
pappso::XtandemHyperscore::_ion_count
std::map< PeptideIon, unsigned int > _ion_count
Definition xtandemhyperscore.h:67
pappso::PeptideIon
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
Definition types.h:425
pappso::PeptideIon::a
@ a
Nter aldimine ions.
pappso::PeptideIon::y
@ y
Cter amino ions.
pappso::PeptideIon::c
@ c
Nter amino ions.
pappso::PeptideIon::ystar
@ ystar
Cter amino ions + NH3 loss.
pappso::PeptideIon::yo
@ yo
Cter amino ions + H2O loss.
pappso::PeptideIon::bstar
@ bstar
Nter acylium ions + NH3 loss.
pappso::PeptideIon::b
@ b
Nter acylium ions.
pappso::PeptideIon::bo
@ bo
Nter acylium ions + H2O loss.
pappso::PeptideIon::z
@ z
Cter carbocations.
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition types.h:50
pappso::factorial
unsigned int factorial(unsigned int n)
Definition xtandemhyperscore.cpp:43

References _ion_count, _proto_hyperscore, pappso::a, pappso::b, pappso::bo, pappso::bstar, pappso::c, pappso::factorial(), getXtandemPredictedIonIntensityFactor(), pappso::PappsoException::qwhat(), pappso::y, pappso::yo, pappso::ystar, and pappso::z.

## XtandemHyperscore() [2/2]

pappso::XtandemHyperscore::XtandemHyperscore | ( | const XtandemHyperscore & | other | ) |

Definition at line 153 of file xtandemhyperscore.cpp.

{
_ion_count = other._ion_count;
_proto_hyperscore = other._proto_hyperscore;
_refine_spectrum_synthesis = other._refine_spectrum_synthesis;
}

References _ion_count, _proto_hyperscore, and _refine_spectrum_synthesis.

## ~XtandemHyperscore()

pappso::XtandemHyperscore::~XtandemHyperscore | ( |  | ) |

Definition at line 165 of file xtandemhyperscore.cpp.

{
}

## Member Function Documentation

## getHyperscore()

pappso_double pappso::XtandemHyperscore::getHyperscore | ( |  | ) | const

Definition at line 261 of file xtandemhyperscore.cpp.

{
try
{
qDebug() << " _proto_hyperscore=" << _proto_hyperscore;
double hyperscore = (log10(_proto_hyperscore) * 4);
if(hyperscore < 0)
return 0;
return hyperscore;
}
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::AxisScale::log10
@ log10

References _proto_hyperscore, pappso::log10, and pappso::PappsoException::qwhat().

## getMatchedIons()

unsigned int pappso::XtandemHyperscore::getMatchedIons | ( | PeptideIon | ion_type | ) | const

Definition at line 161 of file xtandemhyperscore.cpp.

{
return _ion_count.at(ion_type);
}

References _ion_count.

## getXtandemPredictedIonIntensityFactor()

unsigned int pappso::XtandemHyperscore::getXtandemPredictedIonIntensityFactor | ( | const QString & | sequence,
|  | PeptideDirection | ion_direction,
|  | unsigned int | ion_size
| ) |  | const

private

Definition at line 201 of file xtandemhyperscore.cpp.

{
unsigned int Pi(1);
char last_aa_nter('_'), last_aa_cter('_');
if(ion_direction == PeptideDirection::Nter)
{
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) << "
// _aa_ion_factor_b[last_aa_nter]="s ;
qDebug() << PeptideFragment::getPeptideIonDirectionName(ion_direction)
<< " last_aa_nter=" << last_aa_nter
<< " _aa_ion_factor_b[last_aa_nter]="
<< _aa_ion_factor_b[last_aa_nter] << " last_aa_cter=" << last_aa_cter
<< " _aa_ion_factor_y[last_aa_cter]="
<< _aa_ion_factor_y[last_aa_cter];
if(_refine_spectrum_synthesis)
{
Pi *= _aa_ion_factor_b[last_aa_nter] * _aa_ion_factor_y[last_aa_cter];
}
return Pi;
}
pappso::PeptideFragment::getPeptideIonDirectionName
static const QString getPeptideIonDirectionName(PeptideDirection direction)
Definition peptidefragment.cpp:98
pappso::XtandemHyperscore::_aa_ion_factor_y
static AaFactorMap _aa_ion_factor_y
Definition xtandemhyperscore.h:69
pappso::XtandemHyperscore::_aa_ion_factor_b
static AaFactorMap _aa_ion_factor_b
Definition xtandemhyperscore.h:70
pappso::PeptideDirection::Nter
@ Nter

References _aa_ion_factor_b, _aa_ion_factor_y, _refine_spectrum_synthesis, pappso::PeptideFragment::getPeptideIonDirectionName(), and pappso::Nter.

Referenced by XtandemHyperscore().

## Member Data Documentation

## _aa_ion_factor_b

XtandemHyperscore::AaFactorMap pappso::XtandemHyperscore::_aa_ion_factor_b

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::XtandemHyperscore::AaFactorMap
std::map< char, pappso_double > AaFactorMap
Definition xtandemhyperscore.h:45
pappso::PeptideIonNter::c
@ c

Definition at line 70 of file xtandemhyperscore.h.

Referenced by getXtandemPredictedIonIntensityFactor().

## _aa_ion_factor_y

XtandemHyperscore::AaFactorMap pappso::XtandemHyperscore::_aa_ion_factor_y

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 69 of file xtandemhyperscore.h.

Referenced by getXtandemPredictedIonIntensityFactor().

## _ion_count

std::map<PeptideIon, unsigned int> pappso::XtandemHyperscore::_ion_count

private

Definition at line 67 of file xtandemhyperscore.h.

Referenced by XtandemHyperscore(), XtandemHyperscore(), and getMatchedIons().

## _proto_hyperscore

pappso_double pappso::XtandemHyperscore::_proto_hyperscore

private

Definition at line 66 of file xtandemhyperscore.h.

Referenced by XtandemHyperscore(), XtandemHyperscore(), and getHyperscore().

## _refine_spectrum_synthesis

bool pappso::XtandemHyperscore::_refine_spectrum_synthesis

private

Definition at line 59 of file xtandemhyperscore.h.

Referenced by XtandemHyperscore(), and getXtandemPredictedIonIntensityFactor().

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

- pappsomspp/psm/xtandem/xtandemhyperscore.h
- pappsomspp/psm/xtandem/xtandemhyperscore.cpp