diff --git a/src/output/ods/peptidesheet.cpp b/src/output/ods/peptidesheet.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f94906769ba78a7dda8dbb902227c1e4c56ec5e1 --- /dev/null +++ b/src/output/ods/peptidesheet.cpp @@ -0,0 +1,87 @@ +/** + * \file output/ods/peptidesheet.cpp + * \date 27/4/2017 + * \author Olivier Langella + * \brief ODS peptide sheet + */ + +/******************************************************************************* +* Copyright (c) 2017 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 "peptidesheet.h" + + +PeptideSheet::PeptideSheet (CalcWriterInterface * p_writer, const Project * p_project): _p_project(p_project) { + _p_writer = p_writer; + p_writer->writeSheet("peptides"); + + std::vector<IdentificationGroup *> identification_list = p_project->getIdentificationGroupList(); + for (IdentificationGroup * p_ident:identification_list) { + + //writeHeaders(p_ident); + writeIdentificationGroup(p_ident); + } +} + +PeptideSheet::~PeptideSheet() +{ + +} + +void PeptideSheet::writeHeaders(IdentificationGroup * p_ident) { + // Group ID Peptide ID SequenceLI Modifs Charge MH+ theo Number of subgroups Subgroup ids Number of spectra + //MS Sample : 20120906_balliau_extract_1_A01_urnb-1 + + + _p_writer->writeLine(); + _p_writer->writeCell("Group ID"); + _p_writer->writeCell("Peptide ID"); + _p_writer->writeCell("SequenceLI"); + _p_writer->writeCell("Modifs"); + _p_writer->writeCell("Charge"); + _p_writer->writeCell("MH+ theo"); + _p_writer->writeCell("Number of subgroups"); + _p_writer->writeCell("Number of spectra"); + + +} + +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 ProteinMatch *> protein_match_list = group_pair.second.get()->getProteinMatchList(); + + std::sort(protein_match_list.begin(), protein_match_list.end(), + [](const ProteinMatch * a, const ProteinMatch * b) + { + return a->getGrpProteinSp().get()->getSubGroupNumber() < b->getGrpProteinSp().get()->getSubGroupNumber(); + }); + + for (auto & protein_match:protein_match_list) { + writeOneProtein(group_pair.second.get(), protein_match); + } + } + _p_writer->writeLine(); + _p_writer->writeLine(); +} diff --git a/src/output/ods/peptidesheet.h b/src/output/ods/peptidesheet.h new file mode 100644 index 0000000000000000000000000000000000000000..0d874e2a270dd04b605d44a75dd33524e74c2343 --- /dev/null +++ b/src/output/ods/peptidesheet.h @@ -0,0 +1,52 @@ +/** + * \file output/ods/peptidesheet.h + * \date 27/4/2017 + * \author Olivier Langella + * \brief ODS peptide sheet + */ + +/******************************************************************************* +* Copyright (c) 2017 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 PEPTIDESHEET_H +#define PEPTIDESHEET_H + +#include "../../core/project.h" +#include <odsstream/calcwriterinterface.h> +#include "../../core/proteinmatch.h" + +class PeptideSheet +{ +public : + PeptideSheet (CalcWriterInterface * p_writer, const Project * p_project); +private : + void writeIdentificationGroup(IdentificationGroup * p_ident); + void writeHeaders(IdentificationGroup * p_ident); + void writeOneProtein(const GroupingGroup * p_group, const ProteinMatch * p_protein_match); + +private : + const Project * _p_project; + CalcWriterInterface * _p_writer; +}; + + +#endif // PEPTIDESHEET_H diff --git a/src/output/ods/proteinsheet.h b/src/output/ods/proteinsheet.h index 99266b3e3729ba513770c2b3cb6a8f19525315ed..8b0c3e4d966d891b904f7a8bc41e31aa0c372da5 100644 --- a/src/output/ods/proteinsheet.h +++ b/src/output/ods/proteinsheet.h @@ -36,13 +36,13 @@ class ProteinSheet { - public : - ProteinSheet (CalcWriterInterface * p_writer, const Project * p_project); +public : + ProteinSheet (CalcWriterInterface * p_writer, const Project * p_project); private : void writeIdentificationGroup(IdentificationGroup * p_ident); void writeHeaders(IdentificationGroup * p_ident); void writeOneProtein(const GroupingGroup * p_group, const ProteinMatch * p_protein_match); - + private : const Project * _p_project; CalcWriterInterface * _p_writer;