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

colors in ODS outout files

parent 0af32971
No related branches found
No related tags found
No related merge requests found
......@@ -35,16 +35,33 @@
OdsExport::OdsExport(const Project * project):_p_project(project) {
}
void OdsExport::setEvenOrOddStyle(unsigned int number, CalcWriterInterface * p_writer) {
if (number % 2) { /* x is odd */
p_writer->setTableCellStyleRef(_odd_style);
} else {
p_writer->setTableCellStyleRef(_even_style);
}
}
void OdsExport::write(CalcWriterInterface * p_writer) {
QSettings settings;
OdsTableCellStyle style;
style.setBackgroundColor(QColor("red"));
_odd_style = p_writer->getTableCellStyleRef(style);
style.setBackgroundColor(QColor("orange"));
_even_style = p_writer->getTableCellStyleRef(style);
if (settings.value("export_ods/simple", "false").toBool()) {
SimpleSheet(p_writer, _p_project);
}
if (settings.value("export_ods/proteins", "true").toBool()) {
ProteinSheet(p_writer, _p_project);
ProteinSheet(this, p_writer, _p_project);
}
if (settings.value("export_ods/peptides", "true").toBool()) {
PeptideSheet(p_writer, _p_project);
PeptideSheet(this, p_writer, _p_project);
}
}
......@@ -40,8 +40,12 @@ public:
void write(CalcWriterInterface * p_writer);
void setEvenOrOddStyle(unsigned int number, CalcWriterInterface * p_writer);
private:
const Project * _p_project;
OdsTableCellStyleRef _even_style;
OdsTableCellStyleRef _odd_style;
};
#endif // ODSEXPORT_H
......@@ -28,9 +28,11 @@
******************************************************************************/
#include "peptidesheet.h"
#include <pappsomspp/utils.h>
PeptideSheet::PeptideSheet (CalcWriterInterface * p_writer, const Project * p_project): _p_project(p_project) {
PeptideSheet::PeptideSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer, const Project * p_project): _p_project(p_project) {
_p_ods_export = p_ods_export;
_p_writer = p_writer;
p_writer->writeSheet("peptides");
......@@ -65,6 +67,7 @@ void PeptideSheet::writeHeaders(IdentificationGroup * p_ident) {
_p_writer->setCellAnnotation("theoretical mh");
_p_writer->writeCell("MH+ theo");
_p_writer->writeCell("Number of subgroups");
_p_writer->writeCell("Subgroup ids");
_p_writer->setCellAnnotation("number of scans associated to this peptide");
_p_writer->writeCell("Number of spectra");
......@@ -116,11 +119,16 @@ void PeptideSheet::writeBestPeptideMatch(const GroupingGroup * p_group,const Pep
std::sort(_sample_scan_list.begin(), _sample_scan_list.end());
auto last = std::unique(_sample_scan_list.begin(), _sample_scan_list.end());
_sample_scan_list.erase(last, _sample_scan_list.end());
_sample_scan_list.erase(last, _sample_scan_list.end());
_p_writer->writeLine();
_p_writer->writeCell(p_peptide_match->getGrpPeptideSp().get()->getGroupNumber());
unsigned int group_number = p_peptide_match->getGrpPeptideSp().get()->getGroupNumber();
_p_ods_export->setEvenOrOddStyle(group_number, _p_writer);
_p_writer->writeCell(pappso::Utils::getLexicalOrderedString(group_number));
_p_writer->clearTableCellStyleRef();
_p_writer->writeCell(p_peptide_match->getGrpPeptideSp().get()->getGroupingId());
_p_writer->writeCell(p_peptide_match->getGrpPeptideSp().get()->getSequence());
_p_writer->writeCell(p_peptide_match->getPeptideXtpSp().get()->getModifString());
......@@ -128,7 +136,8 @@ void PeptideSheet::writeBestPeptideMatch(const GroupingGroup * p_group,const Pep
_p_writer->writeCell(p_peptide_match->getPeptideXtpSp().get()->getNativePeptideP()->getMz(1));
QStringList sg_list = p_group->getSubgroupIdList(p_peptide_match);
_p_writer->writeCell((unsigned int) sg_list.size());
_p_writer->writeCell(sg_list.join(" "));
_p_writer->writeCell((unsigned int) _sample_scan_list.size());
_sample_scan_list.clear();
}
......@@ -33,17 +33,19 @@
#include "../../core/project.h"
#include <odsstream/calcwriterinterface.h>
#include "../../core/proteinmatch.h"
#include "odsexport.h"
class PeptideSheet
{
public :
PeptideSheet (CalcWriterInterface * p_writer, const Project * p_project);
PeptideSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer, const Project * p_project);
private :
void writeIdentificationGroup(IdentificationGroup * p_ident);
void writeHeaders(IdentificationGroup * p_ident);
void writeBestPeptideMatch(const GroupingGroup * p_group, const PeptideMatch * p_peptide_match);
private :
OdsExport * _p_ods_export;
const Project * _p_project;
CalcWriterInterface * _p_writer;
std::vector<size_t> _sample_scan_list;
......
......@@ -31,13 +31,13 @@
#include "../../core/identificationgroup.h"
#include <pappsomspp/utils.h>
ProteinSheet::ProteinSheet (CalcWriterInterface * p_writer, const Project * p_project): _p_project(p_project) {
ProteinSheet::ProteinSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer, const Project * p_project): _p_project(p_project) {
_p_writer = p_writer;
_p_ods_export = p_ods_export;
p_writer->writeSheet("proteins");
std::vector<IdentificationGroup *> identification_list = p_project->getIdentificationGroupList();
for (IdentificationGroup * p_ident:identification_list) {
//writeHeaders(p_ident);
writeIdentificationGroup(p_ident);
}
......@@ -47,12 +47,12 @@ void ProteinSheet::writeHeaders(IdentificationGroup * p_ident) {
// Group ID Sub-group ID Protein ID Description log(E value)
// Coverage MW Spectra Specific uniques Uniques PAI Redundancy
const std::vector<MsRunSp> msrun_list = p_ident->getMsRunSpList();
const std::vector<MsRunSp> msrun_list = p_ident->getMsRunSpList();
if (msrun_list.size() == 1) {
_p_writer->writeCell("sample");
_p_writer->writeLine();
_p_writer->writeCell(msrun_list[0].get()->getSampleName());
_p_writer->writeLine();
_p_writer->writeCell("sample");
_p_writer->writeLine();
_p_writer->writeCell(msrun_list[0].get()->getSampleName());
_p_writer->writeLine();
}
_p_writer->writeLine();
_p_writer->writeCell("Group ID");
......@@ -95,8 +95,7 @@ void ProteinSheet::writeIdentificationGroup(IdentificationGroup * p_ident) {
for (auto & protein_match:protein_match_list) {
writeOneProtein(group_pair.second.get(), protein_match);
}
_p_writer->writeLine();
}
_p_writer->writeLine();
}
......@@ -104,15 +103,20 @@ void ProteinSheet::writeIdentificationGroup(IdentificationGroup * p_ident) {
void ProteinSheet::writeOneProtein(const GroupingGroup * p_group, const ProteinMatch * p_protein_match) {
_p_writer->writeLine();
ValidationState validation_state = ValidationState::validAndChecked;
pappso::GrpProtein * p_grp_protein = p_protein_match->getGrpProteinSp().get();
ProteinXtp * p_protein = p_protein_match->getProteinXtpSp().get();
_p_writer->writeCell(pappso::Utils::getLexicalOrderedString(p_grp_protein->getGroupNumber()));
_p_writer->writeCell(QString("%1.%2").arg(pappso::Utils::getLexicalOrderedString(p_grp_protein->getGroupNumber())).arg(pappso::Utils::getLexicalOrderedString(p_grp_protein->getSubGroupNumber())));
unsigned int group_number = p_grp_protein->getGroupNumber();
unsigned int subgroup_number = p_grp_protein->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);
_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());
_p_writer->writeCell(p_protein->getDescription());
......@@ -126,14 +130,14 @@ void ProteinSheet::writeOneProtein(const GroupingGroup * p_group, const ProteinM
_p_writer->writeCell(p_protein_match->countSampleScan(validation_state));
// _p_writer->writeCell("Specific");
_p_writer->writeCell((unsigned int) p_group->countSpecificSampleScan(p_protein_match, validation_state));
_p_writer->writeCell((unsigned int) p_group->countSpecificSampleScan(p_protein_match, validation_state));
// _p_writer->writeCell("Uniques");
_p_writer->writeCell((unsigned int) p_protein_match->countUniqueSequenceLi(validation_state));
// _p_writer->writeCell("Specific uniques");
_p_writer->writeCell((unsigned int) p_group->countSpecificSequenceLi(p_protein_match, validation_state));
_p_writer->writeCell((unsigned int) p_group->countSpecificSequenceLi(p_protein_match, validation_state));
_p_writer->writeCell(p_protein_match->countPeptideMassCharge(validation_state));
_p_writer->writeCell(p_protein->countTrypticPeptidesForPAI());
......
......@@ -33,17 +33,19 @@
#include "../../core/project.h"
#include <odsstream/calcwriterinterface.h>
#include "../../core/proteinmatch.h"
#include "odsexport.h"
class ProteinSheet
{
public :
ProteinSheet (CalcWriterInterface * p_writer, const Project * p_project);
ProteinSheet (OdsExport * p_ods_export, 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 :
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