diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index 27f8b2bffae35a4840eac8daab8a70b09efb1ab5..c1657579f7f7a3cfce484ef56628b5485645e23a 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -812,7 +812,7 @@ ProteinMatch::collectPeptideEvidences( QString ProteinMatch::getFlankingNterRegion(const PeptideMatch &peptide_match, - int orig_length) + int orig_length) const { int length = orig_length; int start = peptide_match.getStart() - length; @@ -836,7 +836,7 @@ ProteinMatch::getFlankingNterRegion(const PeptideMatch &peptide_match, QString ProteinMatch::getFlankingCterRegion(const PeptideMatch &peptide_match, - int orig_length) + int orig_length) const { int start = peptide_match.getStop(); int max = getProteinXtpSp().get()->getSequence().size(); diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index b8fb3b6dcd7564d8a9857dc272fdbc0acb0b027a..218deeffeb92897cd55e2298f3cf7290846d9f96 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -188,13 +188,15 @@ class ProteinMatch * @param peptide_match the peptide from which we want flanking region * @param length size of the protein flanking region */ - QString getFlankingNterRegion(const PeptideMatch &peptide_match, int length); + QString getFlankingNterRegion(const PeptideMatch &peptide_match, + int length) const; /** @brief get the flanking protein sequence at the Cter side of the peptide * @param peptide_match the peptide from which we want flanking region * @param length size of the protein flanking region */ - QString getFlankingCterRegion(const PeptideMatch &peptide_match, int length); + QString getFlankingCterRegion(const PeptideMatch &peptide_match, + int length) const; protected: void setGroupingExperiment(GroupingExperiment *p_grp_experiment); diff --git a/src/output/ods/peptidepossheet.cpp b/src/output/ods/peptidepossheet.cpp index 9918513ab2ae6008b353b0a3e6410612ee4c1a42..4b66f6ab557585933ddf06fc014824cef7dfb5ea 100644 --- a/src/output/ods/peptidepossheet.cpp +++ b/src/output/ods/peptidepossheet.cpp @@ -82,12 +82,14 @@ PeptidePosSheet::writeHeaders(IdentificationGroup *p_ident) _p_writer->writeCell("Protein ID"); _p_writer->writeCell("accession"); _p_writer->writeCell("description"); - _p_writer->writeCell("Peptide ID"); - _p_writer->writeCell("Sequence"); - _p_writer->writeCell("Modifs"); - _p_writer->writeCell("Start"); + writeCellHeader(PeptideListColumn::peptide_grouping_id); + writeCellHeader(PeptideListColumn::sequence_nter); + writeCellHeader(PeptideListColumn::sequence); + writeCellHeader(PeptideListColumn::sequence_cter); + writeCellHeader(PeptideListColumn::modifs); + writeCellHeader(PeptideListColumn::start); _p_writer->writeCell("Stop"); - _p_writer->writeCell("MH+ theo"); + writeCellHeader(PeptideListColumn::theoretical_mhplus); } void @@ -121,8 +123,12 @@ PeptidePosSheet::writeBestPeptideMatch(const ProteinMatch *p_protein_match, p_protein_match->getProteinXtpSp().get()->getDescription()); _p_writer->writeCell( p_peptide_evidence->getGrpPeptideSp().get()->getGroupingId()); + _p_writer->writeCell( + p_protein_match->getFlankingNterRegion(peptide_match, 1)); _p_writer->writeCell( p_peptide_evidence->getPeptideXtpSp().get()->getSequence()); + _p_writer->writeCell( + p_protein_match->getFlankingCterRegion(peptide_match, 1)); _p_writer->writeCell( p_peptide_evidence->getPeptideXtpSp().get()->getModifString()); _p_writer->writeCell(peptide_match.getStart() + 1); @@ -149,7 +155,8 @@ PeptidePosSheet::writeIdentificationGroup(IdentificationGroup *p_ident) } std::sort( - protein_match_list.begin(), protein_match_list.end(), + protein_match_list.begin(), + protein_match_list.end(), [](const ProteinMatch *a, const ProteinMatch *b) { unsigned int agroup = a->getGrpProteinSp().get()->getGroupNumber(); unsigned int asubgroup = a->getGrpProteinSp().get()->getSubGroupNumber(); @@ -174,7 +181,8 @@ PeptidePosSheet::writeIdentificationGroup(IdentificationGroup *p_ident) continue; peptide_match_list.push_back(peptide_match); } - std::sort(peptide_match_list.begin(), peptide_match_list.end(), + std::sort(peptide_match_list.begin(), + peptide_match_list.end(), [](const PeptideMatch &a, const PeptideMatch &b) { unsigned int arank = a.getPeptideEvidence()->getGrpPeptideSp().get()->getRank(); @@ -231,3 +239,14 @@ PeptidePosSheet::writeIdentificationGroup(IdentificationGroup *p_ident) _p_writer->writeLine(); qDebug() << "PeptidePosSheet::writeIdentificationGroup end"; } + + +void +PeptidePosSheet::writeCellHeader(PeptideListColumn column) +{ + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ + << (std::int8_t)column; + _p_writer->setCellAnnotation(PeptideTableModel::getDescription(column)); + _p_writer->writeCell(PeptideTableModel::getTitle(column)); + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; +} diff --git a/src/output/ods/peptidepossheet.h b/src/output/ods/peptidepossheet.h index a7b32bf8cfc34ea6a970f7abc372fb21d37ceaf1..83b55fa34819009f2e48b703032be4b190efd082 100644 --- a/src/output/ods/peptidepossheet.h +++ b/src/output/ods/peptidepossheet.h @@ -37,11 +37,13 @@ #include <odsstream/calcwriterinterface.h> #include "../../core/proteinmatch.h" #include "odsexport.h" +#include "../../gui/peptide_list_view/peptidetablemodel.h" class PeptidePosSheet { public: - PeptidePosSheet(OdsExport *p_ods_export, CalcWriterInterface *p_writer, + PeptidePosSheet(OdsExport *p_ods_export, + CalcWriterInterface *p_writer, const Project *p_project); private: @@ -50,6 +52,8 @@ class PeptidePosSheet void writeBestPeptideMatch(const ProteinMatch *p_protein_match, const PeptideMatch &peptide_match); + void writeCellHeader(PeptideListColumn column); + private: OdsExport *_p_ods_export; const Project *_p_project; diff --git a/src/output/ods/proteinsheet.cpp b/src/output/ods/proteinsheet.cpp index 70fc14d52dc9e2f845dfa35bcca583a9dfd809e5..87111d39110be0d4c80ea7fc340577f46e22b837 100644 --- a/src/output/ods/proteinsheet.cpp +++ b/src/output/ods/proteinsheet.cpp @@ -58,10 +58,11 @@ ProteinSheet::ProteinSheet(OdsExport *p_ods_export, void ProteinSheet::writeCellHeader(ProteinListColumn column) { - qDebug() << "ProteinSheet::writeCellHeader begin " << (std::int8_t)column; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ + << (std::int8_t)column; _p_writer->setCellAnnotation(ProteinTableModel::getDescription(column)); _p_writer->writeCell(ProteinTableModel::getTitle(column)); - qDebug() << "ProteinSheet::writeCellHeader end"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; } void @@ -141,7 +142,8 @@ ProteinSheet::writeIdentificationGroup(IdentificationGroup *p_ident) std::vector<const ProteinMatch *> protein_match_list = group_pair.second.get()->getProteinMatchList(); - std::sort(protein_match_list.begin(), protein_match_list.end(), + std::sort(protein_match_list.begin(), + protein_match_list.end(), [](const ProteinMatch *a, const ProteinMatch *b) { return a->getGrpProteinSp().get()->getGroupingId() < b->getGrpProteinSp().get()->getGroupingId();