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

using single table model for ods and qt : to test

parent c48bf603
No related branches found
No related tags found
No related merge requests found
......@@ -57,7 +57,7 @@ public slots:
// void setShape(Shape shape);
signals:
void identificationGroupEdited(IdentificationGroup * p_identification_group);
void proteinDataChanged();
void proteinDataChanged();
protected slots:
......@@ -71,7 +71,7 @@ protected slots:
void updateStatusBar();
void onProteinSearchEdit(QString protein_search_string);
void doSearchOn(QString search_on);
protected :
void askProteinDetailView(ProteinMatch * p_protein_match);
void askPeptideListView(ProteinMatch * p_protein_match);
......
......@@ -32,7 +32,7 @@
ProteinTableModel::columnMap ProteinTableModel::_column_assignment = {
(std::int8_t)ProteinListColumn::checked,
(std::int8_t)ProteinListColumn::group,
(std::int8_t)ProteinListColumn::protein_grouping_id,
(std::int8_t)ProteinListColumn::accession,
(std::int8_t)ProteinListColumn::description,
(std::int8_t)ProteinListColumn::log_evalue,
......@@ -81,15 +81,21 @@ int ProteinTableModel::columnCount(const QModelIndex &parent ) const {
}
return 0;
}
const QString ProteinTableModel::getTitle(ProteinListColumn column) {
ProteinTableModel::getTitle((std::int8_t) column);
}
const QString ProteinTableModel::getDescription(ProteinListColumn column) {
ProteinTableModel::getDescription((std::int8_t) column);
}
const QString ProteinTableModel::getTitle(std::int8_t column) const {
const QString ProteinTableModel::getTitle(std::int8_t column) {
switch (column) {
case (std::int8_t) ProteinListColumn::checked:
return "checked";
break;
case (std::int8_t) ProteinListColumn::group:
case (std::int8_t) ProteinListColumn::protein_grouping_id:
return "group";
break;
case (std::int8_t) ProteinListColumn::accession:
......@@ -119,6 +125,9 @@ const QString ProteinTableModel::getTitle(std::int8_t column) const {
case (std::int8_t) ProteinListColumn::pai:
return "PAI";
break;
case (std::int8_t) ProteinListColumn::empai:
return "emPAI";
break;
case (std::int8_t) ProteinListColumn::specific_sequence:
return "specific sequence";
......@@ -126,15 +135,15 @@ const QString ProteinTableModel::getTitle(std::int8_t column) const {
return "";
}
const QString ProteinTableModel::getDescription(std::int8_t column) const {
const QString ProteinTableModel::getDescription(std::int8_t column) {
switch (column) {
case (std::int8_t) ProteinListColumn::checked:
return "manual protein check";
break;
case (std::int8_t) ProteinListColumn::group:
return "unique protein grouping identifier";
case (std::int8_t) ProteinListColumn::protein_grouping_id:
return "unique protein identifier within this grouping experiment";
break;
case (std::int8_t) ProteinListColumn::accession:
return "protein accession";
......@@ -163,6 +172,9 @@ const QString ProteinTableModel::getDescription(std::int8_t column) const {
case (std::int8_t) ProteinListColumn::pai:
return "Protein Abundance Index (Rappsilber et al. 2002)";
break;
case (std::int8_t) ProteinListColumn::empai:
return "Exponentially Modified Protein Abundance Index (emPAI) as described by Ishihama 2005";
break;
case (std::int8_t) ProteinListColumn::specific_sequence:
return "number of unique distinct peptide sequences only assigned to this protein within the group";
......@@ -230,7 +242,7 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const {
return QVariant();
break;
case (std::int8_t)ProteinListColumn::group:
case (std::int8_t)ProteinListColumn::protein_grouping_id:
pappso::GrpProtein * p_grp_prot = _p_identification_group->getProteinMatchList().at(row)->getGrpProteinSp().get();
if (p_grp_prot != nullptr) return p_grp_prot->getGroupingId();
return QVariant();
......
......@@ -34,7 +34,7 @@
enum class ProteinListColumn {
checked, ///< manual checked
group, ///< group id
protein_grouping_id, ///< protein grouping id
accession, ///< accession
description, ///< protein description
log_evalue, ///< log(Evalue)
......@@ -45,6 +45,7 @@ enum class ProteinListColumn {
specific_sequence, ///< specific unique sequence
coverage, ///< protein coverage
pai, ///< PAI
empai, ///< emPAI
};
class ProteinListWindow;
......@@ -58,9 +59,10 @@ public:
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
static const QString getTitle(ProteinListColumn column);
static const QString getDescription(ProteinListColumn column);
const QString getTitle(std::int8_t column) const;
const QString getDescription(std::int8_t column) const;
void setIdentificationGroup(IdentificationGroup * p_identification_group);
IdentificationGroup * getIdentificationGroup();
......@@ -69,6 +71,9 @@ public:
public slots:
void onProteinDataChanged();
private :
static const QString getTitle(std::int8_t column);
static const QString getDescription(std::int8_t column);
void refresh();
private :
IdentificationGroup * _p_identification_group = nullptr;
......
......@@ -54,7 +54,7 @@ PtmIslandTableModel::~PtmIslandTableModel()
{
}
const QString PtmIslandTableModel::getTitle(std::int8_t column) const {
const QString PtmIslandTableModel::getTitle(std::int8_t column) {
switch (column) {
case (std::int8_t) PtmIslandListColumn::spectrum:
......@@ -89,7 +89,7 @@ const QString PtmIslandTableModel::getTitle(std::int8_t column) const {
return "";
}
const QString PtmIslandTableModel::getDescription(std::int8_t column) const {
const QString PtmIslandTableModel::getDescription(std::int8_t column) {
switch (column) {
case (std::int8_t) PtmIslandListColumn::spectrum:
......
......@@ -70,8 +70,8 @@ public:
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
const QString getTitle(std::int8_t column) const;
const QString getDescription(std::int8_t column) const;
static const QString getTitle(std::int8_t column);
static const QString getDescription(std::int8_t column);
using columnMap = std::int8_t[20];
......
......@@ -43,6 +43,10 @@ ProteinSheet::ProteinSheet (OdsExport * p_ods_export, CalcWriterInterface * p_wr
writeIdentificationGroup(p_ident);
}
}
void ProteinSheet::writeCellHeader(ProteinListColumn column) {
_p_writer->setCellAnnotation(ProteinTableModel::getDescription(column));
_p_writer->writeCell(ProteinTableModel::getTitle(column));
}
void ProteinSheet::writeHeaders(IdentificationGroup * p_ident) {
// Group ID Sub-group ID Protein ID Description log(E value)
......@@ -56,41 +60,39 @@ void ProteinSheet::writeHeaders(IdentificationGroup * p_ident) {
_p_writer->writeLine();
}
_p_writer->writeLine();
_p_writer->setCellAnnotation("group number");
_p_writer->writeCell("Group ID");
_p_writer->setCellAnnotation("subgroup number");
_p_writer->writeCell("Sub-group ID");
_p_writer->setCellAnnotation("unique protein identifier within this grouping experiment");
_p_writer->writeCell("Protein ID");
_p_writer->setCellAnnotation("unique protein accession");
_p_writer->writeCell("Accession");
_p_writer->setCellAnnotation("protein description");
_p_writer->writeCell("Description");
_p_writer->setCellAnnotation("protein expected value computed by X!TandemPipeline");
_p_writer->writeCell("log(E value)");
_p_writer->setCellAnnotation("coverage ratio");
_p_writer->writeCell("Coverage");
writeCellHeader(ProteinListColumn::protein_grouping_id);
//_p_writer->setCellAnnotation("unique protein identifier within this grouping experiment");
//_p_writer->writeCell("Protein ID");
writeCellHeader(ProteinListColumn::accession);
writeCellHeader(ProteinListColumn::description);
writeCellHeader(ProteinListColumn::log_evalue);
writeCellHeader(ProteinListColumn::coverage);
_p_writer->setCellAnnotation("computed molecular weight for this protein (sum of amino acid masses)");
_p_writer->writeCell("MW");
_p_writer->setCellAnnotation("number of amino acids");
_p_writer->writeCell("size");
_p_writer->setCellAnnotation("number of scans (spectra) attributed to this protein");
_p_writer->writeCell("Spectra");
_p_writer->setCellAnnotation("number of scans (spectra) attributed to this protein and no other ones");
_p_writer->writeCell("Specific");
_p_writer->setCellAnnotation("number of unique peptide sequenceLI attributed to this protein");
_p_writer->writeCell("Uniques");
_p_writer->setCellAnnotation("number of unique peptide sequenceLI attributed to this protein and no other ones");
_p_writer->writeCell("Specific uniques");
writeCellHeader(ProteinListColumn::spectrum);
//_p_writer->setCellAnnotation("number of scans (spectra) attributed to this protein");
// _p_writer->writeCell("Spectra");
writeCellHeader(ProteinListColumn::specific_spectrum);
writeCellHeader(ProteinListColumn::sequence);
writeCellHeader(ProteinListColumn::specific_sequence);
_p_writer->setCellAnnotation("number of unique peptidesequenceLI+modification+charge attributed to this protein (used to compute the PAI)");
_p_writer->writeCell("Uniques peptide-mod-charge");
_p_writer->setCellAnnotation("theoretical number of tryptic peptides used in the PAI computation");
_p_writer->writeCell("Theoretical number of tryptic peptides");
_p_writer->setCellAnnotation("Protein Abundance Index as described by Rappsilber et al. 2002");
_p_writer->writeCell("PAI");
_p_writer->setCellAnnotation("Exponentially Modified Protein Abundance Index (emPAI) as described by Ishihama 2005");
_p_writer->writeCell("emPAI");
writeCellHeader(ProteinListColumn::pai);
writeCellHeader(ProteinListColumn::empai);
//_p_writer->writeCell("spectral count AI");
_p_writer->setCellAnnotation("number of proteins in the same subgroup");
_p_writer->writeCell("Sub-group proteins");
......@@ -124,68 +126,68 @@ void ProteinSheet::writeIdentificationGroup(IdentificationGroup * p_ident) {
void ProteinSheet::writeOneProtein(const GroupingGroup * p_group, const ProteinMatch * p_protein_match) {
try {
_p_writer->writeLine();
_p_writer->writeLine();
qDebug() << "ProteinSheet::writeOneProtein begin" ;
ValidationState validation_state = ValidationState::validAndChecked;
pappso::GrpProtein * p_grp_protein = p_protein_match->getGrpProteinSp().get();
ProteinXtp * p_protein = p_protein_match->getProteinXtpSp().get();
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());
_p_writer->writeCell(p_protein_match->getLogEvalue());
// _p_writer->writeCell("Coverage");
_p_writer->writeCell(p_protein_match->getCoverage());
// _p_writer->writeCell("MW");
_p_writer->writeCell(p_protein->getMass());
_p_writer->writeCell(p_protein->size());
// _p_writer->writeCell("Spectra");
_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("Uniques");
_p_writer->writeCell((unsigned int) p_protein_match->countSequenceLi(validation_state));
// _p_writer->writeCell("Specific uniques");
_p_writer->writeCell((unsigned int) p_group->countSpecificSequenceLi(p_protein_match, validation_state));
_p_writer->writeCell(p_protein_match->countPeptideMassCharge(validation_state));
qDebug() << "ProteinSheet::writeOneProtein tryptic" ;
_p_writer->writeCell(p_protein->countTrypticPeptidesForPAI());
// _p_writer->writeCell("PAI");
// _p_writer->writeCell(new Double((float) hashProt
// .getTotalHashSampleScan() / prot.get_PAI_count()));
_p_writer->writeCell(p_protein_match->getPAI());
// _p_writer->writeCell(match.getPAI());//this is the same
/*
* ancien PAI _p_writer->writeCell(new Double((float)
* top.get_spectra_numbers_to(sample) /
* top.get_protein_match().get_PAI_count()));
*/
_p_writer->writeCell(p_protein_match->getEmPAI());
//_p_writer->writeCell(p_protein_match->getSpectralCountAI());
// _p_writer->writeCell("Redundancy");
_p_writer->writeCell(p_group->countProteinInSubgroup(p_grp_protein->getSubGroupNumber()));
//number of MS sample
_p_writer->writeCell(p_protein_match->countDistinctMsSamples(validation_state));
qDebug() << "ProteinSheet::writeOneProtein end" ;
qDebug() << "ProteinSheet::writeOneProtein begin" ;
ValidationState validation_state = ValidationState::validAndChecked;
pappso::GrpProtein * p_grp_protein = p_protein_match->getGrpProteinSp().get();
ProteinXtp * p_protein = p_protein_match->getProteinXtpSp().get();
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());
_p_writer->writeCell(p_protein_match->getLogEvalue());
// _p_writer->writeCell("Coverage");
_p_writer->writeCell(p_protein_match->getCoverage());
// _p_writer->writeCell("MW");
_p_writer->writeCell(p_protein->getMass());
_p_writer->writeCell(p_protein->size());
// _p_writer->writeCell("Spectra");
_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("Uniques");
_p_writer->writeCell((unsigned int) p_protein_match->countSequenceLi(validation_state));
// _p_writer->writeCell("Specific uniques");
_p_writer->writeCell((unsigned int) p_group->countSpecificSequenceLi(p_protein_match, validation_state));
_p_writer->writeCell(p_protein_match->countPeptideMassCharge(validation_state));
qDebug() << "ProteinSheet::writeOneProtein tryptic" ;
_p_writer->writeCell(p_protein->countTrypticPeptidesForPAI());
// _p_writer->writeCell("PAI");
// _p_writer->writeCell(new Double((float) hashProt
// .getTotalHashSampleScan() / prot.get_PAI_count()));
_p_writer->writeCell(p_protein_match->getPAI());
// _p_writer->writeCell(match.getPAI());//this is the same
/*
* ancien PAI _p_writer->writeCell(new Double((float)
* top.get_spectra_numbers_to(sample) /
* top.get_protein_match().get_PAI_count()));
*/
_p_writer->writeCell(p_protein_match->getEmPAI());
//_p_writer->writeCell(p_protein_match->getSpectralCountAI());
// _p_writer->writeCell("Redundancy");
_p_writer->writeCell(p_group->countProteinInSubgroup(p_grp_protein->getSubGroupNumber()));
//number of MS sample
_p_writer->writeCell(p_protein_match->countDistinctMsSamples(validation_state));
qDebug() << "ProteinSheet::writeOneProtein end" ;
}
catch (pappso::PappsoException error) {
throw pappso::PappsoException(QObject::tr("Error writing protein %1 :\n%2").arg(p_protein_match->getProteinXtpSp().get()->getAccession()).arg(error.qwhat()));
......
......@@ -34,6 +34,7 @@
#include <odsstream/calcwriterinterface.h>
#include "../../core/proteinmatch.h"
#include "odsexport.h"
#include "../../gui/protein_list_view/proteintablemodel.h"
class ProteinSheet
{
......@@ -44,6 +45,8 @@ private :
void writeHeaders(IdentificationGroup * p_ident);
void writeOneProtein(const GroupingGroup * p_group, const ProteinMatch * p_protein_match);
protected:
void writeCellHeader(ProteinListColumn column);
private :
OdsExport * _p_ods_export;
const Project * _p_project;
......
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