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

peptide sheet

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