33 #include "../../peptide/peptiderawfragmentmasses.h"
34 #include "../../pappsoexception.h"
43 unsigned int retval = 1;
44 for(
int i = n; i > 1; --i)
51 bool refine_spectrum_synthesis,
53 const std::vector<PeptideIon> &ion_list)
87 unsigned int parent_charge)
92 unsigned int max_charge = parent_charge;
95 max_charge = parent_charge - 1;
103 std::vector<SimplePeakIonMatch> match_products;
104 unsigned int charge_i;
107 charge_i = max_charge;
123 unsigned int charge_ion_count[5][20] = {0};
131 charge_dot_product[peptide_ion_match.ion_charge] +=
132 peptide_ion_match.peak.y *
135 peptide_ion_match.ion_type,
136 peptide_ion_match.ion_size);
137 charge_ion_count[peptide_ion_match.ion_charge]
138 [(std::int8_t)peptide_ion_match.ion_type] += 1;
139 m_ionCount[(std::int8_t)peptide_ion_match.ion_type] += 1;
143 for(
unsigned int i = 1; i <= max_charge; i++)
145 sum_intensity += charge_dot_product[i];
159 QObject::tr(
"ERROR computing hyperscore, PAPPSO exception:\n%1")
160 .arg(exception_pappso.
qwhat());
161 qDebug() <<
"XtandemHyperscore::XtandemHyperscore PappsoException :\n"
165 catch(std::exception &exception_std)
168 QObject::tr(
"ERROR computing hyperscore, std exception:\n%1")
169 .arg(exception_std.what());
170 qDebug() <<
"XtandemHyperscore::XtandemHyperscore std::exception :\n"
180 for(
long c = 64;
c < 126;
c++)
182 ret.insert(std::pair<char, pappso_double>(c,
pappso_double(1.0)));
192 for(
long c = 64;
c < 126;
c++)
194 ret.insert(std::pair<char, pappso_double>(c,
pappso_double(1.0)));
209 const QString &sequence,
PeptideIon ion_type,
unsigned int ion_size)
const
213 char last_aa_nter(
'_'), last_aa_cter(
'_');
217 last_aa_nter = sequence[ion_size - 1].toLatin1();
218 last_aa_cter = sequence[ion_size].toLatin1();
221 if(last_aa_nter ==
'P')
233 unsigned int offset(sequence.size() - ion_size);
234 last_aa_nter = sequence[offset - 1].toLatin1();
235 last_aa_cter = sequence[offset].toLatin1();
238 if(last_aa_nter ==
'P')
280 QObject::tr(
"ERROR in getHyperscore, PAPPSO exception:\n%1")
281 .arg(exception_pappso.
qwhat());
282 qDebug() <<
"XtandemHyperscore::getHyperscore PappsoException :\n"
286 catch(std::exception &exception_std)
289 QObject::tr(
"ERROR in getHyperscore, std exception:\n%1")
290 .arg(exception_std.what());
291 qDebug() <<
"XtandemHyperscore::getHyperscore std::exception :\n"
Class to represent a mass spectrum.
virtual const QString & qwhat() const
void pushBackMatchSpectrum(std::vector< SimplePeakIonMatch > &peak_match_list, const MassSpectrum &spectrum, PrecisionPtr precision, PeptideIon ion_type, unsigned int charge) const
const QString getSequence() const override
print amino acid sequence without modifications
unsigned int getTotalMatchedIons() const
unsigned int getXtandemPredictedIonIntensityFactor(const QString &sequence, PeptideIon ion_type, unsigned int size) const
pappso_double m_protoHyperscore
bool m_isRefineSpectrumSynthesis
static AaFactorMap m_aaIonFactorY
std::map< char, pappso_double > AaFactorMap
bool computeXtandemHyperscore(const MassSpectrum &spectrum, const Peptide &peptide, unsigned int parent_charge)
XtandemHyperscoreBis(bool refine_spectrum_synthesis, PrecisionPtr precision, const std::vector< PeptideIon > &ion_list)
PrecisionPtr mp_precision
unsigned int m_ionCount[PEPTIDE_ION_TYPE_COUNT]
std::vector< PeptideIon > m_ionList
pappso_double getHyperscore() const
unsigned int getMatchedIons(PeptideIon ion_type) const
static AaFactorMap m_aaIonFactorBb
unsigned int m_totalMatchedIons
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)
double pappso_double
A type definition for doubles.
bool peptideIonIsNter(PeptideIon ion_type)
tells if an ion is Nter
unsigned int factorial(unsigned int n)
#define PEPTIDE_ION_TYPE_COUNT
only usefull for inernal usefull DO not change this value : it is used to define static array size
computation of the X!Tandem hyperscore