diff --git a/src/grouping/ptm/ptmgroupingexperiment.cpp b/src/grouping/ptm/ptmgroupingexperiment.cpp index 8cbf7bb02690a30aca5842243bf27424912bb850..2e0dbe225bd926ce170c04ab2ed5ae87dae27827 100644 --- a/src/grouping/ptm/ptmgroupingexperiment.cpp +++ b/src/grouping/ptm/ptmgroupingexperiment.cpp @@ -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; } diff --git a/src/output/ods/odsexport.cpp b/src/output/ods/odsexport.cpp index 8cfdd5f68746d573e52c3fb204c2c43fe1d6478c..6ebc5e4efb9a44f96adeef6040a371d264c7a232 100644 --- a/src/output/ods/odsexport.cpp +++ b/src/output/ods/odsexport.cpp @@ -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); + } + } } diff --git a/src/output/ods/proteinsheet.cpp b/src/output/ods/proteinsheet.cpp index 8737faf6d0dae876666003bdc8f5c9f8fae2d4b1..4be82371aead5fd28fff8ebf12c4bffc45646da0 100644 --- a/src/output/ods/proteinsheet.cpp +++ b/src/output/ods/proteinsheet.cpp @@ -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"); diff --git a/src/output/ods/ptmislandsheet.cpp b/src/output/ods/ptmislandsheet.cpp index 4715a23ed26d813b3a274f8d7c4c3ec19b2ee48b..e5cc53c771ba6797672844b8d538c4dde9ccbda5 100644 --- a/src/output/ods/ptmislandsheet.cpp +++ b/src/output/ods/ptmislandsheet.cpp @@ -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" ;