diff --git a/src/gui/peptide_list_view/peptidelistwindow.cpp b/src/gui/peptide_list_view/peptidelistwindow.cpp index ded1d9f7662dd1f858f7a31f11ffdcbda1028ece..6e6c6478f8168d52704fee5962944f76781b2fab 100644 --- a/src/gui/peptide_list_view/peptidelistwindow.cpp +++ b/src/gui/peptide_list_view/peptidelistwindow.cpp @@ -53,13 +53,13 @@ PeptideListWindow::PeptideListWindow(QWidget *parent): _peptide_table_model_p = new PeptideTableModel(0); - _p_proxy_model = new PeptideTableProxyModel(this, _peptide_table_model_p); + _p_proxy_model = new PeptideTableProxyModel(this, _peptide_table_model_p); _p_proxy_model->setSourceModel(_peptide_table_model_p); _p_proxy_model->setDynamicSortFilter(true); ui->tableView->setModel( _p_proxy_model ); ui->tableView->setSortingEnabled(true); - - 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 &))); } PeptideListWindow::~PeptideListWindow() @@ -70,8 +70,11 @@ PeptideListWindow::~PeptideListWindow() } +void PeptideListWindow::doIdentificationGroupGrouped(IdentificationGroup * p_identification_group) { +} + void PeptideListWindow::setProteinMatch(Project * p_project, ProteinMatch * p_protein_match) { - if (_p_protein_match != p_protein_match) { + if (_p_protein_match != p_protein_match) { _p_protein_match = p_protein_match; _peptide_table_model_p->setProteinMatch(p_project, p_protein_match); _p_proxy_model->setSourceModel(_peptide_table_model_p); diff --git a/src/gui/peptide_list_view/peptidelistwindow.h b/src/gui/peptide_list_view/peptidelistwindow.h index 98bcb5bcd5e0e0de348a1020928f126d56206af8..a1e072ab1c14ecc5d4ed7b73177ec0a9cda1c95c 100644 --- a/src/gui/peptide_list_view/peptidelistwindow.h +++ b/src/gui/peptide_list_view/peptidelistwindow.h @@ -47,7 +47,9 @@ public slots: //void peptideEdited(QString peptideStr); // void setColor(const QColor &color); // void setShape(Shape shape); + void doIdentificationGroupGrouped(IdentificationGroup * p_identification_group); signals: + void identificationGroupEdited(IdentificationGroup * p_identification_group); //void peptideChanged(pappso::PeptideSp peptide); private: diff --git a/src/gui/peptide_list_view/peptidetablemodel.cpp b/src/gui/peptide_list_view/peptidetablemodel.cpp index d6177aebfa344383f0adc23c8f3b03c6942040dc..6de4ad436334955ef830cc0b95f9cde67188686f 100644 --- a/src/gui/peptide_list_view/peptidetablemodel.cpp +++ b/src/gui/peptide_list_view/peptidetablemodel.cpp @@ -92,7 +92,7 @@ void PeptideTableModel::setProteinMatch(Project * p_project, ProteinMatch * p_pr int PeptideTableModel::rowCount(const QModelIndex &parent ) const { if (_p_protein_match != nullptr) { - qDebug() << "PeptideTableModel::rowCount(const QModelIndex &parent ) " << _p_protein_match->getPeptideMatchList().size(); + //qDebug() << "PeptideTableModel::rowCount(const QModelIndex &parent ) " << _p_protein_match->getPeptideMatchList().size(); return _p_protein_match->getPeptideMatchList().size(); } return 0; @@ -146,8 +146,8 @@ QVariant PeptideTableModel::data(const QModelIndex &index, int role ) const { // generate a log message when this method gets called int row = index.row(); int col = index.column(); - qDebug() << QString("row %1, col%2, role %3") - .arg(row).arg(col).arg(role); + //qDebug() << QString("row %1, col%2, role %3") + // .arg(row).arg(col).arg(role); switch(role) { case Qt::CheckStateRole: diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index 6d6dbd3d79d58149f7d495edaa7296e6520db109..167f128a81e59f75acb0cce9501d2f8ad787c997 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -131,8 +131,8 @@ void ProjectWindow::connectNewPeptideListWindow() { #else // Qt4 code //connect (_p_current_peptide_list_window, SIGNAL(proteinMatchClicked(ProteinMatch *)), this,SLOT(doViewPeptideList(ProteinMatch *))); - connect (_p_current_peptide_list_window, SIGNAL(identificationGroupEdited(IdentificationGroup *)), this,SLOT(doIdentificationGroupEdited(IdentificationGroup *))); - connect (this, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), _p_current_peptide_list_window,SLOT(doIdentificationGroupGrouped(IdentificationGroup *))); + //connect (_p_current_peptide_list_window, SIGNAL(identificationGroupEdited(IdentificationGroup *)), this,SLOT(doIdentificationGroupEdited(IdentificationGroup *))); + // connect (this, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), _p_current_peptide_list_window,SLOT(doIdentificationGroupGrouped(IdentificationGroup *))); #endif diff --git a/src/gui/protein_list_view/proteintablemodel.cpp b/src/gui/protein_list_view/proteintablemodel.cpp index f8f8b429fa0706f59974a52d453a38a3be79601a..ed2daa36ebe29c8f15d9404ad88e364490926fa0 100644 --- a/src/gui/protein_list_view/proteintablemodel.cpp +++ b/src/gui/protein_list_view/proteintablemodel.cpp @@ -27,6 +27,8 @@ #include "../../grouping/groupinggroup.h" #include <QDebug> +#include <pappsomspp/pappsoexception.h> +#include <QMessageBox> ProteinTableProxyModel::ProteinTableProxyModel(ProteinListWindow * p_protein_list_window, ProteinTableModel* protein_table_model_p): QSortFilterProxyModel(protein_table_model_p) @@ -44,6 +46,7 @@ void ProteinTableProxyModel::onTableClicked(const QModelIndex &index) { qDebug() << "ProteinTableProxyModel::onTableClicked begin " << index.row(); qDebug() << "ProteinTableProxyModel::onTableClicked begin " << this->mapToSource(index).row(); + _protein_table_model_p->onTableClicked(this->mapToSource(index)); } void ProteinTableProxyModel::onTableDoubleClicked(const QModelIndex &index) @@ -143,7 +146,7 @@ void ProteinTableModel::setIdentificationGroup(IdentificationGroup * p_identific int ProteinTableModel::rowCount(const QModelIndex &parent ) const { 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 0; @@ -189,8 +192,8 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const { // generate a log message when this method gets called int row = index.row(); int col = index.column(); - qDebug() << QString("row %1, col%2, role %3") - .arg(row).arg(col).arg(role); + // qDebug() << QString("row %1, col%2, role %3") + // .arg(row).arg(col).arg(role); switch(role) { @@ -304,31 +307,43 @@ void ProteinTableModel::onTableDoubleClicked(const QModelIndex &index) } bool ProteinTableModel::acceptRow(int source_row) { - ProteinMatch * protein_match = _p_identification_group->getProteinMatchList().at(source_row); - if (!_protein_search_string.isEmpty()) { - if (!protein_match->getProteinXtpSp().get()->getDescription().contains(_protein_search_string)) { - return false; + try { + ProteinMatch * protein_match = _p_identification_group->getProteinMatchList().at(source_row); + 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_valid) { + if (! protein_match->isValid()) { + return false; + } } - } - if (_hide_not_checked) { - if (! protein_match->isChecked()) { - return false; + if (_hide_not_checked) { + if (! protein_match->isChecked()) { + return false; + } } - } - if (_hide_not_grouped) { pappso::GrpProtein * p_grp_prot = protein_match->getGrpProteinSp().get(); - if (p_grp_prot == nullptr) { - return false; + 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; } diff --git a/src/gui/protein_view/proteinwindow.cpp b/src/gui/protein_view/proteinwindow.cpp index a90a6c5dfb8346aeb01c3e05f5e186bd7d4e83e3..cd01270aad4374cbb7b9e3035f7c551bf5ae185d 100644 --- a/src/gui/protein_view/proteinwindow.cpp +++ b/src/gui/protein_view/proteinwindow.cpp @@ -24,6 +24,8 @@ #include "proteinwindow.h" #include "../project_view/projectwindow.h" #include "ui_protein_detail_view.h" +#include <pappsomspp/pappsoexception.h> +#include <QMessageBox> ProteinWindow::ProteinWindow(ProjectWindow *parent): QMainWindow(parent), @@ -53,11 +55,21 @@ ProteinWindow::~ProteinWindow() } void ProteinWindow::setProteinMatch(ProteinMatch * p_protein_match) { - ui->descriptionLabel->setText(p_protein_match->getProteinXtpSp().get()->getAccession()); - //ui->sequenceLabel->setText(p_protein_match->getProteinXtpSp().get()->getSequence()); - ui->sequenceTextEdit->setText(p_protein_match->getHtmlSequence()); - ui->coverage_label->setText(QString("%1 %").arg(p_protein_match->getCoverage()*100)); - pappso::Peptide peptide(p_protein_match->getProteinXtpSp().get()->getSequence()); - 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()))); + try { + ui->descriptionLabel->setText(p_protein_match->getProteinXtpSp().get()->getAccession()); + //ui->sequenceLabel->setText(p_protein_match->getProteinXtpSp().get()->getSequence()); + ui->sequenceTextEdit->setText(p_protein_match->getHtmlSequence()); + ui->coverage_label->setText(QString("%1 %").arg(p_protein_match->getCoverage()*100)); + pappso::Peptide peptide(p_protein_match->getProteinXtpSp().get()->getSequence()); + 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()))); + } + catch (pappso::PappsoException exception_pappso) { + QMessageBox::warning(this, + tr("Unable to display protein details :"), exception_pappso.qwhat()); + } + catch (std::exception exception_std) { + QMessageBox::warning(this, + tr("Unable to display protein details :"), exception_std.what()); + } }