diff --git a/src/output/ods/ptm/ptmspectrasheet.cpp b/src/output/ods/ptm/ptmspectrasheet.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e17a4e212adea44c943341ae9230738c46a18bb5 --- /dev/null +++ b/src/output/ods/ptm/ptmspectrasheet.cpp @@ -0,0 +1,59 @@ +/** + * \file /output/ods/ptm/ptmspectrasheet.cpp + * \date 16/2/2018 + * \author Olivier Langella + * \brief ODS PTM spectra sheet + */ + +/******************************************************************************* +* Copyright (c) 2018 Olivier Langella <olivier.langella@u-psud.fr>. +* +* This file is part of XTPcpp. +* +* XTPcpp is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* XTPcpp is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>. +* +* Contributors: +* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation +******************************************************************************/ + +#include "ptmspectrasheet.h" + + +PtmSpectraSheet::PtmSpectraSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer, const Project * p_project): SpectraSheet(p_ods_export, p_writer, p_project, QString("PTM spectra")) { + qDebug() << "PtmSpectraSheet::PtmSpectraSheet begin" ; + qDebug() << "PtmSpectraSheet::PtmSpectraSheet end" ; +} + +void PtmSpectraSheet::writeIdentificationGroup(IdentificationGroup * p_ident) { + _p_ptm_grouping_experiment = p_ident->getPtmGroupingExperiment(); + + + qDebug() << "PtmIslandSheet::writeIdentificationGroup getPtmIslandList" ; + std::vector<PtmIslandSp> ptm_island_list; + for (auto ptm_island_sp : _p_ptm_grouping_experiment->getPtmIslandList() ) { + qDebug() << "PtmIslandSheet::writeIdentificationGroup getPtmIslandList copy" ; + ptm_island_list.push_back(ptm_island_sp); + } + qDebug() << "PtmIslandSheet::writeIdentificationGroup sort" ; + std::sort(ptm_island_list.begin(), ptm_island_list.end(), + [](PtmIslandSp & a, PtmIslandSp & b) + { + return a.get()->getGroupingId() < b.get()->getGroupingId(); + }); + + qDebug() << "PtmIslandSheet::writeIdentificationGroup 2" ; + for (auto & ptm_island:ptm_island_list) { + writeOnePtmIsland(ptm_island); + } +} diff --git a/src/output/ods/ptm/ptmspectrasheet.h b/src/output/ods/ptm/ptmspectrasheet.h new file mode 100644 index 0000000000000000000000000000000000000000..cb8a247c9f8b173bec45cf5877ea31c645f9ec2b --- /dev/null +++ b/src/output/ods/ptm/ptmspectrasheet.h @@ -0,0 +1,51 @@ +/** + * \file /output/ods/ptm/ptmspectrasheet.h + * \date 16/2/2018 + * \author Olivier Langella + * \brief ODS PTM spectra sheet + */ + +/******************************************************************************* +* Copyright (c) 2018 Olivier Langella <olivier.langella@u-psud.fr>. +* +* This file is part of XTPcpp. +* +* XTPcpp is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* XTPcpp is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>. +* +* Contributors: +* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation +******************************************************************************/ + +#ifndef PTMSPECTRASHEET_H +#define PTMSPECTRASHEET_H + +#include "../../../core/project.h" +#include <odsstream/calcwriterinterface.h> +#include "../../../grouping/ptm/ptmisland.h" +#include "../odsexport.h" +#include "../spectrasheet.h" + +class PtmSpectraSheet:public SpectraSheet +{ +public : + PtmSpectraSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer, const Project * p_project); +protected : + void writeIdentificationGroup(IdentificationGroup * p_ident); + +protected: + const PtmGroupingExperiment * _p_ptm_grouping_experiment; + +}; + +#endif // PTMSPECTRASHEET_H diff --git a/src/output/ods/spectrasheet.cpp b/src/output/ods/spectrasheet.cpp index c89e7cdcce9640a307f1bf0a20183ffeebf00bff..c10af12f77aec8559625ce7127021739cfc6cd4d 100644 --- a/src/output/ods/spectrasheet.cpp +++ b/src/output/ods/spectrasheet.cpp @@ -31,11 +31,10 @@ #include <tuple> #include <pappsomspp/utils.h> - -SpectraSheet::SpectraSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer, const Project * p_project): _p_project(p_project) { +SpectraSheet::SpectraSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer, const Project * p_project, const QString & sheet_name): _p_project(p_project) { _p_ods_export = p_ods_export; _p_writer = p_writer; - p_writer->writeSheet("spectra"); + p_writer->writeSheet(sheet_name); std::vector<IdentificationGroup *> identification_list = p_project->getIdentificationGroupList(); for (IdentificationGroup * p_ident:identification_list) { @@ -44,6 +43,9 @@ SpectraSheet::SpectraSheet (OdsExport * p_ods_export, CalcWriterInterface * p_wr } } +SpectraSheet::SpectraSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer, const Project * p_project): SpectraSheet(p_ods_export, p_writer, p_project, QString("spectra")) { +} + void SpectraSheet::writeCellHeader(PeptideListColumn column) { qDebug() << "SpectraSheet::writeCellHeader begin " << (std::int8_t) column; diff --git a/src/output/ods/spectrasheet.h b/src/output/ods/spectrasheet.h index 0285d7a2ee5135a3b75d6b0bbde93ca7de05f77a..356798d31819bc8bb042ac9763b4b1038bd968e1 100644 --- a/src/output/ods/spectrasheet.h +++ b/src/output/ods/spectrasheet.h @@ -40,13 +40,14 @@ class SpectraSheet { public : SpectraSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer, const Project * p_project); -private : - void writeIdentificationGroup(IdentificationGroup * p_ident); +protected : + SpectraSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer, const Project * p_project, const QString & sheet_name); + virtual void writeIdentificationGroup(IdentificationGroup * p_ident); void writeHeaders(IdentificationGroup * p_ident); void writeBestPeptideEvidence(const GroupingGroup * p_group, const PeptideEvidence * p_peptide_evidence); void writeCellHeader(PeptideListColumn column); -private : +protected : OdsExport * _p_ods_export; const Project * _p_project; CalcWriterInterface * _p_writer;