diff --git a/src/output/ods/peptidepossheet.cpp b/src/output/ods/peptidepossheet.cpp index 4c30bbbb67f2214d70ef3556adbde08385210155..28809ac3c7c16e502302f587bf80e3742f5a0239 100644 --- a/src/output/ods/peptidepossheet.cpp +++ b/src/output/ods/peptidepossheet.cpp @@ -133,19 +133,19 @@ void PeptidePosSheet::writeIdentificationGroup(IdentificationGroup * p_ident) { for (ProteinMatch * p_protein_match : protein_match_list) { - std::vector<PeptideMatch *> peptide_match_list; + std::vector<PeptideMatch> peptide_match_list; for (auto & peptide_match: p_protein_match->getPeptideMatchList()) { - if (peptide_match->getValidationState() < ValidationState::grouped) continue; + if (peptide_match.getPeptideEvidence()->getValidationState() < ValidationState::grouped) continue; peptide_match_list.push_back(peptide_match); } std::sort(peptide_match_list.begin(), peptide_match_list.end(), - [](const PeptideMatch * a, const PeptideMatch * b) + [](const PeptideMatch & a, const PeptideMatch & b) { - unsigned int arank = a->getGrpPeptideSp().get()->getRank(); - unsigned int aposition = a->getStart(); - unsigned int brank = b->getGrpPeptideSp().get()->getRank(); - unsigned int bposition = b->getStart(); + unsigned int arank = a.getPeptideEvidence()->getGrpPeptideSp().get()->getRank(); + unsigned int aposition = a.getStart(); + unsigned int brank = b.getPeptideEvidence()->getGrpPeptideSp().get()->getRank(); + unsigned int bposition = b.getStart(); return std::tie(arank, aposition) < std::tie(brank, bposition); }); @@ -153,28 +153,28 @@ void PeptidePosSheet::writeIdentificationGroup(IdentificationGroup * p_ident) { for (auto & peptide_match:peptide_match_list) { if (p_best_peptide_match == nullptr) { - p_best_peptide_match = peptide_match; + p_best_peptide_match = &peptide_match; } //change spectra : - unsigned int arank = p_best_peptide_match->getGrpPeptideSp().get()->getRank(); + unsigned int arank = p_best_peptide_match->getPeptideEvidence()->getGrpPeptideSp().get()->getRank(); unsigned int aposition = p_best_peptide_match->getStart(); - unsigned int brank = peptide_match->getGrpPeptideSp().get()->getRank(); - unsigned int bposition = peptide_match->getStart(); + unsigned int brank = peptide_match.getPeptideEvidence()->getGrpPeptideSp().get()->getRank(); + unsigned int bposition = peptide_match.getStart(); if (std::tie(arank, aposition) != std::tie(brank, bposition)) { //write p_best_peptide_match - writeBestPeptideMatch(p_protein_match, p_best_peptide_match); - p_best_peptide_match = peptide_match; + writeBestPeptideMatch(p_protein_match, *p_best_peptide_match); + p_best_peptide_match = &peptide_match; } else { - if (p_best_peptide_match->getEvalue()> peptide_match->getEvalue()) { - p_best_peptide_match = peptide_match; + if (p_best_peptide_match->getPeptideEvidence()->getEvalue()> peptide_match.getPeptideEvidence()->getEvalue()) { + p_best_peptide_match = &peptide_match; } } } if (p_best_peptide_match != nullptr) { - writeBestPeptideMatch(p_protein_match, p_best_peptide_match); + writeBestPeptideMatch(p_protein_match, *p_best_peptide_match); } } diff --git a/src/output/ods/peptidesheet.cpp b/src/output/ods/peptidesheet.cpp index 5452af8b34a4acd2ede33f35be7420c09656df7e..50e8a62f772e5a471acfa061a8073fda64508f67 100644 --- a/src/output/ods/peptidesheet.cpp +++ b/src/output/ods/peptidesheet.cpp @@ -87,35 +87,35 @@ void PeptideSheet::writeIdentificationGroup(IdentificationGroup * p_ident) { return a->getGrpPeptideSp().get()->getRank() < b->getGrpPeptideSp().get()->getRank(); }); - const PeptideMatch * p_best_peptide_match = nullptr; + const PeptideEvidence * p_best_peptide_evidence = nullptr; _sample_scan_list.clear(); - for (auto & peptide_match: peptide_match_list) { - if (p_best_peptide_match == nullptr) { - p_best_peptide_match = &peptide_match; + for (auto & peptide_evidence: peptide_evidence_list) { + if (p_best_peptide_evidence == nullptr) { + p_best_peptide_evidence = peptide_evidence; } - if (p_best_peptide_match->getGrpPeptideSp().get() != peptide_match->getGrpPeptideSp().get()) { + if (p_best_peptide_evidence->getGrpPeptideSp().get() != peptide_evidence->getGrpPeptideSp().get()) { //write p_best_peptide_match - writeBestPeptideMatch(group_pair.second.get(), *p_best_peptide_match); - p_best_peptide_match = peptide_match; + writeBestPeptideEvidence(group_pair.second.get(), p_best_peptide_evidence); + p_best_peptide_evidence = peptide_evidence; } else { - if (p_best_peptide_match->getEvalue()> peptide_match->getEvalue()) { - p_best_peptide_match = peptide_match; + if (p_best_peptide_evidence->getEvalue()> peptide_evidence->getEvalue()) { + p_best_peptide_evidence = peptide_evidence; } } - _sample_scan_list.push_back(peptide_match->getHashSampleScan()); + _sample_scan_list.push_back(peptide_evidence->getHashSampleScan()); } - if (p_best_peptide_match != nullptr) { - writeBestPeptideMatch(group_pair.second.get(), p_best_peptide_match); + if (p_best_peptide_evidence != nullptr) { + writeBestPeptideEvidence(group_pair.second.get(), p_best_peptide_evidence); } } _p_writer->writeLine(); _p_writer->writeLine(); } -void PeptideSheet::writeBestPeptideMatch(const GroupingGroup * p_group,const PeptideMatch * p_peptide_match) { +void PeptideSheet::writeBestPeptideEvidence(const GroupingGroup * p_group,const PeptideEvidence * p_peptide_evidence) { std::sort(_sample_scan_list.begin(), _sample_scan_list.end()); auto last = std::unique(_sample_scan_list.begin(), _sample_scan_list.end()); @@ -124,17 +124,17 @@ void PeptideSheet::writeBestPeptideMatch(const GroupingGroup * p_group,const Pep _p_writer->writeLine(); - unsigned int group_number = p_peptide_match->getGrpPeptideSp().get()->getGroupNumber(); + unsigned int group_number = p_peptide_evidence->getGrpPeptideSp().get()->getGroupNumber(); _p_ods_export->setEvenOrOddStyle(group_number, _p_writer); _p_writer->writeCell(pappso::Utils::getLexicalOrderedString(group_number)); _p_writer->clearTableCellStyleRef(); - _p_writer->writeCell(p_peptide_match->getGrpPeptideSp().get()->getGroupingId()); - _p_writer->writeCell(p_peptide_match->getGrpPeptideSp().get()->getSequence()); - _p_writer->writeCell(p_peptide_match->getPeptideXtpSp().get()->getModifString()); - _p_writer->writeCell(p_peptide_match->getCharge()); - _p_writer->writeCell(p_peptide_match->getPeptideXtpSp().get()->getNativePeptideP()->getMz(1)); - QStringList sg_list = p_group->getSubgroupIdList(p_peptide_match); + _p_writer->writeCell(p_peptide_evidence->getGrpPeptideSp().get()->getGroupingId()); + _p_writer->writeCell(p_peptide_evidence->getGrpPeptideSp().get()->getSequence()); + _p_writer->writeCell(p_peptide_evidence->getPeptideXtpSp().get()->getModifString()); + _p_writer->writeCell(p_peptide_evidence->getCharge()); + _p_writer->writeCell(p_peptide_evidence->getPeptideXtpSp().get()->getNativePeptideP()->getMz(1)); + QStringList sg_list = p_group->getSubgroupIdList(p_peptide_evidence); _p_writer->writeCell((unsigned int) sg_list.size()); _p_writer->writeCell(sg_list.join(" ")); _p_writer->writeCell((unsigned int) _sample_scan_list.size()); diff --git a/src/output/ods/peptidesheet.h b/src/output/ods/peptidesheet.h index e9968f8ea80c3f020e5ee761b2b51de244e44f91..8820e7e1b67c003dbed65375ec523bf24e5e808a 100644 --- a/src/output/ods/peptidesheet.h +++ b/src/output/ods/peptidesheet.h @@ -42,7 +42,7 @@ public : private : void writeIdentificationGroup(IdentificationGroup * p_ident); void writeHeaders(IdentificationGroup * p_ident); - void writeBestPeptideMatch(const GroupingGroup * p_group, const PeptideMatch * p_peptide_match); + void writeBestPeptideEvidence(const GroupingGroup * p_group, const PeptideEvidence * p_peptide_evidence); private : OdsExport * _p_ods_export; diff --git a/src/output/ods/spectrasheet.cpp b/src/output/ods/spectrasheet.cpp index f21fba7bee94c73df31975e355a7aa2eff25ed81..e4eed6da624aa158c7de9c9abbdff6c9f363444b 100644 --- a/src/output/ods/spectrasheet.cpp +++ b/src/output/ods/spectrasheet.cpp @@ -80,26 +80,25 @@ void SpectraSheet::writeHeaders(IdentificationGroup * p_ident) { } -void SpectraSheet::writeBestPeptideMatch(const GroupingGroup * p_group,const PeptideMatch * p_peptide_match) { +void SpectraSheet::writeBestPeptideEvidence(const GroupingGroup * p_group,const PeptideEvidence * p_peptide_evidence) { _p_writer->writeLine(); - - unsigned int group_number = p_peptide_match->getGrpPeptideSp().get()->getGroupNumber(); - unsigned int rank_number = p_peptide_match->getGrpPeptideSp().get()->getRank(); + unsigned int group_number = p_peptide_evidence->getGrpPeptideSp().get()->getGroupNumber(); + unsigned int rank_number = p_peptide_evidence->getGrpPeptideSp().get()->getRank(); _p_ods_export->setEvenOrOddStyle(group_number, _p_writer); _p_writer->writeCell(pappso::Utils::getLexicalOrderedString(group_number)); _p_ods_export->setEvenOrOddStyle(rank_number, _p_writer); - _p_writer->writeCell(p_peptide_match->getGrpPeptideSp().get()->getGroupingId()); + _p_writer->writeCell(p_peptide_evidence->getGrpPeptideSp().get()->getGroupingId()); _p_writer->clearTableCellStyleRef(); - _p_writer->writeCell(p_peptide_match->getMsRunP()->getSampleName()); - _p_writer->writeCell(p_peptide_match->getScan()); - _p_writer->writeCell(p_peptide_match->getRetentionTime()); - _p_writer->writeCell(p_peptide_match->getPeptideXtpSp().get()->getSequence()); - _p_writer->writeCell(p_peptide_match->getPeptideXtpSp().get()->getModifString()); + _p_writer->writeCell(p_peptide_evidence->getMsRunP()->getSampleName()); + _p_writer->writeCell(p_peptide_evidence->getScan()); + _p_writer->writeCell(p_peptide_evidence->getRetentionTime()); + _p_writer->writeCell(p_peptide_evidence->getPeptideXtpSp().get()->getSequence()); + _p_writer->writeCell(p_peptide_evidence->getPeptideXtpSp().get()->getModifString()); if (_p_project->getLabelingMethodSp().get() != nullptr) { - const Label * p_label = p_peptide_match->getPeptideXtpSp().get()->getLabel(); + const Label * p_label = p_peptide_evidence->getPeptideXtpSp().get()->getLabel(); if (p_label != nullptr) { _p_writer->writeCell(p_label->getXmlId()); } @@ -107,8 +106,8 @@ void SpectraSheet::writeBestPeptideMatch(const GroupingGroup * p_group,const Pep _p_writer->writeEmptyCell(); } } - _p_writer->writeCell(p_peptide_match->getEvalue()); - _p_writer->writeCell(p_peptide_match->getParam(PeptideMatchParam::tandem_hyperscore).toDouble()); + _p_writer->writeCell(p_peptide_evidence->getEvalue()); + _p_writer->writeCell(p_peptide_evidence->getParam(PeptideMatchParam::tandem_hyperscore).toDouble()); } @@ -118,10 +117,10 @@ void SpectraSheet::writeIdentificationGroup(IdentificationGroup * p_ident) { writeHeaders(p_ident); for (const std::pair<unsigned int, GroupingGroupSp> & group_pair : p_ident->getGroupStore().getGroupMap()) { - std::vector<const PeptideMatch *> peptide_match_list = group_pair.second.get()->getPeptideMatchList(); + std::vector<const PeptideEvidence *> peptide_evidence_list = group_pair.second.get()->getPeptideEvidenceList(); - std::sort(peptide_match_list.begin(), peptide_match_list.end(), - [](const PeptideMatch * a, const PeptideMatch * b) + std::sort(peptide_evidence_list.begin(), peptide_evidence_list.end(), + [](const PeptideEvidence * a, const PeptideEvidence * b) { unsigned int arank = a->getGrpPeptideSp().get()->getRank(); unsigned int ascan = a->getScan(); @@ -130,32 +129,32 @@ void SpectraSheet::writeIdentificationGroup(IdentificationGroup * p_ident) { return std::tie(arank, a->getMsRunP()->getSampleName(), ascan) < std::tie(brank, b->getMsRunP()->getSampleName(), bscan); }); - const PeptideMatch * p_best_peptide_match = nullptr; + const PeptideEvidence * p_best_peptide_evidence = nullptr; - for (auto & peptide_match:peptide_match_list) { - if (p_best_peptide_match == nullptr) { - p_best_peptide_match = peptide_match; + for (auto & peptide_evidence:peptide_evidence_list) { + if (p_best_peptide_evidence == nullptr) { + p_best_peptide_evidence = peptide_evidence; } //change spectra : - unsigned int arank = p_best_peptide_match->getGrpPeptideSp().get()->getRank(); - unsigned int ascan = p_best_peptide_match->getScan(); - unsigned int brank = peptide_match->getGrpPeptideSp().get()->getRank(); - unsigned int bscan = peptide_match->getScan(); + unsigned int arank = p_best_peptide_evidence->getGrpPeptideSp().get()->getRank(); + unsigned int ascan = p_best_peptide_evidence->getScan(); + unsigned int brank = peptide_evidence->getGrpPeptideSp().get()->getRank(); + unsigned int bscan = peptide_evidence->getScan(); - if (std::tie(arank, p_best_peptide_match->getMsRunP()->getSampleName(), ascan) != std::tie(brank, peptide_match->getMsRunP()->getSampleName(), bscan)) { + if (std::tie(arank, p_best_peptide_evidence->getMsRunP()->getSampleName(), ascan) != std::tie(brank, peptide_evidence->getMsRunP()->getSampleName(), bscan)) { //write p_best_peptide_match - writeBestPeptideMatch(group_pair.second.get(), p_best_peptide_match); - p_best_peptide_match = peptide_match; + writeBestPeptideEvidence(group_pair.second.get(), p_best_peptide_evidence); + p_best_peptide_evidence = peptide_evidence; } else { - if (p_best_peptide_match->getEvalue()> peptide_match->getEvalue()) { - p_best_peptide_match = peptide_match; + if (p_best_peptide_evidence->getEvalue()> peptide_evidence->getEvalue()) { + p_best_peptide_evidence = peptide_evidence; } } } - if (p_best_peptide_match != nullptr) { - writeBestPeptideMatch(group_pair.second.get(), p_best_peptide_match); + if (p_best_peptide_evidence != nullptr) { + writeBestPeptideEvidence(group_pair.second.get(), p_best_peptide_evidence); } } _p_writer->writeLine(); diff --git a/src/output/ods/spectrasheet.h b/src/output/ods/spectrasheet.h index 2db54d966bad6eb7bad5d0aa6bc03a30dad79249..c4303121393ef36fc87c3f02e2191fc1f5324b2d 100644 --- a/src/output/ods/spectrasheet.h +++ b/src/output/ods/spectrasheet.h @@ -42,7 +42,7 @@ public : private : void writeIdentificationGroup(IdentificationGroup * p_ident); void writeHeaders(IdentificationGroup * p_ident); - void writeBestPeptideMatch(const GroupingGroup * p_group, const PeptideMatch * p_peptide_match); + void writeBestPeptideEvidence(const GroupingGroup * p_group, const PeptideEvidence * p_peptide_evidence); private : OdsExport * _p_ods_export; diff --git a/src/output/proticdbml.cpp b/src/output/proticdbml.cpp index 159bf161230dafca6f798386ea55b948f1b9538e..7fe9ae1707a5bb688af985f501638f55ac38a5d8 100644 --- a/src/output/proticdbml.cpp +++ b/src/output/proticdbml.cpp @@ -418,8 +418,8 @@ void ProticdbMl::writepeptideHits(IdentificationGroup * p_identification) { _output_stream->writeEndElement();// "peptideHits"); } -QString getProticPeptideHitKey(const PeptideMatch * p_peptide_match) { - return (QString ("%1 %2 %3").arg(p_peptide_match->getHashSampleScan()).arg(p_peptide_match->getPeptideXtpSp().get()->toAbsoluteString()).arg(p_peptide_match->getIdentificationDataSource()->getResourceName())); +QString getProticPeptideHitKey(const PeptideEvidence * p_peptide_evidence) { + return (QString ("%1 %2 %3").arg(p_peptide_evidence->getHashSampleScan()).arg(p_peptide_evidence->getPeptideXtpSp().get()->toAbsoluteString()).arg(p_peptide_evidence->getIdentificationDataSource()->getResourceName())); } struct ProticPeptideHit { @@ -437,8 +437,8 @@ void ProticdbMl::writepeptideHitsbyGroup(GroupingGroup * p_group) { std::vector <ProticPeptideHit> protic_peptide_hit_list; for (const ProteinMatch* p_protein_match : p_group->getProteinMatchList()) { - for (const PeptideMatch* p_peptide_match : p_protein_match->getPeptideMatchList(ValidationState::grouped)) { - ProticPeptideHit protic_peptide_hit = {getProticPeptideHitKey(p_peptide_match), p_peptide_match}; + for (const PeptideMatch & peptide_match : p_protein_match->getPeptideMatchList(ValidationState::grouped)) { + ProticPeptideHit protic_peptide_hit = {getProticPeptideHitKey(peptide_match.getPeptideEvidence()), &peptide_match}; protic_peptide_hit_list.push_back(protic_peptide_hit); } }