From d0769d1cab01fbe3805086cc5380238fa2fd1643 Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Tue, 6 Mar 2018 22:52:40 +0100 Subject: [PATCH] WIP: Mascot parser --- src/core/peptideevidence.h | 2 +- src/core/proteinmatch.cpp | 9 ++++++--- src/input/mascot/mascotdatparser.cpp | 15 +++++++-------- src/utils/peptideevidencestore.cpp | 5 +++-- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/core/peptideevidence.h b/src/core/peptideevidence.h index 296efc9b..4e727774 100644 --- a/src/core/peptideevidence.h +++ b/src/core/peptideevidence.h @@ -134,7 +134,7 @@ public : private : static std::hash<std::string> _hash_fn; MsRun * _msrunid_sp; - unsigned int _scan; + unsigned int _scan=0; size_t _hash_sample_scan; pappso::GrpPeptideSp _sp_grp_peptide; PeptideXtpSp _peptide_sp; diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index 43438cbc..1bf326c9 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -53,7 +53,7 @@ ValidationState ProteinMatch::getValidationState() const { } void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters) { - //qDebug() <<"ProteinMatch::updateAutomaticFilters begin " ; + //qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; _proxy_valid = false; unsigned int number_of_valid_peptides =0; bool cross_sample = automatic_filter_parameters.getFilterCrossSamplePeptideNumber(); @@ -75,7 +75,7 @@ void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & auto } } } - + //qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; // qDebug() <<"ProteinMatch::updateAutomaticFilters begin 2" ; if (number_of_valid_peptides == 0) { @@ -90,7 +90,8 @@ void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & auto } } } - // qDebug() <<"ProteinMatch::updateAutomaticFilters end " << number_of_valid_peptides ; + + //qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; } const ProteinXtpSp & ProteinMatch::getProteinXtpSp() const { @@ -223,6 +224,7 @@ unsigned int ProteinMatch::countPeptideMatch(ValidationState state) const { } size_t ProteinMatch::countSequenceLi(ValidationState state, const MsRun * p_msrun_id) const { + //qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; std::set<QString> sequence_list; for (auto & peptide_match : _peptide_match_list) { if (peptide_match.getPeptideEvidence()->getValidationState() >= state) { @@ -239,6 +241,7 @@ size_t ProteinMatch::countSequenceLi(ValidationState state, const MsRun * p_msru } } //qDebug() <<"ProteinMatch::countValidAndCheckedPeptide end " << sequence_list.size(); + //qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; return sequence_list.size(); } diff --git a/src/input/mascot/mascotdatparser.cpp b/src/input/mascot/mascotdatparser.cpp index d90a480f..cc2be6ef 100644 --- a/src/input/mascot/mascotdatparser.cpp +++ b/src/input/mascot/mascotdatparser.cpp @@ -281,7 +281,7 @@ void MascotDatParser::parseQueryLine(const QString & query_line) { } //charge=2+ else if (index == "charge") { - _current_query.charge = value.toUInt(); + _current_query.charge = value.mid(0,value.size()-1).toUInt(); } } /* @@ -360,7 +360,7 @@ void MascotDatParser::saveAndClearPeptide() { void MascotDatParser::saveQuery() { - qDebug() << "MascotDatParser::saveQuery begin"; + qDebug() << __FILE__ << " " << __FUNCTION__<< " " << __LINE__; if (_current_query.query_index > 0) { std::vector< PeptideLine> peptide_list = _query_peptide_results[_current_query.query_index-1]; @@ -392,11 +392,11 @@ void MascotDatParser::saveQuery() { } PeptideXtpSp peptide_sp; peptide_sp = PeptideXtp(peptide_str).makePeptideXtpSp(); - peptide_sp = _p_project->getPeptideStore().getInstance(peptide_sp); + peptide_evidence.setPeptideXtpSp(_p_project->getPeptideStore().getInstance(peptide_sp)); - qDebug() << "MascotDatParser::saveQuery peptide=" << peptide_str << " evalue=" << peptide_evidence.getEvalue() << " ionscore=" << ion_score; + qDebug() << __FILE__ << " " << __FUNCTION__<< " 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(",\""))); @@ -413,7 +413,7 @@ void MascotDatParser::saveQuery() { } unsigned int start = position_list.at(1).toUInt(); unsigned int stop = position_list.at(2).toUInt(); - + qDebug() << __FILE__ << " " << __FUNCTION__<< " " << __LINE__; ProteinXtp protein; protein.setAccession(accession); @@ -421,7 +421,7 @@ void MascotDatParser::saveQuery() { if (p_protein_match == nullptr) { throw pappso::PappsoException(QObject::tr("ERROR (p_protein_match == nullptr) %1").arg(str)); } - + qDebug() << __FILE__ << " " << __FUNCTION__<< " " << __LINE__; ProteinXtpSp sp_xtp_protein = protein.makeProteinXtpSp(); p_protein_match->setProteinXtpSp(_p_project->getProteinStore().getInstance(sp_xtp_protein)); p_protein_match->setChecked(true); @@ -434,8 +434,7 @@ void MascotDatParser::saveQuery() { } } } - - qDebug() << "MascotDatParser::saveQuery end"; + qDebug() << __FILE__ << " " << __FUNCTION__<< " " << __LINE__; } pappso::pappso_double MascotDatParser::getEvalue(pappso::pappso_double ion_score, unsigned int query_index, pappso::pappso_double confidence_interval) const { diff --git a/src/utils/peptideevidencestore.cpp b/src/utils/peptideevidencestore.cpp index c6ab7295..e2ebd231 100644 --- a/src/utils/peptideevidencestore.cpp +++ b/src/utils/peptideevidencestore.cpp @@ -42,13 +42,13 @@ std::shared_ptr<PeptideEvidence> & PeptideEvidenceStore::recordInstance(const Pe } std::shared_ptr<PeptideEvidence> & PeptideEvidenceStore::getInstance(const PeptideEvidence * p_peptide_evidence) { - + //qDebug() << __FILE__ << " " << __FUNCTION__<< " " << __LINE__ << " scan=" << p_peptide_evidence->getScan(); //qDebug() << "PeptideEvidenceStore::getInstance begin" ; std::multimap<unsigned int ,PeptideEvidenceSp>::iterator it = _multimap_scan_evidence.find(p_peptide_evidence->getScan()); std::multimap<unsigned int ,PeptideEvidenceSp>::iterator find_it = _multimap_scan_evidence.end(); - while ((find_it == _multimap_scan_evidence.end()) && (it->first == p_peptide_evidence->getScan())) { + while ((find_it == _multimap_scan_evidence.end()) && (it->first == p_peptide_evidence->getScan()) && (it != find_it)) { if (it->second.get()->getPeptideXtpSp().get() == p_peptide_evidence->getPeptideXtpSp().get()) { //it is the same peptide find_it = it; @@ -65,6 +65,7 @@ std::shared_ptr<PeptideEvidence> & PeptideEvidenceStore::getInstance(const Pepti _peptide_evidence_list.push_back(find_it->second); } //qDebug() << "PeptideEvidenceStore::getInstance end " << find_it->second.get()->getScan() << " size=" << _multimap_scan_evidence.size(); + //qDebug() << __FILE__ << " " << __FUNCTION__<< " " << __LINE__; return find_it->second; } -- GitLab