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

yes it works !

parent a9e67cd3
No related branches found
No related tags found
No related merge requests found
...@@ -29,8 +29,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS} ${Qt5 ...@@ -29,8 +29,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS} ${Qt5
#sudo apt-get install libpappsomspp-dev #sudo apt-get install libpappsomspp-dev
#FIND_PACKAGE( Pappsomspp REQUIRED ) #FIND_PACKAGE( Pappsomspp REQUIRED )
# SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp") SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp")
SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp") # SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp")
SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src") SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src")
SET (PAPPSOMSPP_QT4_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/libpappsomspp-qt4.so") SET (PAPPSOMSPP_QT4_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/libpappsomspp-qt4.so")
......
...@@ -66,7 +66,7 @@ IdentificationGroup* Project::newIdentificationGroup() { ...@@ -66,7 +66,7 @@ IdentificationGroup* Project::newIdentificationGroup() {
return _p_current_identification_group; return _p_current_identification_group;
} }
void Project::readXpipFile(QFileInfo xpip_fileinfo) { void Project::readXpipFile(QFileInfo xpip_fileinfo) {
qDebug() << "Project::readXpipFile begin";
XpipSaxHandler * parser = new XpipSaxHandler(this); XpipSaxHandler * parser = new XpipSaxHandler(this);
...@@ -96,6 +96,8 @@ void Project::readXpipFile(QFileInfo xpip_fileinfo) { ...@@ -96,6 +96,8 @@ void Project::readXpipFile(QFileInfo xpip_fileinfo) {
} }
IdentificationGroup* Project::getCurrentIdentificationGroupP() const { IdentificationGroup* Project::getCurrentIdentificationGroupP() const {
qDebug() << "Project::getCurrentIdentificationGroupP begin " << _p_current_identification_group;
return _p_current_identification_group; return _p_current_identification_group;
} }
......
...@@ -196,10 +196,10 @@ void ProjectWindow::doViewProteinDetail(ProteinMatch * protein_match) { ...@@ -196,10 +196,10 @@ void ProjectWindow::doViewProteinDetail(ProteinMatch * protein_match) {
} }
void ProjectWindow::doViewProteinList(IdentificationGroup* p_identification_group) { void ProjectWindow::doViewProteinList(IdentificationGroup* p_identification_group) {
qDebug() << "ProjectWindow::doViewProteinList begin"; qDebug() << "ProjectWindow::doViewProteinList begin " << p_identification_group;
if (p_identification_group == nullptr) { //if (p_identification_group == nullptr) {
p_identification_group = _project_sp.get()->getCurrentIdentificationGroupP(); p_identification_group = _project_sp.get()->getCurrentIdentificationGroupP();
} //}
if (_protein_list_window_collection.size() == 0) { if (_protein_list_window_collection.size() == 0) {
connectNewProteinListWindow(); connectNewProteinListWindow();
} }
...@@ -209,9 +209,12 @@ void ProjectWindow::doViewProteinList(IdentificationGroup* p_identification_grou ...@@ -209,9 +209,12 @@ void ProjectWindow::doViewProteinList(IdentificationGroup* p_identification_grou
} }
_p_current_protein_list_window->setIdentificationGroup(p_identification_group);
_p_current_protein_list_window->show(); _p_current_protein_list_window->show();
qDebug() << "ProjectWindow::doViewProteinList end " << p_identification_group;
_p_current_protein_list_window->setIdentificationGroup(p_identification_group);
emit identificationGroupGrouped(p_identification_group);
qDebug() << "ProjectWindow::doViewProteinList end"; qDebug() << "ProjectWindow::doViewProteinList end";
} }
......
...@@ -40,9 +40,9 @@ ProteinListWindow::ProteinListWindow(ProjectWindow *parent): ...@@ -40,9 +40,9 @@ ProteinListWindow::ProteinListWindow(ProjectWindow *parent):
_p_proxy_model = new ProteinTableProxyModel(this, _protein_table_model_p); _p_proxy_model = new ProteinTableProxyModel(this, _protein_table_model_p);
//_p_proxy_model->setSourceModel(_protein_table_model_p); _p_proxy_model->setSourceModel(_protein_table_model_p);
//_p_proxy_model->setDynamicSortFilter(true); _p_proxy_model->setDynamicSortFilter(true);
ui->tableView->setModel( _protein_table_model_p ); ui->tableView->setModel( _p_proxy_model );
ui->tableView->setSortingEnabled(true); ui->tableView->setSortingEnabled(true);
QSettings settings; QSettings settings;
...@@ -50,17 +50,17 @@ ProteinListWindow::ProteinListWindow(ProjectWindow *parent): ...@@ -50,17 +50,17 @@ ProteinListWindow::ProteinListWindow(ProjectWindow *parent):
if (hide) { if (hide) {
ui->hideNotValidCheckBox->setCheckState(Qt::Checked); ui->hideNotValidCheckBox->setCheckState(Qt::Checked);
} }
_protein_table_model_p->hideNotValid(hide); _p_proxy_model->hideNotValid(hide);
hide = settings.value("proteinview/hidenotchecked", "false").toBool(); hide = settings.value("proteinview/hidenotchecked", "false").toBool();
if (hide) { if (hide) {
ui->hideNotCheckedCheckBox->setCheckState(Qt::Checked); ui->hideNotCheckedCheckBox->setCheckState(Qt::Checked);
} }
_protein_table_model_p->hideNotChecked(hide); _p_proxy_model->hideNotChecked(hide);
hide = settings.value("proteinview/hidenotgrouped", "false").toBool(); hide = settings.value("proteinview/hidenotgrouped", "false").toBool();
if (hide) { if (hide) {
ui->hideNotGroupedCheckBox->setCheckState(Qt::Checked); ui->hideNotGroupedCheckBox->setCheckState(Qt::Checked);
} }
_protein_table_model_p->hideNotGrouped(settings.value("proteinview/hidenotgrouped", "false").toBool()); _p_proxy_model->hideNotGrouped(settings.value("proteinview/hidenotgrouped", "false").toBool());
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
...@@ -72,9 +72,10 @@ ProteinListWindow::ProteinListWindow(ProjectWindow *parent): ...@@ -72,9 +72,10 @@ ProteinListWindow::ProteinListWindow(ProjectWindow *parent):
*/ */
#else #else
// Qt4 code // Qt4 code
connect (this, SIGNAL(proteinDataChanged()), _protein_table_model_p, SLOT(onProteinDataChanged()));
connect(ui->tableView, SIGNAL(clicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableClicked(const QModelIndex &))); connect(ui->tableView, SIGNAL(clicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableClicked(const QModelIndex &)));
//connect(ui->tableView, SIGNAL(doubleClicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableDoubleClicked(const QModelIndex &))); //connect(ui->tableView, SIGNAL(doubleClicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableDoubleClicked(const QModelIndex &)));
connect(ui->proteinSearchEdit, SIGNAL(textChanged(QString)), _protein_table_model_p, SLOT(onProteinSearchEdit(QString))); connect(ui->proteinSearchEdit, SIGNAL(textChanged(QString)), _p_proxy_model, SLOT(onProteinSearchEdit(QString)));
//connect( this, SIGNAL( focusReceived(bool) ),this, SLOT(doFocusReceived(bool)) ); //connect( this, SIGNAL( focusReceived(bool) ),this, SLOT(doFocusReceived(bool)) );
...@@ -82,7 +83,7 @@ ProteinListWindow::ProteinListWindow(ProjectWindow *parent): ...@@ -82,7 +83,7 @@ ProteinListWindow::ProteinListWindow(ProjectWindow *parent):
this, SLOT(showContextMenu(const QPoint &))); this, SLOT(showContextMenu(const QPoint &)));
//connect(_p_proxy_model, SIGNAL(layoutChanged()), //connect(_p_proxy_model, SIGNAL(layoutChanged()),
// this, SLOT(doProxyLayoutChanged())); // this, SLOT(doProxyLayoutChanged()));
//connect(_protein_table_model_p, SIGNAL(layoutChanged()), this, SLOT(updateStatusBar())); connect(_protein_table_model_p, SIGNAL(layoutChanged()), this, SLOT(updateStatusBar()));
#endif #endif
} }
...@@ -160,54 +161,57 @@ void ProteinListWindow::edited() { ...@@ -160,54 +161,57 @@ void ProteinListWindow::edited() {
} }
void ProteinListWindow::doNotValidHide(bool hide) { void ProteinListWindow::doNotValidHide(bool hide) {
qDebug() << "ProteinListWindow::doNotValidHide begin"; qDebug() << "ProteinListWindow::doNotValidHide begin";
_protein_table_model_p->hideNotValid(hide); _p_proxy_model->hideNotValid(hide);
QSettings settings; QSettings settings;
settings.setValue("proteinview/hidenotvalid", QString("%1").arg(hide)); settings.setValue("proteinview/hidenotvalid", QString("%1").arg(hide));
emit proteinDataChanged();
qDebug() << "ProteinListWindow::doNotValidHide end"; qDebug() << "ProteinListWindow::doNotValidHide end";
} }
void ProteinListWindow::doNotCheckedHide(bool hide) { void ProteinListWindow::doNotCheckedHide(bool hide) {
qDebug() << "ProteinListWindow::doNotCheckedHide begin"; qDebug() << "ProteinListWindow::doNotCheckedHide begin";
_protein_table_model_p->hideNotChecked(hide); _p_proxy_model->hideNotChecked(hide);
QSettings settings; QSettings settings;
settings.setValue("proteinview/hidenotchecked", QString("%1").arg(hide)); settings.setValue("proteinview/hidenotchecked", QString("%1").arg(hide));
emit proteinDataChanged();
qDebug() << "ProteinListWindow::doNotCheckedHide end"; qDebug() << "ProteinListWindow::doNotCheckedHide end";
} }
void ProteinListWindow::doNotGroupedHide(bool hide) { void ProteinListWindow::doNotGroupedHide(bool hide) {
qDebug() << "ProteinListWindow::doNotGroupedHide begin"; qDebug() << "ProteinListWindow::doNotGroupedHide begin";
_protein_table_model_p->hideNotGrouped(hide); _p_proxy_model->hideNotGrouped(hide);
QSettings settings; QSettings settings;
settings.setValue("proteinview/hidenotgrouped", QString("%1").arg(hide)); settings.setValue("proteinview/hidenotgrouped", QString("%1").arg(hide));
emit proteinDataChanged();
qDebug() << "ProteinListWindow::doNotGroupedHide end"; qDebug() << "ProteinListWindow::doNotGroupedHide end";
} }
void ProteinListWindow::doIdentificationGroupGrouped(IdentificationGroup * p_identification_group) { void ProteinListWindow::doIdentificationGroupGrouped(IdentificationGroup * p_identification_group) {
qDebug() << "ProteinListWindow::doIdentificationGroupGrouped begin"; qDebug() << "ProteinListWindow::doIdentificationGroupGrouped begin";
if (_p_identification_group == p_identification_group) { if (_p_identification_group == p_identification_group) {
//_protein_table_model_p->setIdentificationGroup(p_identification_group);
//_p_proxy_model->setSourceModel(_protein_table_model_p); //_p_proxy_model->setSourceModel(_protein_table_model_p);
emit proteinDataChanged();
} }
qDebug() << "ProteinListWindow::doIdentificationGroupGrouped end"; qDebug() << "ProteinListWindow::doIdentificationGroupGrouped end";
} }
void ProteinListWindow::setIdentificationGroup(IdentificationGroup * p_identification_group) { void ProteinListWindow::setIdentificationGroup(IdentificationGroup * p_identification_group) {
qDebug() << "ProteinListWindow::setIdentificationGroup begin"; qDebug() << "ProteinListWindow::setIdentificationGroup begin " ;
if (_p_identification_group != p_identification_group) { if (p_identification_group != nullptr) {
qDebug() << "ProteinListWindow::setIdentificationGroup not null";
_p_identification_group = p_identification_group; _p_identification_group = p_identification_group;
_protein_table_model_p->setIdentificationGroup(p_identification_group); _protein_table_model_p->setIdentificationGroup(p_identification_group);
_p_proxy_model->setSourceModel(_protein_table_model_p); //_p_proxy_model->setSourceModel(_protein_table_model_p);
}
else {
qDebug() << "ProteinListWindow::setIdentificationGroup null";
} }
qDebug() << "ProteinListWindow::setIdentificationGroup end"; qDebug() << "ProteinListWindow::setIdentificationGroup end";
}
void ProteinListWindow::refresh() {
if (_p_identification_group == nullptr) return;
qDebug() << "ProteinListWindow::refresh begin " << _p_identification_group->getProteinMatchList().size();
//_p_proxy_model->setSourceModel(_protein_table_model_p);
qDebug() << "ProteinListWindow::refresh end ";
} }
void ProteinListWindow::updateStatusBar() { void ProteinListWindow::updateStatusBar() {
if (_p_identification_group == nullptr) { if (_p_identification_group == nullptr) {
} }
......
...@@ -56,6 +56,7 @@ public slots: ...@@ -56,6 +56,7 @@ public slots:
// void setShape(Shape shape); // void setShape(Shape shape);
signals: signals:
void identificationGroupEdited(IdentificationGroup * p_identification_group); void identificationGroupEdited(IdentificationGroup * p_identification_group);
void proteinDataChanged();
protected slots: protected slots:
...@@ -66,9 +67,8 @@ protected slots: ...@@ -66,9 +67,8 @@ protected slots:
void showContextMenu(const QPoint &); void showContextMenu(const QPoint &);
void showEvalueColumn(bool show); void showEvalueColumn(bool show);
void showAccessionColumn(bool show); void showAccessionColumn(bool show);
protected :
void refresh();
void updateStatusBar(); void updateStatusBar();
protected :
void askProteinDetailView(ProteinMatch * p_protein_match); void askProteinDetailView(ProteinMatch * p_protein_match);
void askPeptideListView(ProteinMatch * p_protein_match); void askPeptideListView(ProteinMatch * p_protein_match);
......
...@@ -38,7 +38,57 @@ ProteinTableProxyModel::ProteinTableProxyModel(ProteinListWindow * p_protein_lis ...@@ -38,7 +38,57 @@ ProteinTableProxyModel::ProteinTableProxyModel(ProteinListWindow * p_protein_lis
} }
bool ProteinTableProxyModel::filterAcceptsRow(int source_row, bool ProteinTableProxyModel::filterAcceptsRow(int source_row,
const QModelIndex &source_parent) const { const QModelIndex &source_parent) const {
return _protein_table_model_p->acceptRow(source_row); try {
qDebug() << "ProteinTableProxyModel::filterAcceptsRow begin " << source_row;
ProteinMatch * protein_match = _protein_table_model_p->getIdentificationGroup()->getProteinMatchList().at(source_row);
qDebug() << "ProteinTableProxyModel::filterAcceptsRow protein_match " << source_row;
/*
if (!_protein_search_string.isEmpty()) {
if (!protein_match->getProteinXtpSp().get()->getDescription().contains(_protein_search_string)) {
return false;
}
}
*/
qDebug() << "ProteinTableProxyModel::filterAcceptsRow valid ";
if (_hide_not_valid) {
if (! protein_match->isValid()) {
return false;
}
}
qDebug() << "ProteinTableProxyModel::filterAcceptsRow checked ";
if (_hide_not_checked) {
if (! protein_match->isChecked()) {
return false;
}
}
qDebug() << "ProteinTableProxyModel::filterAcceptsRow grouped ";
pappso::GrpProtein * p_grp_prot = protein_match->getGrpProteinSp().get();
if (_hide_not_grouped) {
if (p_grp_prot == nullptr) {
return false;
}
qDebug() << "ProteinTableProxyModel::filterAcceptsRow grouped 2";
if (p_grp_prot->getGroupingId().isEmpty()) {
return false;
}
}
}
catch (pappso::PappsoException exception_pappso) {
//QMessageBox::warning(this,
// tr("Error in ProteinTableModel::acceptRow :"), exception_pappso.qwhat());
qDebug() << "Error in ProteinTableModel::acceptRow :" << exception_pappso.qwhat();
}
catch (std::exception exception_std) {
//QMessageBox::warning(this,
// tr("Error in ProteinTableModel::acceptRow :"), exception_std.what());
qDebug() << "Error in ProteinTableModel::acceptRow :" << exception_std.what();
}
return true;
//return true; //return true;
} }
...@@ -114,57 +164,35 @@ QVariant ProteinTableProxyModel::headerData(int section, Qt::Orientation orienta ...@@ -114,57 +164,35 @@ QVariant ProteinTableProxyModel::headerData(int section, Qt::Orientation orienta
role); role);
} }
IdentificationGroup * ProteinTableModel::getIdentificationGroup() { void ProteinTableProxyModel::hideNotValid(bool hide) {
return _p_identification_group;
}
ProteinTableModel::ProteinTableModel(ProteinListWindow * p_protein_list_window)
:QAbstractTableModel(p_protein_list_window)
{
_p_protein_list_window = p_protein_list_window;
_p_identification_group = nullptr;
//ui->tableView->show();
// QModelIndex topLeft = createIndex(0,0);
//emit a signal to make the view reread identified data
//emit dataChanged(topLeft, topLeft);
}
void ProteinTableModel::refresh() {
if (_p_identification_group == nullptr) return;
qDebug() << "ProteinTableModel::refresh begin " << _p_identification_group->getProteinMatchList().size();
_p_protein_list_window->refresh();
//emit layoutAboutToBeChanged();
QModelIndex topLeft = createIndex(0,0);
QModelIndex bottomRight = createIndex(rowCount(),columnCount());
qDebug() << "ProteinTableModel::refresh emit dataChanged ";
emit dataChanged(topLeft, bottomRight);
//emit layoutChanged();
qDebug() << "ProteinTableModel::refresh end ";
}
void ProteinTableModel::hideNotValid(bool hide) {
_hide_not_valid = hide; _hide_not_valid = hide;
refresh();
} }
void ProteinTableModel::hideNotChecked(bool hide) { void ProteinTableProxyModel::hideNotChecked(bool hide) {
qDebug() << "ProteinTableModel::hideNotChecked begin "; qDebug() << "ProteinTableProxyModel::hideNotChecked begin ";
_hide_not_checked = hide; _hide_not_checked = hide;
refresh(); qDebug() << "ProteinTableProxyModel::hideNotChecked end ";
qDebug() << "ProteinTableModel::hideNotChecked end ";
} }
void ProteinTableModel::hideNotGrouped(bool hide) { void ProteinTableProxyModel::hideNotGrouped(bool hide) {
_hide_not_grouped = hide; _hide_not_grouped = hide;
refresh();
} }
void ProteinTableModel::onProteinSearchEdit(QString protein_search_string) { void ProteinTableProxyModel::onProteinSearchEdit(QString protein_search_string) {
qDebug() << "ProteinTableModel::onProteinSearchEdit begin " << protein_search_string; qDebug() << "ProteinTableProxyModel::onProteinSearchEdit begin " << protein_search_string;
_protein_search_string = protein_search_string; _protein_search_string = protein_search_string;
QModelIndex topLeft = createIndex(0,0);
QModelIndex bottomRight = createIndex(rowCount(),columnCount());
emit dataChanged(topLeft, bottomRight);
//emit layoutChanged(); //emit layoutChanged();
} }
IdentificationGroup * ProteinTableModel::getIdentificationGroup() {
return _p_identification_group;
}
ProteinTableModel::ProteinTableModel(ProteinListWindow * p_protein_list_window)
:QAbstractTableModel(p_protein_list_window)
{
_p_protein_list_window = p_protein_list_window;
_p_identification_group = nullptr;
}
void ProteinTableModel::setIdentificationGroup(IdentificationGroup * p_identification_group) { void ProteinTableModel::setIdentificationGroup(IdentificationGroup * p_identification_group) {
qDebug() << "ProteinTableModel::setIdentificationGroup begin " << p_identification_group->getProteinMatchList().size(); qDebug() << "ProteinTableModel::setIdentificationGroup begin " << p_identification_group->getProteinMatchList().size();
beginResetModel(); beginResetModel();
...@@ -172,20 +200,21 @@ void ProteinTableModel::setIdentificationGroup(IdentificationGroup * p_identific ...@@ -172,20 +200,21 @@ void ProteinTableModel::setIdentificationGroup(IdentificationGroup * p_identific
//emit headerDataChanged(Qt::Horizontal, 0,11); //emit headerDataChanged(Qt::Horizontal, 0,11);
//refresh(); //refresh();
endResetModel();
qDebug() << "ProteinTableModel::setIdentificationGroup end "; qDebug() << "ProteinTableModel::setIdentificationGroup end ";
endResetModel();
} }
int ProteinTableModel::rowCount(const QModelIndex &parent ) const { int ProteinTableModel::rowCount(const QModelIndex &parent ) const {
qDebug() << "ProteinTableModel::rowCount begin "; qDebug() << "ProteinTableModel::rowCount begin ";
if (_p_identification_group != nullptr) { if (_p_identification_group != nullptr) {
//qDebug() << "ProteinTableModel::rowCount(const QModelIndex &parent ) " << _p_identification_group->getProteinMatchList().size(); qDebug() << "ProteinTableModel::rowCount(const QModelIndex &parent ) " << _p_identification_group->getProteinMatchList().size();
return _p_identification_group->getProteinMatchList().size(); return (int) _p_identification_group->getProteinMatchList().size();
} }
return 0; return 0;
} }
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 11; return 11;
} }
...@@ -193,6 +222,7 @@ int ProteinTableModel::columnCount(const QModelIndex &parent ) const { ...@@ -193,6 +222,7 @@ int ProteinTableModel::columnCount(const QModelIndex &parent ) const {
} }
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 (role == Qt::DisplayRole) if (role == Qt::DisplayRole)
{ {
if (orientation == Qt::Horizontal) { if (orientation == Qt::Horizontal) {
...@@ -227,12 +257,12 @@ QVariant ProteinTableModel::headerData(int section, Qt::Orientation orientation, ...@@ -227,12 +257,12 @@ QVariant ProteinTableModel::headerData(int section, Qt::Orientation orientation,
} }
QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const { QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const {
// generate a log message when this method gets called // generate a log message when this method gets called
if (_p_identification_group == nullptr) return QVariant();
int row = index.row(); int row = index.row();
int col = index.column(); int col = index.column();
// qDebug() << QString("row %1, col%2, role %3") // qDebug() << QString("row %1, col%2, role %3")
// .arg(row).arg(col).arg(role); // .arg(row).arg(col).arg(role);
switch(role) { switch(role) {
case Qt::CheckStateRole: case Qt::CheckStateRole:
...@@ -317,46 +347,8 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const { ...@@ -317,46 +347,8 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const {
return QVariant(); return QVariant();
} }
bool ProteinTableModel::acceptRow(int source_row) { void ProteinTableModel::onProteinDataChanged() {
try { qDebug() << "ProteinTableModel::onProteinDataChanged begin " << rowCount();
ProteinMatch * protein_match = _p_identification_group->getProteinMatchList().at(source_row); emit layoutAboutToBeChanged();
emit layoutChanged();
if (!_protein_search_string.isEmpty()) {
if (!protein_match->getProteinXtpSp().get()->getDescription().contains(_protein_search_string)) {
return false;
}
}
if (_hide_not_valid) {
if (! protein_match->isValid()) {
return false;
}
}
if (_hide_not_checked) {
if (! protein_match->isChecked()) {
return false;
}
}
pappso::GrpProtein * p_grp_prot = protein_match->getGrpProteinSp().get();
if (_hide_not_grouped) {
if (p_grp_prot == nullptr)
return false;
}
if (p_grp_prot->getGroupingId().isEmpty()) {
return false;
}
}
catch (pappso::PappsoException exception_pappso) {
//QMessageBox::warning(this,
// tr("Error in ProteinTableModel::acceptRow :"), exception_pappso.qwhat());
qDebug() << "Error in ProteinTableModel::acceptRow :" << exception_pappso.qwhat();
}
catch (std::exception exception_std) {
//QMessageBox::warning(this,
// tr("Error in ProteinTableModel::acceptRow :"), exception_std.what());
qDebug() << "Error in ProteinTableModel::acceptRow :" << exception_std.what();
}
return true;
} }
...@@ -42,12 +42,22 @@ public: ...@@ -42,12 +42,22 @@ public:
QVariant headerData(int section, Qt::Orientation orientation, QVariant headerData(int section, Qt::Orientation orientation,
int role) const override; int role) const override;
bool lessThan(const QModelIndex & left, const QModelIndex & right) const override; bool lessThan(const QModelIndex & left, const QModelIndex & right) const override;
void hideNotValid(bool hide);
void hideNotChecked(bool hide);
void hideNotGrouped(bool hide);
public slots: public slots:
void onTableClicked(const QModelIndex &index); void onTableClicked(const QModelIndex &index);
void onProteinSearchEdit(QString protein_search_string);
private: private:
ProteinTableModel* _protein_table_model_p; ProteinTableModel* _protein_table_model_p;
ProteinListWindow * _p_protein_list_window; ProteinListWindow * _p_protein_list_window;
QString _protein_search_string;
bool _hide_not_valid = true;
bool _hide_not_checked = true;
bool _hide_not_grouped = true;
}; };
class ProteinTableModel: public QAbstractTableModel class ProteinTableModel: public QAbstractTableModel
...@@ -63,24 +73,13 @@ public: ...@@ -63,24 +73,13 @@ public:
void setIdentificationGroup(IdentificationGroup * p_identification_group); void setIdentificationGroup(IdentificationGroup * p_identification_group);
IdentificationGroup * getIdentificationGroup(); IdentificationGroup * getIdentificationGroup();
bool acceptRow(int source_row);
void hideNotValid(bool hide);
void hideNotChecked(bool hide);
void hideNotGrouped(bool hide);
public slots: public slots:
void onProteinSearchEdit(QString protein_search_string); void onProteinDataChanged();
private : private :
void refresh(); void refresh();
private : private :
IdentificationGroup * _p_identification_group = nullptr; IdentificationGroup * _p_identification_group = nullptr;
ProteinListWindow * _p_protein_list_window; ProteinListWindow * _p_protein_list_window;
QString _protein_search_string;
bool _hide_not_valid = true;
bool _hide_not_checked = true;
bool _hide_not_grouped = true;
}; };
#endif // PROTEINTABLEMODEL_H #endif // PROTEINTABLEMODEL_H
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "ui_protein_detail_view.h" #include "ui_protein_detail_view.h"
#include <pappsomspp/pappsoexception.h> #include <pappsomspp/pappsoexception.h>
#include <QMessageBox> #include <QMessageBox>
#include <cmath>
ProteinWindow::ProteinWindow(ProjectWindow *parent): ProteinWindow::ProteinWindow(ProjectWindow *parent):
QMainWindow(parent), QMainWindow(parent),
...@@ -62,7 +63,7 @@ void ProteinWindow::setProteinMatch(ProteinMatch * p_protein_match) { ...@@ -62,7 +63,7 @@ void ProteinWindow::setProteinMatch(ProteinMatch * p_protein_match) {
ui->coverage_label->setText(QString("%1 %").arg(p_protein_match->getCoverage()*100)); ui->coverage_label->setText(QString("%1 %").arg(p_protein_match->getCoverage()*100));
pappso::Peptide peptide(p_protein_match->getProteinXtpSp().get()->getSequence()); pappso::Peptide peptide(p_protein_match->getProteinXtpSp().get()->getSequence());
ui->mw_label->setText(QString("%1 kDa").arg(peptide.getMass()/1000)); ui->mw_label->setText(QString("%1 kDa").arg(peptide.getMass()/1000));
ui->evalue_label->setText(QString("%1 (log10: %2)").arg(p_protein_match->getEvalue()).arg(log10(p_protein_match->getEvalue()))); ui->evalue_label->setText(QString("%1 (log10: %2)").arg(p_protein_match->getEvalue()).arg(std::log10(p_protein_match->getEvalue())));
} }
catch (pappso::PappsoException exception_pappso) { catch (pappso::PappsoException exception_pappso) {
QMessageBox::warning(this, QMessageBox::warning(this,
......
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