diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index 6866522fec7ff4a997c2fb8bcea72b5d708d5b77..4400d062cbe658b44b5e7e901756bff3e061e6b9 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -64,7 +64,7 @@ bool ProteinMatch::contains(PeptideMatch * peptide_match) const { } void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters) { - qDebug() <<"ProteinMatch::updateAutomaticFilters begin " ; + //qDebug() <<"ProteinMatch::updateAutomaticFilters begin " ; _proxy_valid = false; unsigned int number_of_valid_peptides =0; bool cross_sample = automatic_filter_parameters.getFilterCrossSamplePeptideNumber(); @@ -91,7 +91,7 @@ void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & auto } } - qDebug() <<"ProteinMatch::updateAutomaticFilters begin 2" ; + // qDebug() <<"ProteinMatch::updateAutomaticFilters begin 2" ; if (number_of_valid_peptides == 0) { _proxy_valid = false; @@ -105,7 +105,7 @@ void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & auto } } } - qDebug() <<"ProteinMatch::updateAutomaticFilters end " << number_of_valid_peptides ; + // qDebug() <<"ProteinMatch::updateAutomaticFilters end " << number_of_valid_peptides ; } const ProteinXtpSp & ProteinMatch::getProteinXtpSp() const { diff --git a/src/files/fastafile.cpp b/src/files/fastafile.cpp index cc1bf229e295eadd996ae69f032ec87a14a8fb44..f4eb6876d28a2fe543f4b6844dce4e6d10e140f1 100644 --- a/src/files/fastafile.cpp +++ b/src/files/fastafile.cpp @@ -25,6 +25,7 @@ #include <pappsomspp/fasta/fastareader.h> #include <QStringList> #include <QDebug> +#include <pappsomspp/exception/exceptionnotfound.h> class AccessionContaminantReader: public pappso::FastaHandlerInterface { public: @@ -94,10 +95,12 @@ void FastaFile::setContaminants(ProteinStore & protein_store) const { } else { qDebug() << "FastaFile::setContaminants "<< _fasta_source.absoluteFilePath() << " not open"; + throw pappso::ExceptionNotFound(QObject::tr("unable to open contaminant fasta file \"%1\"").arg(_fasta_source.absoluteFilePath())); } } else { qDebug() << "FastaFile::setContaminants "<< _fasta_source.absoluteFilePath() << " does not exists"; + throw pappso::ExceptionNotFound(QObject::tr("contaminant fasta file \"%1\" not found").arg(_fasta_source.absoluteFilePath())); } } @@ -113,9 +116,11 @@ void FastaFile::setDecoys(ProteinStore & protein_store) const { } else { qDebug() << "FastaFile::setDecoys "<< _fasta_source.absoluteFilePath() << " not open"; + throw pappso::ExceptionNotFound(QObject::tr("unable to open decoy fasta file \"%1\"").arg(_fasta_source.absoluteFilePath())); } } else { qDebug() << "FastaFile::setDecoys "<< _fasta_source.absoluteFilePath() << " does not exists"; + throw pappso::ExceptionNotFound(QObject::tr("decoy fasta file \"%1\" not found").arg(_fasta_source.absoluteFilePath())); } } diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index 10723c89f5920eb4e74f36f8c1644dd9a97e9f8a..75f0e264c3217f9f35066a742f15ea7c7542b378 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -282,29 +282,42 @@ void ProjectWindow::computeMassPrecision() { void ProjectWindow::doFdrChanged() { qDebug() << "ProjectWindow::doFdrChanged begin "; - showWaitingMessage(tr("FDR modifications")); - doDisplayLoadingMessage(tr("tagging decoy proteins")); - QModelIndexList index_list = ui->decoy_database_listview->selectionModel()->selectedIndexes(); - if (index_list.size() > 0) { - _project_sp.get()->getProteinStore().clearDecoys(); - for (QModelIndex index :index_list) { - if (index.data(Qt::UserRole).canConvert<FastaFile *>()) { - FastaFile * p_fasta_file = index.data(Qt::UserRole).value<FastaFile *>(); - p_fasta_file->setDecoys(_project_sp.get()->getProteinStore()); - } - else { - throw pappso::PappsoException(QObject::tr("can not convert to FastaFile index.data().canConvert<FastaFile *>()")); + try { + showWaitingMessage(tr("FDR modifications")); + doDisplayLoadingMessage(tr("tagging decoy proteins")); + QModelIndexList index_list = ui->decoy_database_listview->selectionModel()->selectedIndexes(); + if (index_list.size() > 0) { + qDebug() << "ProjectWindow::doFdrChanged index_list.size()=" << index_list.size(); + _project_sp.get()->getProteinStore().clearDecoys(); + for (QModelIndex index :index_list) { + if (index.data(Qt::UserRole).canConvert<FastaFile *>()) { + FastaFile * p_fasta_file = index.data(Qt::UserRole).value<FastaFile *>(); + p_fasta_file->setDecoys(_project_sp.get()->getProteinStore()); + } + else { + throw pappso::PappsoException(QObject::tr("can not convert to FastaFile index.data().canConvert<FastaFile *>()")); + } } } + else { + _project_sp.get()->getProteinStore().setRegexpDecoyPattern(ui->decoy_protein_regexp_line_edit->text()); + } + doDisplayLoadingMessage(tr("updating filters")); + _project_sp.get()->updateAutomaticFilters(_project_sp.get()->getAutomaticFilterParameters()); + + //re group + emit operateGrouping(_project_sp); } - else { - _project_sp.get()->getProteinStore().setRegexpDecoyPattern(ui->decoy_protein_regexp_line_edit->text()); + catch (pappso::PappsoException exception_pappso) { + hideWaitingMessage(); + QMessageBox::warning(this, + tr("Unable to compute FDR :"), exception_pappso.qwhat()); + } + catch (std::exception exception_std) { + hideWaitingMessage(); + QMessageBox::warning(this, + tr("Unable to compute FDR :"), exception_std.what()); } - doDisplayLoadingMessage(tr("updating filters")); - _project_sp.get()->updateAutomaticFilters(_project_sp.get()->getAutomaticFilterParameters()); - - //re group - emit operateGrouping(_project_sp); qDebug() << "ProjectWindow::doFdrChanged end "; } @@ -317,30 +330,42 @@ void ProjectWindow::refresh() { } void ProjectWindow::doAutomaticFilterParametersChanged(AutomaticFilterParameters parameters) { qDebug() << "ProjectWindow::doAutomaticFilterParametersChanged begin "; - showWaitingMessage(tr("Updating filters")); - - doDisplayLoadingMessage(tr("tagging contaminant proteins")); - QModelIndexList index_list = ui->contaminant_database_listview->selectionModel()->selectedIndexes(); - if (index_list.size() > 0) { - _project_sp.get()->getProteinStore().clearContaminants(); - for (QModelIndex index :index_list) { - if (index.data(Qt::UserRole).canConvert<FastaFile *>()) { - FastaFile * p_fasta_file = index.data(Qt::UserRole).value<FastaFile *>(); - p_fasta_file->setContaminants(_project_sp.get()->getProteinStore()); - } - else { - throw pappso::PappsoException(QObject::tr("can not convert to FastaFile index.data().canConvert<FastaFile *>()")); + try { + showWaitingMessage(tr("Updating filters")); + + doDisplayLoadingMessage(tr("tagging contaminant proteins")); + QModelIndexList index_list = ui->contaminant_database_listview->selectionModel()->selectedIndexes(); + if (index_list.size() > 0) { + _project_sp.get()->getProteinStore().clearContaminants(); + for (QModelIndex index :index_list) { + if (index.data(Qt::UserRole).canConvert<FastaFile *>()) { + FastaFile * p_fasta_file = index.data(Qt::UserRole).value<FastaFile *>(); + p_fasta_file->setContaminants(_project_sp.get()->getProteinStore()); + } + else { + throw pappso::PappsoException(QObject::tr("can not convert to FastaFile index.data().canConvert<FastaFile *>()")); + } } } + else { + _project_sp.get()->getProteinStore().setRegexpContaminantPattern(ui->contaminant_protein_regexp_line_edit->text()); + } + doDisplayLoadingMessage(tr("updating filters")); + _project_sp.get()->updateAutomaticFilters(parameters); + + qDebug() << "ProjectWindow::doAutomaticFilterParametersChanged emit operateGrouping(_project_sp) "; + emit operateGrouping(_project_sp); } - else { - _project_sp.get()->getProteinStore().setRegexpContaminantPattern(ui->contaminant_protein_regexp_line_edit->text()); + catch (pappso::PappsoException exception_pappso) { + hideWaitingMessage(); + QMessageBox::warning(this, + tr("Error filtering results :"), exception_pappso.qwhat()); + } + catch (std::exception exception_std) { + hideWaitingMessage(); + QMessageBox::warning(this, + tr("Error filtering results :"), exception_std.what()); } - doDisplayLoadingMessage(tr("updating filters")); - _project_sp.get()->updateAutomaticFilters(parameters); - - qDebug() << "ProjectWindow::doAutomaticFilterParametersChanged emit operateGrouping(_project_sp) "; - emit operateGrouping(_project_sp); qDebug() << "ProjectWindow::doAutomaticFilterParametersChanged end "; } @@ -653,3 +678,4 @@ void ProjectWindow::doAcceptedLabelingMethod() { emit operateGrouping(_project_sp); } +