33 #include "../../pappsoexception.h"
34 #include "../../peptide/peptidefragment.h"
35 #include "../../peptide/peptidefragmentionlistbase.h"
37 #include "../peptidespectrummatch.h"
45 unsigned int retval = 1;
46 for(
int i = n; i > 1; --i)
53 unsigned int parent_charge,
55 std::list<PeptideIon> ion_list,
56 bool refine_spectrum_synthesis)
57 : _refine_spectrum_synthesis(refine_spectrum_synthesis)
68 unsigned int max_charge = parent_charge;
71 max_charge = parent_charge - 1;
74 spectrum, peptideSp, max_charge, precision, ion_list);
86 std::map<PeptideIon, unsigned int> ion_count;
87 for(
auto &&ion_type : ion_list)
89 ion_count.insert(std::pair<PeptideIon, unsigned int>(ion_type, 0));
92 std::map<unsigned int, pappso_double> charge_dot_product;
93 std::map<unsigned int, std::map<PeptideIon, unsigned int>>
95 for(
unsigned int i = 1; i <= max_charge; i++)
97 charge_dot_product.insert(
98 std::pair<unsigned int, pappso_double>(i, 0));
99 charge_ion_count.insert(
100 std::pair<
unsigned int, std::map<PeptideIon, unsigned int>>(
103 QString sequence = peptideSp.get()->getSequence();
104 for(
auto &&peptide_ion_match : psm)
106 PeptideIon ion_type = peptide_ion_match.getPeptideIonType();
107 unsigned int charge = peptide_ion_match.getCharge();
108 charge_dot_product[charge] +=
109 peptide_ion_match.getPeak().y *
112 peptide_ion_match.getPeptideIonDirection(),
113 peptide_ion_match.getPeptideFragmentIonSp().get()->size());
114 charge_ion_count[charge][ion_type] += 1;
118 qDebug() << __FILE__ <<
" " << __FUNCTION__ <<
" " << __LINE__
122 for(
unsigned int i = 1; i <= max_charge; i++)
124 sum_intensity += charge_dot_product[i];
128 sum_intensity *=
factorial(count.second);
136 QObject::tr(
"ERROR computing hyperscore, PAPPSO exception:\n%1")
137 .arg(exception_pappso.
qwhat());
138 qDebug() <<
"XtandemHyperscore::XtandemHyperscore PappsoException :\n"
142 catch(std::exception &exception_std)
145 QObject::tr(
"ERROR computing hyperscore, std exception:\n%1")
146 .arg(exception_std.what());
147 qDebug() <<
"XtandemHyperscore::XtandemHyperscore std::exception :\n"
173 for(
long c = 64;
c < 126;
c++)
175 ret.insert(std::pair<char, pappso_double>(c,
pappso_double(1.0)));
185 for(
long c = 64;
c < 126;
c++)
187 ret.insert(std::pair<char, pappso_double>(c,
pappso_double(1.0)));
202 const QString &sequence,
204 unsigned int ion_size)
const
208 char last_aa_nter(
'_'), last_aa_cter(
'_');
212 last_aa_nter = sequence[ion_size - 1].toLatin1();
213 last_aa_cter = sequence[ion_size].toLatin1();
216 if(last_aa_nter ==
'P')
228 unsigned int offset(sequence.size() - ion_size);
229 last_aa_nter = sequence[offset - 1].toLatin1();
230 last_aa_cter = sequence[offset].toLatin1();
233 if(last_aa_nter ==
'P')
246 <<
" last_aa_nter=" << last_aa_nter
247 <<
" _aa_ion_factor_b[last_aa_nter]="
249 <<
" _aa_ion_factor_y[last_aa_cter]="
274 QObject::tr(
"ERROR in getHyperscore, PAPPSO exception:\n%1")
275 .arg(exception_pappso.
qwhat());
276 qDebug() <<
"XtandemHyperscore::getHyperscore PappsoException :\n"
280 catch(std::exception &exception_std)
283 QObject::tr(
"ERROR in getHyperscore, std exception:\n%1")
284 .arg(exception_std.what());
285 qDebug() <<
"XtandemHyperscore::getHyperscore std::exception :\n"
Class to represent a mass spectrum.
virtual const QString & qwhat() const
static const QString getPeptideIonDirectionName(PeptideDirection direction)
unsigned int getMatchedIons(PeptideIon ion_type) const
bool _refine_spectrum_synthesis
unsigned int getXtandemPredictedIonIntensityFactor(const QString &sequence, PeptideDirection ion_direction, unsigned int ion_size) const
pappso_double getHyperscore() const
static AaFactorMap _aa_ion_factor_y
pappso_double _proto_hyperscore
std::map< char, pappso_double > AaFactorMap
static AaFactorMap _aa_ion_factor_b
std::map< PeptideIon, unsigned int > _ion_count
XtandemHyperscore(const MassSpectrum &spectrum, pappso::PeptideSp peptideSp, unsigned int parent_charge, PrecisionPtr precision, std::list< PeptideIon > ion_list, bool refine_spectrum_synthesis)
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
PeptideIon
PeptideIon enum defines all types of ions (Nter or Cter)
@ ystar
Cter amino ions + NH3 loss.
@ yo
Cter amino ions + H2O loss.
@ bstar
Nter acylium ions + NH3 loss.
@ bo
Nter acylium ions + H2O loss.
std::shared_ptr< const Peptide > PeptideSp
double pappso_double
A type definition for doubles.
unsigned int factorial(unsigned int n)
computation of the X!Tandem hyperscore