diff --git a/src/output/ods/comparbasesheet.cpp b/src/output/ods/comparbasesheet.cpp index c91593deb829c4347ccebd187a9ebf01e37b7e86..627e1c7229a7f4fcef149b786fcbdd78e59c3d95 100644 --- a/src/output/ods/comparbasesheet.cpp +++ b/src/output/ods/comparbasesheet.cpp @@ -42,6 +42,10 @@ ComparBaseSheet::ComparBaseSheet(OdsExport *p_ods_export, { _p_ods_export = p_ods_export; _p_writer = p_writer; + + _sp_labelling_method = p_project->getLabelingMethodSp(); + + _label_list = _sp_labelling_method.get()->getLabelList(); } void @@ -94,9 +98,22 @@ ComparBaseSheet::writeHeaders(IdentificationGroup *p_ident) _p_writer->writeCell("description"); _p_writer->writeCell("Number of proteins"); + for(MsRunSp &msrun_sp : _msrun_list) { - _p_writer->writeCell(msrun_sp.get()->getSampleName()); + if(_sp_labelling_method == nullptr) + { + _p_writer->writeCell(msrun_sp.get()->getSampleName()); + } + else + { + for(const Label *p_label : _label_list) + { + _p_writer->writeCell(QString("%1-%2") + .arg(msrun_sp.get()->getSampleName()) + .arg(p_label->getXmlId())); + } + } } } @@ -142,11 +159,27 @@ ComparBaseSheet::writeProteinMatch(const ProteinMatch *p_protein_match) for(MsRunSp &msrun_sp : _msrun_list) { - writeComparValue(p_protein_match, ValidationState::validAndChecked, - msrun_sp.get()); - if(_first_cell_coordinate.isEmpty()) + if(_label_list.size() == 0) + { + writeComparValue( + p_protein_match, ValidationState::validAndChecked, msrun_sp.get()); + if(_first_cell_coordinate.isEmpty()) + { + _first_cell_coordinate = _p_writer->getOdsCellCoordinate(); + } + } + else { - _first_cell_coordinate = _p_writer->getOdsCellCoordinate(); + for(const Label *p_label : _label_list) + { + writeComparValue(p_protein_match, + ValidationState::validAndChecked, + msrun_sp.get(),p_label); + if(_first_cell_coordinate.isEmpty()) + { + _first_cell_coordinate = _p_writer->getOdsCellCoordinate(); + } + } } } @@ -175,7 +208,8 @@ ComparBaseSheet::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(); diff --git a/src/output/ods/comparbasesheet.h b/src/output/ods/comparbasesheet.h index 3881628e66b680bd6abdb750b626cc6852d80db3..c5871f865a1172fcbd0e8cdaea2f9e34a2085d0c 100644 --- a/src/output/ods/comparbasesheet.h +++ b/src/output/ods/comparbasesheet.h @@ -39,7 +39,8 @@ class ComparBaseSheet { public: - ComparBaseSheet(OdsExport *p_ods_export, CalcWriterInterface *p_writer, + ComparBaseSheet(OdsExport *p_ods_export, + CalcWriterInterface *p_writer, const Project *p_project); private: @@ -52,7 +53,8 @@ class ComparBaseSheet protected: virtual void writeComparValue(const ProteinMatch *p_protein_match, ValidationState state, - const MsRun *p_msrun) = 0; + const MsRun *p_msrun, + const Label *p_label = nullptr) = 0; void writeProteinMatch(const ProteinMatch *p_protein_match); @@ -66,6 +68,9 @@ class ComparBaseSheet QString _first_cell_coordinate; IdentificationGroup *_p_current_identification_group; + + LabelingMethodSp _sp_labelling_method; + std::vector<Label *> _label_list; }; #endif // COMPARBASESHEET_H diff --git a/src/output/ods/comparspecificspectrasheet.cpp b/src/output/ods/comparspecificspectrasheet.cpp index 3dfde052324db8093fad2e4b51b4f6b73eebce10..4bae089c35afee238d0c6437a395e0755f94ea16 100644 --- a/src/output/ods/comparspecificspectrasheet.cpp +++ b/src/output/ods/comparspecificspectrasheet.cpp @@ -32,7 +32,8 @@ ComparSpecificSpectraSheet::ComparSpecificSpectraSheet( - OdsExport *p_ods_export, CalcWriterInterface *p_writer, + OdsExport *p_ods_export, + CalcWriterInterface *p_writer, const Project *p_project) : ComparBaseSheet(p_ods_export, p_writer, p_project) { @@ -42,8 +43,10 @@ ComparSpecificSpectraSheet::ComparSpecificSpectraSheet( void ComparSpecificSpectraSheet::writeComparValue( - const ProteinMatch *p_protein_match, ValidationState state, - const MsRun *p_msrun) + const ProteinMatch *p_protein_match, + ValidationState state, + const MsRun *p_msrun, + const Label *p_label) { qDebug() << "ComparSpecificSpectraSheet::writeComparValue begin"; _p_writer->writeCell( @@ -55,7 +58,8 @@ ComparSpecificSpectraSheet::writeComparValue( ComparSpecificSequenceSheet::ComparSpecificSequenceSheet( - OdsExport *p_ods_export, CalcWriterInterface *p_writer, + OdsExport *p_ods_export, + CalcWriterInterface *p_writer, const Project *p_project) : ComparBaseSheet(p_ods_export, p_writer, p_project) { @@ -64,8 +68,10 @@ ComparSpecificSequenceSheet::ComparSpecificSequenceSheet( void ComparSpecificSequenceSheet::writeComparValue( - const ProteinMatch *p_protein_match, ValidationState state, - const MsRun *p_msrun) + const ProteinMatch *p_protein_match, + ValidationState state, + const MsRun *p_msrun, + const Label *p_label) { qDebug() << "ComparSpecificSequenceSheet::writeComparValue begin"; _p_writer->writeCell( diff --git a/src/output/ods/comparspecificspectrasheet.h b/src/output/ods/comparspecificspectrasheet.h index c94310ea54ac6c2a4b50ff8ee1971c494572c711..e677f28f97ffcfd02bff8684b364b2979082220e 100644 --- a/src/output/ods/comparspecificspectrasheet.h +++ b/src/output/ods/comparspecificspectrasheet.h @@ -42,7 +42,8 @@ class ComparSpecificSpectraSheet : public ComparBaseSheet protected: virtual void writeComparValue(const ProteinMatch *p_protein_match, ValidationState state, - const MsRun *p_msrun) override; + const MsRun *p_msrun, + const Label *p_label = nullptr) override; }; class ComparSpecificSequenceSheet : public ComparBaseSheet @@ -55,7 +56,8 @@ class ComparSpecificSequenceSheet : public ComparBaseSheet protected: virtual void writeComparValue(const ProteinMatch *p_protein_match, ValidationState state, - const MsRun *p_msrun) override; + const MsRun *p_msrun, + const Label *p_label = nullptr) override; }; #endif // COMPARSPECIFICSPECTRASHEET_H diff --git a/src/output/ods/comparspectrasheet.cpp b/src/output/ods/comparspectrasheet.cpp index a5fbc14db572b510a4fc277234e58b9921a306b5..cafc0fadb548e47bf8ced2f46c5eb7d44bec83e9 100644 --- a/src/output/ods/comparspectrasheet.cpp +++ b/src/output/ods/comparspectrasheet.cpp @@ -46,7 +46,8 @@ ComparSpectraSheet::ComparSpectraSheet(OdsExport *p_ods_export, void ComparSpectraSheet::writeComparValue(const ProteinMatch *p_protein_match, ValidationState state, - const MsRun *p_msrun) + const MsRun *p_msrun, + const Label *p_label) { qDebug() << "ComparSpectraSheet::writeComparValue begin"; _p_writer->writeCell(p_protein_match->countSampleScan(state, p_msrun)); @@ -65,7 +66,8 @@ ComparSequenceSheet::ComparSequenceSheet(OdsExport *p_ods_export, void ComparSequenceSheet::writeComparValue(const ProteinMatch *p_protein_match, ValidationState state, - const MsRun *p_msrun) + const MsRun *p_msrun, + const Label *p_label) { qDebug() << "ComparSequenceSheet::writeComparValue begin"; _p_writer->writeCell( @@ -83,7 +85,9 @@ ComparPaiSheet::ComparPaiSheet(OdsExport *p_ods_export, void ComparPaiSheet::writeComparValue(const ProteinMatch *p_protein_match, - ValidationState state, const MsRun *p_msrun) + ValidationState state, + const MsRun *p_msrun, + const Label *p_label) { qDebug() << "ComparPaiSheet::writeComparValue begin"; _p_writer->writeCell(p_protein_match->getPAI(p_msrun)); @@ -100,7 +104,9 @@ ComparEmpaiSheet::ComparEmpaiSheet(OdsExport *p_ods_export, void ComparEmpaiSheet::writeComparValue(const ProteinMatch *p_protein_match, - ValidationState state, const MsRun *p_msrun) + ValidationState state, + const MsRun *p_msrun, + const Label *p_label) { qDebug() << "ComparEmpaiSheet::writeComparValue begin"; _p_writer->writeCell(p_protein_match->getEmPAI(p_msrun)); @@ -117,7 +123,9 @@ ComparNsafSheet::ComparNsafSheet(OdsExport *p_ods_export, void ComparNsafSheet::writeComparValue(const ProteinMatch *p_protein_match, - ValidationState state, const MsRun *p_msrun) + ValidationState state, + const MsRun *p_msrun, + const Label *p_label) { qDebug() << "ComparNsafSheet::writeComparValue begin"; pappso::pappso_double proto_nsaf_sum = 0; diff --git a/src/output/ods/comparspectrasheet.h b/src/output/ods/comparspectrasheet.h index ced41c2a2d5c7311178b6abb0ac6892cf9b0685d..737af6c1eab249560020dbae9a0b40a2f45facf7 100644 --- a/src/output/ods/comparspectrasheet.h +++ b/src/output/ods/comparspectrasheet.h @@ -36,62 +36,72 @@ class ComparSpectraSheet : public ComparBaseSheet { public: - ComparSpectraSheet(OdsExport *p_ods_export, CalcWriterInterface *p_writer, + ComparSpectraSheet(OdsExport *p_ods_export, + CalcWriterInterface *p_writer, const Project *p_project); protected: virtual void writeComparValue(const ProteinMatch *p_protein_match, ValidationState state, - const MsRun *p_msrun) override; + const MsRun *p_msrun, + const Label *p_label = nullptr) override; }; class ComparSequenceSheet : public ComparBaseSheet { public: - ComparSequenceSheet(OdsExport *p_ods_export, CalcWriterInterface *p_writer, + ComparSequenceSheet(OdsExport *p_ods_export, + CalcWriterInterface *p_writer, const Project *p_project); protected: virtual void writeComparValue(const ProteinMatch *p_protein_match, ValidationState state, - const MsRun *p_msrun) override; + const MsRun *p_msrun, + const Label *p_label = nullptr) override; }; class ComparPaiSheet : public ComparBaseSheet { public: - ComparPaiSheet(OdsExport *p_ods_export, CalcWriterInterface *p_writer, + ComparPaiSheet(OdsExport *p_ods_export, + CalcWriterInterface *p_writer, const Project *p_project); protected: virtual void writeComparValue(const ProteinMatch *p_protein_match, ValidationState state, - const MsRun *p_msrun) override; + const MsRun *p_msrun, + const Label *p_label = nullptr) override; }; class ComparEmpaiSheet : public ComparBaseSheet { public: - ComparEmpaiSheet(OdsExport *p_ods_export, CalcWriterInterface *p_writer, + ComparEmpaiSheet(OdsExport *p_ods_export, + CalcWriterInterface *p_writer, const Project *p_project); protected: virtual void writeComparValue(const ProteinMatch *p_protein_match, ValidationState state, - const MsRun *p_msrun) override; + const MsRun *p_msrun, + const Label *p_label = nullptr) override; }; class ComparNsafSheet : public ComparBaseSheet { public: - ComparNsafSheet(OdsExport *p_ods_export, CalcWriterInterface *p_writer, + ComparNsafSheet(OdsExport *p_ods_export, + CalcWriterInterface *p_writer, const Project *p_project); protected: virtual void writeComparValue(const ProteinMatch *p_protein_match, ValidationState state, - const MsRun *p_msrun) override; + const MsRun *p_msrun, + const Label *p_label = nullptr) override; private: std::map<const MsRun *, pappso::pappso_double> _map_proto_nsaf_sum_by_msrun;