diff --git a/src/core/project.cpp b/src/core/project.cpp index ad3de8ff1fee3ab95da07cd22d236c74c8b6de86..e21a90c2cd0a6b98bb3313225b0a97324d334ea5 100644 --- a/src/core/project.cpp +++ b/src/core/project.cpp @@ -39,7 +39,9 @@ Project::~Project() } } - +bool Project::checkPsimodCompliance() const { + return _peptide_store.checkPsimodCompliance(); +} void Project::readResultFile(QString filename) { IdentificationDataSourceSp ident_source = _identification_data_source_store.getInstance(filename); diff --git a/src/core/project.h b/src/core/project.h index ead40c37eaaa4105f93bc7e8ac486c955b40f560..544de7dc9934dc398de76e86d851a238f6db64f2 100644 --- a/src/core/project.h +++ b/src/core/project.h @@ -65,6 +65,10 @@ public: void setCombineMode(bool is_combine_mode); bool isCombineMode() const; void readResultFile(QString filename); + + /** @brief check that modifications are coded with PSI MOD accessions + */ + bool checkPsimodCompliance() const; private : bool _is_combine_mode =true; diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 43a3fab5c8e8f95afecf6d45f6ab3161cb040add..1068cfe0ae727fd60bb4cf9c7207a4e78944a298 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -179,11 +179,11 @@ void MainWindow::doAcceptedExportSpreadsheetDialog() { } settings.setValue("path/export_ods", QFileInfo(filename).absolutePath()); - + OdsDocWriter writer(filename); OdsExport export_ods(_project_sp.get()); export_ods.write(&writer); - + writer.close(); //emit operateXpipFile(filename); } @@ -222,7 +222,7 @@ void MainWindow::doProjectReady(ProjectSp project_sp) { viewError(tr("Error while grouping :\n%1").arg(error.qwhat())); } _project_window->setProjectSp(project_sp); -ui->menu_export_files->setDisabled(false); + ui->menu_export_files->setDisabled(false); qDebug() << "MainWindow::doProjectReady end"; } @@ -259,22 +259,24 @@ void MainWindow::selectXpipFile() { } - void MainWindow::doActionSpreadsheet() { +void MainWindow::doActionSpreadsheet() { qDebug() << "MainWindow::doActionSpreadsheet begin"; try { - - _p_export_spreadsheet_dialog->show(); - _p_export_spreadsheet_dialog->raise(); - _p_export_spreadsheet_dialog->activateWindow(); + + _p_export_spreadsheet_dialog->show(); + _p_export_spreadsheet_dialog->raise(); + _p_export_spreadsheet_dialog->activateWindow(); } catch (pappso::PappsoException & error) { viewError(tr("Error doActionSpreadsheet :\n%1").arg(error.qwhat())); } qDebug() << "MainWindow::doActionSpreadsheet end"; - } +} void MainWindow::doActionMassChroQ() { qDebug() << "MainWindow::doActionMassChroQ begin"; try { + _project_sp.get()->checkPsimodCompliance(); + QSettings settings; QString default_location = settings.value("path/mcqfile", "").toString(); diff --git a/src/utils/peptidestore.cpp b/src/utils/peptidestore.cpp index 1fe1dcf1a0fa52ecf1e720496fee4ec50c483af9..f1bd04adb9363258e6a70b1a0952902a51302d0a 100644 --- a/src/utils/peptidestore.cpp +++ b/src/utils/peptidestore.cpp @@ -29,6 +29,7 @@ #include "peptidestore.h" #include <pappsomspp/amino_acid/Aa.h> +#include <pappsomspp/pappsoexception.h> PeptideStore::PeptideStore() { @@ -52,9 +53,20 @@ PeptideXtpSp & PeptideStore::getInstance(PeptideXtpSp & peptide_in) { for (auto && aa : *(ret.first->second.get())) { std::list<pappso::AaModificationP> mod_list = aa.getModificationList(); - _modification_collection.insert(mod_list.begin(), mod_list.end()); + _modification_collection.insert(mod_list.begin(), mod_list.end()); } } return ret.first->second; } + +bool PeptideStore::checkPsimodCompliance() const { + for (pappso::AaModificationP modification :_modification_collection) { + if (modification->getAccession().startsWith("MOD:")) { + } + else { + throw pappso::PappsoException(QObject::tr("Modification %1 is not a PSIMOD accession").arg(modification->getAccession())); + } + } + return true; +} diff --git a/src/utils/peptidestore.h b/src/utils/peptidestore.h index 1d5d9de2efd811eed84f87f419d30635a82d50f1..5221b31a4c3e247b9ef9ba3461a4dc08f01c7f2e 100644 --- a/src/utils/peptidestore.h +++ b/src/utils/peptidestore.h @@ -41,6 +41,10 @@ public: ~PeptideStore(); PeptideXtpSp & getInstance(PeptideXtpSp & peptide_in); + + /** @brief check that modifications are coded with PSI MOD accessions + */ + bool checkPsimodCompliance() const; private :