diff --git a/src/core/peptideevidence.h b/src/core/peptideevidence.h index 79f140d702cbd954420ee8a55651f284fc94e05f..b294cd57fa405aa0e44d9363326348791a4b3752 100644 --- a/src/core/peptideevidence.h +++ b/src/core/peptideevidence.h @@ -85,10 +85,6 @@ public : const std::map<PeptideMatchParam, QVariant> & getParamList() const; - /** @brief get stop position of this peptide inside the protein sequence - * @return stop position in the protein amino acid sequence (starts at 0) - * */ - unsigned int getStop() const; void setCharge(unsigned int charge); void setPeptideXtpSp (PeptideXtpSp peptide); void setIdentificationDataSource(IdentificationDataSource* identification_source); diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index 016645376fa59b5fc58dd09af42d1bcf50e2f9f7..e79fdfc1bbc1797db8b9630b9682860d33cb6cf6 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -128,6 +128,7 @@ void ProteinMatch::setChecked(bool arg1) { } void ProteinMatch::addPeptideMatch(const PeptideMatch & peptide_match) { + qDebug() << "ProteinMatch::addPeptideMatch begin " << peptide_match.getPeptideEvidence()->getPeptideXtpSp().get()->toAbsoluteString(); _peptide_match_list.push_back(peptide_match); } diff --git a/src/utils/peptideevidencestore.cpp b/src/utils/peptideevidencestore.cpp index ad3110da70e086a616a99432b619e152e063d4fd..34384227ad439bc04371d68c80fb4be0c4e5604e 100644 --- a/src/utils/peptideevidencestore.cpp +++ b/src/utils/peptideevidencestore.cpp @@ -30,10 +30,33 @@ ******************************************************************************/ #include "peptideevidencestore.h" +#include <QDebug> #include "../core/peptideevidence.h" std::shared_ptr<PeptideEvidence> & PeptideEvidenceStore::getInstance(const PeptideEvidence * p_peptide_evidence) { + + 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())) { + if (it->second.get()->getPeptideXtpSp().get() == p_peptide_evidence->getPeptideXtpSp().get()) { + //it is the same peptide + find_it = it; + } + it++; + } + + if (find_it == _multimap_scan_evidence.end()) { + // insert it + find_it = _multimap_scan_evidence.insert(std::pair<unsigned int , PeptideEvidenceSp>(p_peptide_evidence->getScan(), p_peptide_evidence->makePeptideEvidenceSp())); + _peptide_evidence_list.push_back(find_it->second); + } + qDebug() << "PeptideEvidenceStore::getInstance end " << find_it->second.get()->getScan() << " size=" << _multimap_scan_evidence.size(); + return find_it->second; + } void PeptideEvidenceStore::updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters) { diff --git a/src/utils/peptideevidencestore.h b/src/utils/peptideevidencestore.h index 374840853f0920cbb30110df27395d42f337726a..49338ec65cbc8f2dcb3895680f2944676f6d9517 100644 --- a/src/utils/peptideevidencestore.h +++ b/src/utils/peptideevidencestore.h @@ -33,6 +33,7 @@ #include <memory> #include <vector> +#include <map> #include "../core/automaticfilterparameters.h" class PeptideEvidence; @@ -44,6 +45,8 @@ public: void updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters); private: std::vector<std::shared_ptr<PeptideEvidence>> _peptide_evidence_list; + + std::multimap<unsigned int ,std::shared_ptr<PeptideEvidence>> _multimap_scan_evidence; }; #endif // PEPTIDEEVIDENCESTORE_H