43 unsigned int retval = 1;
44 for(
int i = n; i > 1; --i)
52 const std::vector<Enums::PeptideIon> &ion_list)
86 unsigned int parent_charge)
91 unsigned int max_charge = parent_charge;
94 max_charge = parent_charge - 1;
101 std::vector<SimplePeakIonMatch> match_products;
102 unsigned int charge_i;
105 charge_i = max_charge;
121 unsigned int charge_ion_count[5][20] = {0};
129 charge_dot_product[peptide_ion_match.ion_charge] +=
130 peptide_ion_match.peak.y *
132 sequence, peptide_ion_match.ion_type, peptide_ion_match.ion_size);
133 charge_ion_count[peptide_ion_match.ion_charge]
134 [(std::int8_t)peptide_ion_match.ion_type] += 1;
135 m_ionCount[(std::int8_t)peptide_ion_match.ion_type] += 1;
139 for(
unsigned int i = 1; i <= max_charge; i++)
141 sum_intensity += charge_dot_product[i];
154 QString errorStr = QObject::tr(
"ERROR computing hyperscore, PAPPSO exception:\n%1")
155 .arg(exception_pappso.
qwhat());
156 qDebug() <<
"XtandemHyperscore::XtandemHyperscore PappsoException :\n" << errorStr;
159 catch(std::exception &exception_std)
162 QObject::tr(
"ERROR computing hyperscore, std exception:\n%1").arg(exception_std.what());
163 qDebug() <<
"XtandemHyperscore::XtandemHyperscore std::exception :\n" << errorStr;
172 for(
long c = 64;
c < 126;
c++)
174 ret.insert(std::pair<char, pappso_double>(
c,
pappso_double(1.0)));
184 for(
long c = 64;
c < 126;
c++)
186 ret.insert(std::pair<char, pappso_double>(
c,
pappso_double(1.0)));
202 unsigned int ion_size)
const
206 char last_aa_nter(
'_'), last_aa_cter(
'_');
210 last_aa_nter = sequence[ion_size - 1].toLatin1();
211 last_aa_cter = sequence[ion_size].toLatin1();
214 if(last_aa_nter ==
'P')
226 unsigned int offset(sequence.size() - ion_size);
227 last_aa_nter = sequence[offset - 1].toLatin1();
228 last_aa_cter = sequence[offset].toLatin1();
231 if(last_aa_nter ==
'P')
273 QObject::tr(
"ERROR in getHyperscore, PAPPSO exception:\n%1").arg(exception_pappso.
qwhat());
274 qDebug() <<
"XtandemHyperscore::getHyperscore PappsoException :\n" << errorStr;
277 catch(std::exception &exception_std)
280 QObject::tr(
"ERROR in getHyperscore, std exception:\n%1").arg(exception_std.what());
281 qDebug() <<
"XtandemHyperscore::getHyperscore std::exception :\n" << errorStr;
Class to represent a mass spectrum.
virtual const QString & qwhat() const
void pushBackMatchSpectrum(std::vector< SimplePeakIonMatch > &peak_match_list, const MassSpectrum &spectrum, PrecisionPtr precision, Enums::PeptideIon ion_type, unsigned int charge) const
const QString getSequence() const override
print amino acid sequence without modifications
unsigned int getTotalMatchedIons() const
pappso_double m_protoHyperscore
bool m_isRefineSpectrumSynthesis
static AaFactorMap m_aaIonFactorY
std::map< char, pappso_double > AaFactorMap
std::vector< Enums::PeptideIon > m_ionList
unsigned int getMatchedIons(Enums::PeptideIon ion_type) const
bool computeXtandemHyperscore(const MassSpectrum &spectrum, const Peptide &peptide, unsigned int parent_charge)
PrecisionPtr mp_precision
unsigned int m_ionCount[PEPTIDE_ION_TYPE_COUNT]
unsigned int getXtandemPredictedIonIntensityFactor(const QString &sequence, Enums::PeptideIon ion_type, unsigned int size) const
pappso_double getHyperscore() const
static AaFactorMap m_aaIonFactorBb
unsigned int m_totalMatchedIons
XtandemHyperscoreBis(bool refine_spectrum_synthesis, PrecisionPtr precision, const std::vector< Enums::PeptideIon > &ion_list)
PeptideIon
Enums::PeptideIon enum defines all types of ions (Nter or Cter).
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
double pappso_double
A type definition for doubles.
bool peptideIonIsNter(Enums::PeptideIon ion_type)
tells if an ion is Nter
const PrecisionBase * PrecisionPtr
unsigned int factorial(unsigned int n)
#define PEPTIDE_ION_TYPE_COUNT
only useful for internal use DO not change this value : it is used to define static array size