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);
79 {PeptideIon::bstar, 0},
83 {PeptideIon::ystar, 0},
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"
166 for(
long c = 64;
c < 126;
c++)
168 ret.insert(std::pair<char, pappso_double>(c,
pappso_double(1.0)));
178 for(
long c = 64;
c < 126;
c++)
180 ret.insert(std::pair<char, pappso_double>(c,
pappso_double(1.0)));
195 const QString &sequence,
197 unsigned int ion_size)
const
201 char last_aa_nter(
'_'), last_aa_cter(
'_');
203 if(ion_direction == PeptideDirection::Nter)
205 last_aa_nter = sequence[ion_size - 1].toLatin1();
206 last_aa_cter = sequence[ion_size].toLatin1();
209 if(last_aa_nter ==
'P')
221 unsigned int offset(sequence.size() - ion_size);
222 last_aa_nter = sequence[offset - 1].toLatin1();
223 last_aa_cter = sequence[offset].toLatin1();
226 if(last_aa_nter ==
'P')
239 <<
" last_aa_nter=" << last_aa_nter
240 <<
" _aa_ion_factor_b[last_aa_nter]="
242 <<
" _aa_ion_factor_y[last_aa_cter]="
258 qDebug() << __FILE__ <<
" " << __FUNCTION__ <<
" " << __LINE__
265 QObject::tr(
"ERROR in getHyperscore, PAPPSO exception:\n%1")
266 .arg(exception_pappso.
qwhat());
267 qDebug() <<
"XtandemHyperscore::getHyperscore PappsoException :\n"
271 catch(std::exception &exception_std)
274 QObject::tr(
"ERROR in getHyperscore, std exception:\n%1")
275 .arg(exception_std.what());
276 qDebug() <<
"XtandemHyperscore::getHyperscore std::exception :\n"