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

tool tips added in protein list columns

parent 880e12aa
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,7 @@ ProteinTableModel::columnMap ProteinTableModel::_column_assignment = { ...@@ -35,7 +35,7 @@ ProteinTableModel::columnMap ProteinTableModel::_column_assignment = {
(std::int8_t)ProteinListColumn::group, (std::int8_t)ProteinListColumn::group,
(std::int8_t)ProteinListColumn::accession, (std::int8_t)ProteinListColumn::accession,
(std::int8_t)ProteinListColumn::description, (std::int8_t)ProteinListColumn::description,
(std::int8_t)ProteinListColumn::evalue, (std::int8_t)ProteinListColumn::log_evalue,
(std::int8_t)ProteinListColumn::spectrum, (std::int8_t)ProteinListColumn::spectrum,
(std::int8_t)ProteinListColumn::specific_spectrum, (std::int8_t)ProteinListColumn::specific_spectrum,
(std::int8_t)ProteinListColumn::sequence, (std::int8_t)ProteinListColumn::sequence,
...@@ -52,8 +52,6 @@ ProteinTableModel::ProteinTableModel(ProteinListWindow * p_protein_list_window) ...@@ -52,8 +52,6 @@ ProteinTableModel::ProteinTableModel(ProteinListWindow * p_protein_list_window)
{ {
_p_protein_list_window = p_protein_list_window; _p_protein_list_window = p_protein_list_window;
_p_identification_group = nullptr; _p_identification_group = nullptr;
_columns << "checked" << "group" << "accession" << "protein description" << "log(Evalue)" << "spectrum" << "specific" << "sequence" << "specific sequence" << "coverage" << "PAI";
} }
void ProteinTableModel::setIdentificationGroup(IdentificationGroup * p_identification_group) { void ProteinTableModel::setIdentificationGroup(IdentificationGroup * p_identification_group) {
...@@ -79,31 +77,111 @@ int ProteinTableModel::rowCount(const QModelIndex &parent ) const { ...@@ -79,31 +77,111 @@ int ProteinTableModel::rowCount(const QModelIndex &parent ) const {
int ProteinTableModel::columnCount(const QModelIndex &parent ) const { int ProteinTableModel::columnCount(const QModelIndex &parent ) const {
//qDebug() << "ProteinTableModel::columnCount begin "; //qDebug() << "ProteinTableModel::columnCount begin ";
if (_p_identification_group != nullptr) { if (_p_identification_group != nullptr) {
return _columns.size(); return 11;
} }
return 0; return 0;
} }
const QString ProteinTableModel::getTitle(std::int8_t column) const {
switch (column) {
case (std::int8_t) ProteinListColumn::checked:
return "checked";
break;
case (std::int8_t) ProteinListColumn::group:
return "group";
break;
case (std::int8_t) ProteinListColumn::accession:
return "accession";
break;
case (std::int8_t) ProteinListColumn::description:
return "description";
break;
case (std::int8_t) ProteinListColumn::log_evalue:
return "log(Evalue)";
break;
case (std::int8_t) ProteinListColumn::evalue:
return "Evalue";
break;
case (std::int8_t) ProteinListColumn::spectrum:
return "spectrum";
break;
case (std::int8_t) ProteinListColumn::specific_spectrum:
return "specific";
break;
case (std::int8_t) ProteinListColumn::sequence:
return "sequence";
break;
case (std::int8_t) ProteinListColumn::coverage:
return "coverage";
break;
case (std::int8_t) ProteinListColumn::pai:
return "PAI";
break;
case (std::int8_t) ProteinListColumn::specific_sequence:
return "specific sequence";
}
return "";
}
const QString ProteinTableModel::getDescription(std::int8_t column) const {
switch (column) {
case (std::int8_t) ProteinListColumn::checked:
return "manual protein check";
break;
case (std::int8_t) ProteinListColumn::group:
return "unique protein grouping identifier";
break;
case (std::int8_t) ProteinListColumn::accession:
return "protein accession";
break;
case (std::int8_t) ProteinListColumn::description:
return "protein description";
break;
case (std::int8_t) ProteinListColumn::log_evalue:
return "log(Evalue)";
break;
case (std::int8_t) ProteinListColumn::evalue:
return "protein Evalue";
break;
case (std::int8_t) ProteinListColumn::spectrum:
return "number of distinct MS spectrum assigned to this protein";
break;
case (std::int8_t) ProteinListColumn::specific_spectrum:
return "number of distinct MS spectrum only assigned to this protein within the group";
break;
case (std::int8_t) ProteinListColumn::sequence:
return "number of unique distinct peptide sequences";
break;
case (std::int8_t) ProteinListColumn::coverage:
return "protein coverage (ratio)";
break;
case (std::int8_t) ProteinListColumn::pai:
return "Protein Abundance Index (Rappsilber et al. 2002)";
break;
case (std::int8_t) ProteinListColumn::specific_sequence:
return "number of unique distinct peptide sequences only assigned to this protein within the group";
}
return "";
}
QVariant ProteinTableModel::headerData(int section, Qt::Orientation orientation, int role) const QVariant ProteinTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{ {
if (_p_identification_group == nullptr) return QVariant(); if (_p_identification_group == nullptr) return QVariant();
if (orientation == Qt::Horizontal) if (orientation == Qt::Horizontal)
{ {
if (section < _columns.size()) switch (role) {
{ case Qt::DisplayRole :
if (role == Qt::DisplayRole) return QVariant(getTitle(_column_assignment [section]));
{ break;
return QVariant(_columns.at(section)); case Qt::ToolTipRole :
} return QVariant(getDescription(_column_assignment [section]));
else if(role == Qt::SizeHintRole) break;
{
QSize size(1000, 50);
if (section == 2)
{
size.setWidth(400);
}
return QVariant(size);
}
} }
} }
return QVariant(); return QVariant();
...@@ -166,9 +244,13 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const { ...@@ -166,9 +244,13 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const {
if (_column_assignment[col] == (std::int8_t) ProteinListColumn::description ) { if (_column_assignment[col] == (std::int8_t) ProteinListColumn::description ) {
return _p_identification_group->getProteinMatchList().at(row)->getProteinXtpSp().get()->getDescription(); return _p_identification_group->getProteinMatchList().at(row)->getProteinXtpSp().get()->getDescription();
} }
if (_column_assignment[col] == (std::int8_t) ProteinListColumn::evalue ) { if (_column_assignment[col] == (std::int8_t) ProteinListColumn::log_evalue ) {
return QVariant ((qreal)_p_identification_group->getProteinMatchList().at(row)->getLogEvalue()); return QVariant ((qreal)_p_identification_group->getProteinMatchList().at(row)->getLogEvalue());
} }
if (_column_assignment[col] == (std::int8_t) ProteinListColumn::evalue ) {
return QVariant ((qreal)_p_identification_group->getProteinMatchList().at(row)->getEvalue());
}
if (_column_assignment[col] == (std::int8_t) ProteinListColumn::spectrum ) { if (_column_assignment[col] == (std::int8_t) ProteinListColumn::spectrum ) {
return QVariant ((qreal) _p_identification_group->getProteinMatchList().at(row)->countSampleScan(ValidationState::validAndChecked)); return QVariant ((qreal) _p_identification_group->getProteinMatchList().at(row)->countSampleScan(ValidationState::validAndChecked));
} }
......
...@@ -27,6 +27,26 @@ ...@@ -27,6 +27,26 @@
#include <QAbstractTableModel> #include <QAbstractTableModel>
#include "../../core/project.h" #include "../../core/project.h"
/** \def ProteinListColumn list of available fields to display in protein list
*
*/
enum class ProteinListColumn {
checked, ///< manual checked
group, ///< group id
accession, ///< accession
description, ///< protein description
log_evalue, ///< log(Evalue)
evalue, ///< Evalue
spectrum, ///< spectrum count
specific_spectrum, ///< specific spectrum count
sequence, ///< unique sequence count
specific_sequence, ///< specific unique sequence
coverage, ///< protein coverage
pai, ///< PAI
};
class ProteinListWindow; class ProteinListWindow;
class ProteinTableModel: public QAbstractTableModel class ProteinTableModel: public QAbstractTableModel
...@@ -39,6 +59,8 @@ public: ...@@ -39,6 +59,8 @@ public:
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) 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; 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;
void setIdentificationGroup(IdentificationGroup * p_identification_group); void setIdentificationGroup(IdentificationGroup * p_identification_group);
IdentificationGroup * getIdentificationGroup(); IdentificationGroup * getIdentificationGroup();
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>PtmIslandListWindow</class> <class>PtmIslandListWindow</class>
<widget class="QMainWindow" name="ptm_island_list_window"> <widget class="QMainWindow" name="PtmIslandListWindow">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
...@@ -21,38 +21,6 @@ ...@@ -21,38 +21,6 @@
<enum>Qt::CustomContextMenu</enum> <enum>Qt::CustomContextMenu</enum>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>hide :</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hideNotValidCheckBox">
<property name="text">
<string>not valid</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hideNotCheckedCheckBox">
<property name="text">
<string>not checked</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hideNotGroupedCheckBox">
<property name="text">
<string>not grouped</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<widget class="QTableView" name="ptm_island_tableview"> <widget class="QTableView" name="ptm_island_tableview">
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
......
...@@ -88,6 +88,41 @@ const QString PtmIslandTableModel::getTitle(std::int8_t column) const { ...@@ -88,6 +88,41 @@ const QString PtmIslandTableModel::getTitle(std::int8_t column) const {
} }
return ""; return "";
} }
const QString PtmIslandTableModel::getDescription(std::int8_t column) const {
switch (column) {
case (std::int8_t) PtmIslandListColumn::spectrum:
return "number of distinct spectrum assigned to this PTM island";
break;
case (std::int8_t) PtmIslandListColumn::description:
return "protein description";
break;
case (std::int8_t) PtmIslandListColumn::multiptm:
return "number of distinct spectrum containing more than 1 ptm";
break;
case (std::int8_t) PtmIslandListColumn::sequence:
return "number of unique peptide sequence";
break;
case (std::int8_t) PtmIslandListColumn::ptm_island_id:
return "unique PTM island identifier";
break;
case (std::int8_t) PtmIslandListColumn::accession:
return "protein accession";
break;
case (std::int8_t) PtmIslandListColumn::ptm_position_list:
return "PTM positions observed in this PTM island";
break;
case (std::int8_t) PtmIslandListColumn::ptm_island_start:
return "PTM island start on the protein";
break;
case (std::int8_t) PtmIslandListColumn::ptm_island_length:
return "PTM island length";
}
return "";
}
void PtmIslandTableModel::setIdentificationGroup(IdentificationGroup * p_identification_group) { void PtmIslandTableModel::setIdentificationGroup(IdentificationGroup * p_identification_group) {
qDebug() << "PtmIslandTableModel::setIdentificationGroup begin "; qDebug() << "PtmIslandTableModel::setIdentificationGroup begin ";
beginResetModel(); beginResetModel();
...@@ -124,9 +159,14 @@ QVariant PtmIslandTableModel::headerData(int section, Qt::Orientation orientatio ...@@ -124,9 +159,14 @@ QVariant PtmIslandTableModel::headerData(int section, Qt::Orientation orientatio
if (getPtmGroupingExperiment() == nullptr) return QVariant(); if (getPtmGroupingExperiment() == nullptr) return QVariant();
if (orientation == Qt::Horizontal) if (orientation == Qt::Horizontal)
{ {
if (role == Qt::DisplayRole) switch (role) {
{ case Qt::DisplayRole :
return QVariant(getTitle(_column_assignment [section])); return QVariant(getTitle(_column_assignment [section]));
break;
case Qt::ToolTipRole :
return QVariant(getDescription(_column_assignment [section]));
break;
} }
} }
return QVariant(); return QVariant();
...@@ -163,7 +203,7 @@ QVariant PtmIslandTableModel::data(const QModelIndex &index, int role ) const { ...@@ -163,7 +203,7 @@ QVariant PtmIslandTableModel::data(const QModelIndex &index, int role ) const {
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getProteinMatch()->getProteinXtpSp().get()->getAccession()); return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getProteinMatch()->getProteinXtpSp().get()->getAccession());
break; break;
case (std::int8_t) PtmIslandListColumn::ptm_island_start: case (std::int8_t) PtmIslandListColumn::ptm_island_start:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getStart()); return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getStart()+1);
break; break;
case (std::int8_t) PtmIslandListColumn::ptm_island_length: case (std::int8_t) PtmIslandListColumn::ptm_island_length:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->size()); return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->size());
......
...@@ -71,6 +71,7 @@ public: ...@@ -71,6 +71,7 @@ public:
const QString getTitle(std::int8_t column) const; const QString getTitle(std::int8_t column) const;
const QString getDescription(std::int8_t column) const;
using columnMap = std::int8_t[20]; using columnMap = std::int8_t[20];
......
...@@ -95,22 +95,4 @@ enum class ValidationState: std::int8_t { ...@@ -95,22 +95,4 @@ enum class ValidationState: std::int8_t {
}; };
/** \def ProteinListColumn list of available fields to display in protein list
*
*/
enum class ProteinListColumn {
checked, ///< manual checked
group, ///< group id
accession, ///< accession
description, ///< protein description
evalue, ///< Evalue
spectrum, ///< spectrum count
specific_spectrum, ///< specific spectrum count
sequence, ///< unique sequence count
specific_sequence, ///< specific unique sequence
coverage, ///< protein coverage
pai, ///< PAI
};
#endif /* _TYPES_H_ */ #endif /* _TYPES_H_ */
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