diff --git a/src/input/mascot/mascotdatparser.cpp b/src/input/mascot/mascotdatparser.cpp index be26914d0ab24e9f6f4169cf81941db2b5edc2fd..5af4fd621e228ba2360aba709628440cc3ab8714 100644 --- a/src/input/mascot/mascotdatparser.cpp +++ b/src/input/mascot/mascotdatparser.cpp @@ -29,6 +29,7 @@ #include "mascotdatparser.h" #include "mimeparser.h" +#include <cmath> #include <QDebug> #include <pappsomspp/pappsoexception.h> #include "../../core/peptidextp.h" @@ -328,7 +329,7 @@ void MascotDatParser::parseSummaryLine(const QString & summary_line) { else if (index.startsWith("qmatch")) { unsigned int query_index = index.mid(6).toUInt(); //_current_query.title = value; - _summary_list[query_index-1].match=value.toUInt(); + _summary_list[query_index-1].match=value.toDouble(); } //qplughole1=14.820890 else if (index.startsWith("qplughole")) { @@ -368,12 +369,18 @@ void MascotDatParser::saveQuery() { peptide_evidence.setExperimentalMass(_summary_list[_current_query.query_index-1].exp_mass); peptide_evidence.setRetentionTime(_current_query.rt); - peptide_evidence.setParam(PeptideEvidenceParam::mascot_macth_score, QVariant(_summary_list[_current_query.query_index-1].match)); - peptide_evidence.setIdentificationDataSource( _p_identification_data_source); //parse and save for(PeptideLine & peptide_line:peptide_list) { + pappso::pappso_double ion_score = peptide_line.peptide_string_list.at(7).toDouble(); + peptide_evidence.setParam(PeptideEvidenceParam::mascot_score, QVariant(ion_score)); + + peptide_evidence.setEvalue(getEvalue(ion_score, _current_query.query_index, 0.05)); + + peptide_evidence.setParam(PeptideEvidenceParam::mascot_expectation_value, QVariant(peptide_evidence.getEvalue())); + + QString peptide_str =peptide_line.peptide_string_list.at(4); if (!peptide_line.subst.isEmpty()) { //q856_p9_subst=1,X,W @@ -426,3 +433,8 @@ void MascotDatParser::saveQuery() { qDebug() << "MascotDatParser::saveQuery end"; } + +pappso::pappso_double MascotDatParser::getEvalue(pappso::pappso_double ion_score, unsigned int query_index, pappso::pappso_double confidence_interval) const { + double identity_threshold = 10.0 * std::log(_summary_list.at(query_index-1).match / (confidence_interval * 20.0)) / log(10);; + return (confidence_interval * pow(10, ((identity_threshold - ion_score) / 10))); +} diff --git a/src/input/mascot/mascotdatparser.h b/src/input/mascot/mascotdatparser.h index d4ef5fd694e03adfc0276ebe464dbc0930f8a038..2e9bfed0de95818a37e341e91315ca35a0d7223e 100644 --- a/src/input/mascot/mascotdatparser.h +++ b/src/input/mascot/mascotdatparser.h @@ -48,6 +48,10 @@ private: void saveQuery(); void saveAndClearPeptide(); + + pappso::pappso_double getEvalue(pappso::pappso_double ion_score, unsigned int query_index, pappso::pappso_double confidence_interval = 0.05) const; + + struct PeptideLine { unsigned int query_index=0; unsigned int peptide_index=0; @@ -63,9 +67,9 @@ private: QString title; }; struct SummaryLine { - unsigned int match=0; + pappso::pappso_double match=0; //qmatch, identity threshold pappso::pappso_double exp_mass=0; - pappso::pappso_double plug_hole=0; + pappso::pappso_double plug_hole=0; //qplughole, homology threshold }; private: Project * _p_project; diff --git a/src/utils/types.h b/src/utils/types.h index 26bc2fd44f7e8aa64902abdbfaa43c234adebf12..a4c17d75f6525632e0a6b8eb3ff5491958e2f0c5 100644 --- a/src/utils/types.h +++ b/src/utils/types.h @@ -51,11 +51,13 @@ enum class IdentificationEngine: std::int8_t { }; /** \def PeptideEvidenceParam peptide evidence specific parameters - * + * is_a: MS:1001143 ! PSM-level search engine specific statistic */ enum class PeptideEvidenceParam: std::int8_t { - tandem_hyperscore=0, ///< X!Tandem hyperscore - mascot_macth_score=1 ///< MASCOT match score + tandem_hyperscore=0, ///< X!Tandem hyperscore MS:1001331 + tandem_expectation_value=1, ///< X!Tandem expectation value MS:1001330 + mascot_score=2, ///< PSI-MS MS:1001171 mascot:score 56.16 + mascot_expectation_value=3///< PSI-MS MS:1001172 mascot:expectation value 2.42102904673618e-006 }; /** \def IdentificationEngineParam identification engine parameters