Skip to content
Snippets Groups Projects
Commit 7ffa73c9 authored by Langella Olivier's avatar Langella Olivier
Browse files

WIP: refactoring using PeptideEvidence

parent 4b7d724c
No related branches found
No related tags found
No related merge requests found
......@@ -329,12 +329,12 @@ bool XtandemSaxHandler::endElement_domain() {
bool is_ok = true;
_current_peptide_sp = _p_project->getPeptideStore().getInstance(_current_peptide_sp);
_p_peptide_match->setPeptideXtpSp(_current_peptide_sp);
_p_peptide_evidence->setPeptideXtpSp(_current_peptide_sp);
_current_peptide_match.setPeptideEvidenceSp(_p_peptide_evidence->getIdentificationDataSource()->getPeptideEvidenceStore().getInstance(_p_peptide_evidence));
_p_protein_match->addPeptideMatch(_current_peptide_match);
_p_protein_match->addPeptideMatchSp(_p_peptide_match->getIdentificationDataSource()->getPeptideMatchStore().getInstance(_p_peptide_match));
delete _p_peptide_match;
delete _p_peptide_evidence;
return is_ok;
}
bool XtandemSaxHandler::endElement_note() {
......
......@@ -360,20 +360,20 @@ void MassChroQml::writePeptideList() {
void MassChroQml::writePeptideListInGroup(const GroupingGroup * p_group) {
const std::vector<std::pair<unsigned int, const PeptideMatch *>> & sg_peptide_match_list = p_group->getPairSgNumberPeptideMatchList();
const std::vector<std::pair<unsigned int, const PeptideEvidence *>> & sg_peptide_evidence_list = p_group->getPairSgNumberPeptideEvidenceList();
std::vector<McqPeptide> mcq_peptide_list;
for (auto & sg_peptide_pair :sg_peptide_match_list) {
for (auto & sg_peptide_pair :sg_peptide_evidence_list) {
unsigned int sg_number = sg_peptide_pair.first;
const PeptideMatch * peptide_match = sg_peptide_pair.second;
const PeptideEvidence * peptide_evidence = sg_peptide_pair.second;
McqPeptide mcq_peptide;
mcq_peptide.id = peptide_match->getGrpPeptideSp().get()->getGroupingId();
mcq_peptide.mods << peptide_match->getPeptideXtpSp().get()->getModifString();
mcq_peptide.id = peptide_evidence->getGrpPeptideSp().get()->getGroupingId();
mcq_peptide.mods << peptide_evidence->getPeptideXtpSp().get()->getModifString();
mcq_peptide.prot_ids << p_group->getProteinGroupingIdOfSubgroup(sg_number);
mcq_peptide.seq = peptide_match->getPeptideXtpSp().get()->getSequence();
mcq_peptide.native_peptide = peptide_match->getPeptideXtpSp().get()->getNativePeptideP();
McqObserved observed = {peptide_match->getMsRunP(),peptide_match->getScan(),peptide_match->getCharge() };
mcq_peptide.seq = peptide_evidence->getPeptideXtpSp().get()->getSequence();
mcq_peptide.native_peptide = peptide_evidence->getPeptideXtpSp().get()->getNativePeptideP();
McqObserved observed = {peptide_evidence->getMsRunP(),peptide_evidence->getScan(),peptide_evidence->getCharge() };
mcq_peptide.observed_in.push_back(observed);
mcq_peptide_list.push_back(mcq_peptide);
......
......@@ -77,9 +77,10 @@ void PeptidePosSheet::writeHeaders(IdentificationGroup * p_ident) {
}
void PeptidePosSheet::writeBestPeptideMatch(const ProteinMatch * p_protein_match,const PeptideMatch * p_peptide_match) {
void PeptidePosSheet::writeBestPeptideMatch(const ProteinMatch * p_protein_match,const PeptideMatch & peptide_match) {
_p_writer->writeLine();
const PeptideEvidence * p_peptide_evidence = peptide_match.getPeptideEvidence();
unsigned int group_number = p_protein_match->getGrpProteinSp().get()->getGroupNumber();
......@@ -95,12 +96,12 @@ void PeptidePosSheet::writeBestPeptideMatch(const ProteinMatch * p_protein_match
_p_writer->clearTableCellStyleRef();
_p_writer->writeCell(p_protein_match->getProteinXtpSp().get()->getAccession());
_p_writer->writeCell(p_protein_match->getProteinXtpSp().get()->getDescription());
_p_writer->writeCell(p_peptide_match->getGrpPeptideSp().get()->getGroupingId());
_p_writer->writeCell(p_peptide_match->getPeptideXtpSp().get()->getSequence());
_p_writer->writeCell(p_peptide_match->getPeptideXtpSp().get()->getModifString());
_p_writer->writeCell(p_peptide_match->getStart()+1);
_p_writer->writeCell(p_peptide_match->getStart()+p_peptide_match->getPeptideXtpSp().get()->getSequence().size());
_p_writer->writeCell(p_peptide_match->getPeptideXtpSp().get()->getMz(1));
_p_writer->writeCell(p_peptide_evidence->getGrpPeptideSp().get()->getGroupingId());
_p_writer->writeCell(p_peptide_evidence->getPeptideXtpSp().get()->getSequence());
_p_writer->writeCell(p_peptide_evidence->getPeptideXtpSp().get()->getModifString());
_p_writer->writeCell(peptide_match.getStart()+1);
_p_writer->writeCell(peptide_match.getStart()+p_peptide_evidence->getPeptideXtpSp().get()->getSequence().size());
_p_writer->writeCell(p_peptide_evidence->getPeptideXtpSp().get()->getMz(1));
}
......
......@@ -44,7 +44,7 @@ public :
private :
void writeIdentificationGroup(IdentificationGroup * p_ident);
void writeHeaders(IdentificationGroup * p_ident);
void writeBestPeptideMatch(const ProteinMatch * p_protein_match, const PeptideMatch * p_peptide_match);
void writeBestPeptideMatch(const ProteinMatch * p_protein_match, const PeptideMatch & peptide_match);
private :
OdsExport * _p_ods_export;
......
......@@ -79,10 +79,10 @@ void PeptideSheet::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)
{
return a->getGrpPeptideSp().get()->getRank() < b->getGrpPeptideSp().get()->getRank();
});
......@@ -90,13 +90,13 @@ void PeptideSheet::writeIdentificationGroup(IdentificationGroup * p_ident) {
const PeptideMatch * p_best_peptide_match = nullptr;
_sample_scan_list.clear();
for (auto & peptide_match:peptide_match_list) {
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;
}
if (p_best_peptide_match->getGrpPeptideSp().get() != peptide_match->getGrpPeptideSp().get()) {
//write p_best_peptide_match
writeBestPeptideMatch(group_pair.second.get(), p_best_peptide_match);
writeBestPeptideMatch(group_pair.second.get(), *p_best_peptide_match);
p_best_peptide_match = peptide_match;
}
else {
......
......@@ -32,6 +32,7 @@
#define PEPTIDEEVIDENCESTORE_H
#include <memory>
#include <vector>
#include "../core/automaticfilterparameters.h"
class PeptideEvidence;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment