diff --git a/src/gui/protein_list_view/proteintablemodel.cpp b/src/gui/protein_list_view/proteintablemodel.cpp index 680c540207cdf882fd93cfd35d2d3003ae8a6520..46b10f6c74012596c4c0b6cd523ee5259fd5318b 100644 --- a/src/gui/protein_list_view/proteintablemodel.cpp +++ b/src/gui/protein_list_view/proteintablemodel.cpp @@ -35,7 +35,7 @@ ProteinTableModel::columnMap ProteinTableModel::_column_assignment = { (std::int8_t)ProteinListColumn::group, (std::int8_t)ProteinListColumn::accession, (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::specific_spectrum, (std::int8_t)ProteinListColumn::sequence, @@ -52,8 +52,6 @@ ProteinTableModel::ProteinTableModel(ProteinListWindow * p_protein_list_window) { _p_protein_list_window = p_protein_list_window; _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) { @@ -79,31 +77,111 @@ int ProteinTableModel::rowCount(const QModelIndex &parent ) const { int ProteinTableModel::columnCount(const QModelIndex &parent ) const { //qDebug() << "ProteinTableModel::columnCount begin "; if (_p_identification_group != nullptr) { - return _columns.size(); + return 11; } 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 { if (_p_identification_group == nullptr) return QVariant(); if (orientation == Qt::Horizontal) { - if (section < _columns.size()) - { - if (role == Qt::DisplayRole) - { - return QVariant(_columns.at(section)); - } - else if(role == Qt::SizeHintRole) - { - QSize size(1000, 50); - if (section == 2) - { - size.setWidth(400); - } - - return QVariant(size); - } + switch (role) { + case Qt::DisplayRole : + return QVariant(getTitle(_column_assignment [section])); + break; + case Qt::ToolTipRole : + return QVariant(getDescription(_column_assignment [section])); + break; + } } return QVariant(); @@ -166,9 +244,13 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const { if (_column_assignment[col] == (std::int8_t) ProteinListColumn::description ) { 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()); } + + 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 ) { return QVariant ((qreal) _p_identification_group->getProteinMatchList().at(row)->countSampleScan(ValidationState::validAndChecked)); } diff --git a/src/gui/protein_list_view/proteintablemodel.h b/src/gui/protein_list_view/proteintablemodel.h index cdf1b33ef1bb49a32ecea038d3a5e866f9190f22..f6cb458292f3c38b98222b5f10108933fc029dee 100644 --- a/src/gui/protein_list_view/proteintablemodel.h +++ b/src/gui/protein_list_view/proteintablemodel.h @@ -27,6 +27,26 @@ #include <QAbstractTableModel> #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 ProteinTableModel: public QAbstractTableModel @@ -39,6 +59,8 @@ public: virtual QVariant headerData(int section, Qt::Orientation orientation, int role) 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); IdentificationGroup * getIdentificationGroup(); diff --git a/src/gui/ptm_island_list_view/ptm_island_list_view.ui b/src/gui/ptm_island_list_view/ptm_island_list_view.ui index 475f2c6a9079e358f324d01e3a53cf8d78a19b14..01d7d80519d8d55e46c900ef15cd54739a693ba4 100644 --- a/src/gui/ptm_island_list_view/ptm_island_list_view.ui +++ b/src/gui/ptm_island_list_view/ptm_island_list_view.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>PtmIslandListWindow</class> - <widget class="QMainWindow" name="ptm_island_list_window"> + <widget class="QMainWindow" name="PtmIslandListWindow"> <property name="geometry"> <rect> <x>0</x> @@ -21,38 +21,6 @@ <enum>Qt::CustomContextMenu</enum> </property> <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> <widget class="QTableView" name="ptm_island_tableview"> <property name="contextMenuPolicy"> diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp index 52259a14f27fbdd3e2e18c89aab74b9ed877921f..4c137e57cd55b6ce5b6485b42aa48f3bfe22859a 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.cpp @@ -88,6 +88,41 @@ const QString PtmIslandTableModel::getTitle(std::int8_t column) const { } 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) { qDebug() << "PtmIslandTableModel::setIdentificationGroup begin "; beginResetModel(); @@ -124,9 +159,14 @@ QVariant PtmIslandTableModel::headerData(int section, Qt::Orientation orientatio if (getPtmGroupingExperiment() == nullptr) return QVariant(); if (orientation == Qt::Horizontal) { - if (role == Qt::DisplayRole) - { + switch (role) { + case Qt::DisplayRole : return QVariant(getTitle(_column_assignment [section])); + break; + case Qt::ToolTipRole : + return QVariant(getDescription(_column_assignment [section])); + break; + } } return QVariant(); @@ -163,7 +203,7 @@ QVariant PtmIslandTableModel::data(const QModelIndex &index, int role ) const { return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getProteinMatch()->getProteinXtpSp().get()->getAccession()); break; 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; case (std::int8_t) PtmIslandListColumn::ptm_island_length: return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->size()); diff --git a/src/gui/ptm_island_list_view/ptmislandtablemodel.h b/src/gui/ptm_island_list_view/ptmislandtablemodel.h index c6eeda9b84df1bf86c2e4a1fa55e1af7a8b2ecc9..25b472aa1fd264fd265de93cbef875986e9887b9 100644 --- a/src/gui/ptm_island_list_view/ptmislandtablemodel.h +++ b/src/gui/ptm_island_list_view/ptmislandtablemodel.h @@ -71,6 +71,7 @@ public: const QString getTitle(std::int8_t column) const; + const QString getDescription(std::int8_t column) const; using columnMap = std::int8_t[20]; diff --git a/src/utils/types.h b/src/utils/types.h index 9bf617565658a83712b894d44a73cc3ed75252ad..6c6800a1ad676f7ba22559679716f59fd91fbc53 100644 --- a/src/utils/types.h +++ b/src/utils/types.h @@ -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_ */