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

ptm island ods report OK

parent a480fb23
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@
#include "ptmgroupingexperiment.h"
#include "../../grouping/ptm/ptmgroupingexperiment.h"
#include "QDebug"
PtmGroupingExperiment::PtmGroupingExperiment()
{
......@@ -74,6 +75,7 @@ PtmGroupingExperiment::~PtmGroupingExperiment()
}
const std::vector<PtmIslandSp> & PtmGroupingExperiment::getPtmIslandList() const {
qDebug() << "PtmGroupingExperiment::getPtmIslandList begin" << _ptm_island_list.size();
return _ptm_island_list;
}
......
......@@ -38,6 +38,7 @@
#include "infosheet.h"
#include "samplesheet.h"
#include "groupingsheet.h"
#include "ptmislandsheet.h"
#include <QSettings>
OdsExport::OdsExport(const Project * project):_p_project(project) {
......@@ -114,4 +115,11 @@ void OdsExport::write(CalcWriterInterface * p_writer, WorkMonitorInterface * p_m
p_monitor->message(QObject::tr("writing samples"));
SampleSheet(this, p_writer, _p_project);
}
if (_p_project->hasPtmExperiment()) {
if (settings.value("export_ods/ptmislands", "true").toBool()) {
p_monitor->message(QObject::tr("writing PTM islands"));
PtmIslandSheet(this, p_writer, _p_project);
}
}
}
......@@ -145,7 +145,14 @@ void ProteinSheet::writeOneProtein(const GroupingGroup * p_group, const ProteinM
_p_writer->writeCell(QString("%1.%2").arg(pappso::Utils::getLexicalOrderedString(group_number)).arg(pappso::Utils::getLexicalOrderedString(subgroup_number)));
_p_writer->clearTableCellStyleRef();
_p_writer->writeCell(p_grp_protein->getGroupingId());
_p_writer->writeCell(p_protein->getAccession());
const std::list<DbXref> & dbxref_list = p_protein->getDbxrefList();
if (dbxref_list.size() == 0) {
_p_writer->writeCell(p_protein->getAccession());
}
else {
_p_writer->writeCell(dbxref_list.front().getUrl(), p_protein->getAccession());
}
_p_writer->writeCell(p_protein->getDescription());
_p_writer->writeCell(p_protein_match->getLogEvalue());
// _p_writer->writeCell("Coverage");
......
......@@ -34,6 +34,7 @@
#include <pappsomspp/pappsoexception.h>
PtmIslandSheet::PtmIslandSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer, const Project * p_project): _p_project(p_project) {
qDebug() << "PtmIslandSheet::PtmIslandSheet begin" ;
_p_writer = p_writer;
_p_ods_export = p_ods_export;
p_writer->writeSheet("PTM islands");
......@@ -43,6 +44,7 @@ PtmIslandSheet::PtmIslandSheet (OdsExport * p_ods_export, CalcWriterInterface *
//writeHeaders(p_ident);
writeIdentificationGroup(p_ident);
}
qDebug() << "PtmIslandSheet::PtmIslandSheet end" ;
}
void PtmIslandSheet::writeCellHeader(PtmIslandListColumn column) {
qDebug() << "PtmIslandSheet::writeCellHeader begin " << (std::int8_t) column;
......@@ -54,7 +56,7 @@ void PtmIslandSheet::writeCellHeader(PtmIslandListColumn column) {
void PtmIslandSheet::writeHeaders(IdentificationGroup * p_ident) {
//Group ID Sub-group ID PhosphoIsland ID Description MW Phosphosites positions Spectra Uniques number of proteins sharing these phosphosites
//a1 a1.a1 a1.a1.a1 AT1G01100.1 | Symbols: | 60S acidic ribosomal protein family | chr1:50284-50954 REVERSE LENGTH=112 11,1000003814697 102 435 3 6
qDebug() << "PtmIslandSheet::writeHeaders begin" ;
const std::vector<MsRunSp> msrun_list = p_ident->getMsRunSpList();
if (msrun_list.size() == 1) {
_p_writer->writeCell("sample");
......@@ -86,31 +88,40 @@ void PtmIslandSheet::writeHeaders(IdentificationGroup * p_ident) {
_p_writer->setCellAnnotation("Number of proteins sharing this PTM island");
_p_writer->writeCell("Number of proteins");
qDebug() << "PtmIslandSheet::writeHeaders end" ;
}
void PtmIslandSheet::writeIdentificationGroup(IdentificationGroup * p_ident) {
qDebug() << "PtmIslandSheet::writeIdentificationGroup begin" ;
_p_ptm_grouping_experiment = p_ident->getPtmGroupingExperiment();
if (_p_ptm_grouping_experiment = nullptr) {
if (_p_ptm_grouping_experiment == nullptr) {
throw pappso::PappsoException(QObject::tr("Error writing PTM island :\n_p_ptm_grouping_experiment = nullptr"));
}
writeHeaders(p_ident);
std::vector<PtmIslandSp> ptm_island_list = _p_ptm_grouping_experiment->getPtmIslandList();
std::sort(ptm_island_list.begin(), ptm_island_list.end(),
[](PtmIslandSp & a, PtmIslandSp & b)
{
return a.get()->getGroupingId() < b.get()->getGroupingId();
});
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);
}
for (auto & ptm_island:ptm_island_list) {
writeOnePtmIsland(ptm_island);
}
_p_writer->writeLine();
qDebug() << "PtmIslandSheet::writeIdentificationGroup end" ;
}
......@@ -129,7 +140,7 @@ void PtmIslandSheet::writeOnePtmIsland(PtmIslandSp & sp_ptm_island) {
const PtmIslandGroup * p_ptm_island_group = p_ptm_island_subgroup->getPtmIslandGroup();
unsigned int group_number = p_ptm_island_group->getGroupNumber();
unsigned int subgroup_number = p_ptm_island_subgroup->getSubgroupNumber();
_p_ods_export->setEvenOrOddStyle(group_number, _p_writer);
_p_writer->writeCell(pappso::Utils::getLexicalOrderedString(group_number));
_p_ods_export->setEvenOrOddStyle(subgroup_number, _p_writer);
......@@ -139,16 +150,17 @@ void PtmIslandSheet::writeOnePtmIsland(PtmIslandSp & sp_ptm_island) {
_p_writer->writeCell(p_protein->getAccession());
_p_writer->writeCell(p_protein->getDescription());
_p_writer->writeCell(p_protein->getMass());
QStringList position_list;
for (unsigned int position : sp_ptm_island.get()->getPositionList()) {
position_list << QString("%1").arg(position+1);
}
_p_writer->writeCell(position_list.join(" "));
for (unsigned int position : sp_ptm_island.get()->getPositionList()) {
position_list << QString("%1").arg(position+1);
}
_p_writer->writeCell(position_list.join(" "));
// _p_writer->writeCell("Spectra");
_p_writer->writeCell((unsigned int) sp_ptm_island.get()->getPtmIslandSubroup()->countSampleScan());
// _p_writer->writeCell("Uniques");
_p_writer->writeCell((unsigned int) sp_ptm_island.get()->countSequence());
_p_writer->writeCell((unsigned int) sp_ptm_island.get()->getPtmIslandSubroup()->getPtmIslandList().size());
qDebug() << "ProteinSheet::writeOneProtein end" ;
......
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