diff --git a/src/input/mascot/mascotdatparser.cpp b/src/input/mascot/mascotdatparser.cpp index 5af4fd621e228ba2360aba709628440cc3ab8714..d90a480f1338ef1f81111735e0b9c30b75c922f3 100644 --- a/src/input/mascot/mascotdatparser.cpp +++ b/src/input/mascot/mascotdatparser.cpp @@ -320,6 +320,7 @@ void MascotDatParser::parseSummaryLine(const QString & summary_line) { //qmass1=598.300206 if (index.startsWith("qmass")) { unsigned int query_index = index.mid(5).toUInt(); + qDebug() << __FILE__ << " " << __FUNCTION__<< " " << __LINE__ << " " << query_index << " " << index; //_current_query.title = value; _summary_list[query_index-1].exp_mass=value.toDouble(); } @@ -380,7 +381,6 @@ void MascotDatParser::saveQuery() { 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 @@ -394,6 +394,10 @@ void MascotDatParser::saveQuery() { peptide_sp = PeptideXtp(peptide_str).makePeptideXtpSp(); peptide_sp = _p_project->getPeptideStore().getInstance(peptide_sp); + + + qDebug() << "MascotDatParser::saveQuery peptide=" << peptide_str << " evalue=" << peptide_evidence.getEvalue() << " ionscore=" << ion_score; + if (peptide_line.protein_string_list.size() != peptide_line.fasta_file_list.size()) { throw pappso::PappsoException(QObject::tr("ERROR (peptide_line.protein_string_list.size() != peptide_line.fasta_file_list.size()) %1").arg(peptide_line.protein_string_list.join(",\""))); } @@ -435,6 +439,12 @@ void MascotDatParser::saveQuery() { } 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))); + pappso::pappso_double identity_threshold = (pappso::pappso_double)10.0 * std::log(_summary_list.at(query_index-1).match / (confidence_interval * (pappso::pappso_double)20.0)) / log((pappso::pappso_double)10);; + return (confidence_interval * pow((pappso::pappso_double)10, ((identity_threshold - ion_score) / (pappso::pappso_double)10))); +} + +pappso::pappso_double MascotDatParser::getEvalueExperimental(pappso::pappso_double ion_score, unsigned int query_index, pappso::pappso_double confidence_interval) const { + // Evalue experimental Homology threshold (QPlughole value from .dat file). + pappso::pappso_double eval = (ion_score - _summary_list.at(query_index-1).plug_hole) / (pappso::pappso_double)10; + eval = confidence_interval / pow((pappso::pappso_double)10, eval); } diff --git a/src/input/mascot/mascotdatparser.h b/src/input/mascot/mascotdatparser.h index 2e9bfed0de95818a37e341e91315ca35a0d7223e..babf865de62db0c988669ad2d5d8284d9384b0c2 100644 --- a/src/input/mascot/mascotdatparser.h +++ b/src/input/mascot/mascotdatparser.h @@ -47,11 +47,14 @@ private: void parseSummaryLine(const QString & summary_line); 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; + pappso::pappso_double getEvalueExperimental(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; @@ -80,21 +83,21 @@ private: ProteinXtp _current_protein; std::vector<FastaFileSp> _fasta_file_list; - + QRegExp _regexp_header_line; unsigned int _number_of_queries=0; unsigned int _number_of_residues=0; unsigned int _current_query_index=0; QString _error_str; - + PeptideLine _current_peptide; QueryLine _current_query; - + std::vector<std::vector<PeptideLine>> _query_peptide_results; std::vector<SummaryLine> _summary_list; - - + + }; #endif // MASCOTDATPARSER_H