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

update ptm table model

parent f70f0d57
No related branches found
No related tags found
No related merge requests found
......@@ -208,6 +208,9 @@ void IdentificationGroup::startGrouping (const GroupingType & grouping_type) {
p_protein_match->setGroupInstance(_group_store);
}
if (_p_grp_ptm_experiment != nullptr) {
startPtmGrouping();
}
qDebug() << "IdentificationGroup::startGrouping end ";
}
......@@ -215,6 +218,7 @@ void IdentificationGroup::startPtmGrouping () {
qDebug() << "IdentificationGroup::startPtmGrouping begin ";
if (_p_grp_ptm_experiment != nullptr) {
delete _p_grp_ptm_experiment;
_p_grp_ptm_experiment = nullptr;
}
_p_grp_ptm_experiment = new PtmGroupingExperiment();
_p_grp_ptm_experiment->setValidationState(ValidationState::grouped);
......
......@@ -64,7 +64,7 @@ PtmIslandListWindow::PtmIslandListWindow(ProjectWindow *parent):
*/
#else
// Qt4 code
connect (this, SIGNAL(ptmIslandDataChanged()), _ptm_table_model_p, SLOT(onPtmIslandDataChanged()));
connect (this, SIGNAL(ptmIslandDataChanged()), _ptm_table_model_p, SLOT(onPtmIslandDataChanged()));
connect (_project_window, SIGNAL(identificationPtmGroupGrouped(IdentificationGroup *)), this,SLOT(doIdentificationPtmGroupGrouped(IdentificationGroup *)));
......@@ -73,19 +73,20 @@ connect (this, SIGNAL(ptmIslandDataChanged()), _ptm_table_model_p, SLOT(onPtmIsl
PtmIslandListWindow::~PtmIslandListWindow()
{
delete _ptm_table_model_p;
delete _ptm_proxy_model_p;
}
void PtmIslandListWindow::setIdentificationGroup(IdentificationGroup * p_identification_group) {
qDebug() << "PtmIslandListWindow::setIdentificationGroup begin " ;
qDebug() << "PtmIslandListWindow::setIdentificationGroup begin " ;
if (p_identification_group != nullptr) {
qDebug() << "PtmIslandListWindow::setIdentificationGroup not null";
_p_identification_group = p_identification_group;
_ptm_table_model_p->setIdentificationGroup(p_identification_group);
//_p_proxy_model->setSourceModel(_protein_table_model_p);
}
else {
qDebug() << "PtmIslandListWindow::setIdentificationGroup null";
......@@ -100,7 +101,10 @@ void PtmIslandListWindow::doIdentificationPtmGroupGrouped(IdentificationGroup *
if (_p_identification_group == p_identification_group) {
//_protein_table_model_p->setIdentificationGroup(p_identification_group);
//_p_proxy_model->setSourceModel(_protein_table_model_p);
_ptm_table_model_p->setIdentificationGroup(p_identification_group);
emit ptmIslandDataChanged();
ui->ptm_island_tableview->resizeRowToContents(_ptm_table_model_p->rowCount());
}
qDebug() << "PtmIslandListWindow::doIdentificationPtmGroupGrouped end";
......
......@@ -28,6 +28,10 @@
******************************************************************************/
#include "ptmislandproxymodel.h"
#include "ptmislandtablemodel.h"
#include "../../grouping/ptm/ptmgroupingexperiment.h"
#include "../../grouping/ptm/ptmisland.h"
#include <pappsomspp/pappsoexception.h>
PtmIslandProxyModel::PtmIslandProxyModel(PtmIslandListWindow * p_ptm_island_list_window, PtmIslandTableModel* ptm_table_model_p)
{
......@@ -39,3 +43,32 @@ PtmIslandProxyModel::~PtmIslandProxyModel()
{
}
bool PtmIslandProxyModel::filterAcceptsRow(int source_row,
const QModelIndex &source_parent) const {
try {
//qDebug() << "ProteinTableProxyModel::filterAcceptsRow begin " << source_row;
PtmIslandSp sp_ptm_island = _p_ptm_island_table_model->getPtmGroupingExperiment()->getPtmIslandList().at(source_row);
//qDebug() << "ProteinTableProxyModel::filterAcceptsRow protein_match " << source_row;
if (sp_ptm_island != nullptr) {
return true;
}
return false;
}
catch (pappso::PappsoException exception_pappso) {
//QMessageBox::warning(this,
// tr("Error in ProteinTableModel::acceptRow :"), exception_pappso.qwhat());
qDebug() << "Error in PtmIslandProxyModel::acceptRow :" << exception_pappso.qwhat();
}
catch (std::exception exception_std) {
//QMessageBox::warning(this,
// tr("Error in ProteinTableModel::acceptRow :"), exception_std.what());
qDebug() << "Error in PtmIslandProxyModel::acceptRow :" << exception_std.what();
}
return true;
//return true;
}
......@@ -43,9 +43,11 @@ class PtmIslandProxyModel: public QSortFilterProxyModel
public:
PtmIslandProxyModel(PtmIslandListWindow * p_ptm_island_list_window, PtmIslandTableModel* ptm_table_model_p);
~PtmIslandProxyModel();
bool filterAcceptsRow(int source_row,
const QModelIndex &source_parent) const override;
private:
PtmIslandListWindow * _p_ptm_island_list_window;
PtmIslandTableModel * _p_ptm_island_table_model;
PtmIslandListWindow * _p_ptm_island_list_window;
PtmIslandTableModel * _p_ptm_island_table_model;
};
#endif // PTMISLANDPROXYMODEL_H
......@@ -136,7 +136,8 @@ const QString PtmIslandTableModel::getDescription(std::int8_t column) {
return "";
}
void PtmIslandTableModel::setIdentificationGroup(IdentificationGroup * p_identification_group) {
qDebug() << "PtmIslandTableModel::setIdentificationGroup begin ";
qDebug() << "PtmIslandTableModel::setIdentificationGroup begin ";
beginResetModel();
_p_identification_group = p_identification_group;
......@@ -144,6 +145,16 @@ void PtmIslandTableModel::setIdentificationGroup(IdentificationGroup * p_identif
//refresh();
qDebug() << "PtmIslandTableModel::setIdentificationGroup end ";
endResetModel();
//emit layoutAboutToBeChanged();
//emit layoutChanged();
/*
QModelIndex topLeft = index(0, 0);
QModelIndex bottomRight = index(rowCount() - 1, columnCount() - 1);
emit dataChanged(topLeft, bottomRight);
*/
}
const PtmGroupingExperiment * PtmIslandTableModel::getPtmGroupingExperiment() const {
if (_p_identification_group == nullptr) {
......@@ -152,9 +163,9 @@ const PtmGroupingExperiment * PtmIslandTableModel::getPtmGroupingExperiment() co
return _p_identification_group->getPtmGroupingExperiment();
}
int PtmIslandTableModel::rowCount(const QModelIndex &parent ) const {
//qDebug() << "ProteinTableModel::rowCount begin ";
qDebug() << "PtmIslandTableModel::rowCount begin ";
if (getPtmGroupingExperiment() != nullptr) {
//qDebug() << "ProteinTableModel::rowCount(const QModelIndex &parent ) " << _p_identification_group->getProteinMatchList().size();
qDebug() << "PtmIslandTableModel::rowCount(const QModelIndex &parent ) " << getPtmGroupingExperiment()->getPtmIslandList().size();
return (int) getPtmGroupingExperiment()->getPtmIslandList().size();
}
return 0;
......
......@@ -72,13 +72,13 @@ public:
static const QString getTitle(PtmIslandListColumn column);
static const QString getDescription(PtmIslandListColumn column);
const PtmGroupingExperiment * getPtmGroupingExperiment() const;
using columnMap = std::int8_t[20];
public slots:
void onPtmIslandDataChanged();
private :
const PtmGroupingExperiment * getPtmGroupingExperiment() const;
static const QString getTitle(std::int8_t column);
static const QString getDescription(std::int8_t column);
private :
......
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