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

prepare spectra sheet for PTM

parent 4be9432b
No related branches found
No related tags found
No related merge requests found
/**
* \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);
}
}
/**
* \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
......@@ -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;
......
......@@ -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;
......
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