diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 36a99256fd1112299c057eefcac33a751f2d3949..a65ad069755f111e8b9709f537a4afde51751ab3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,8 +28,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS} ${Qt5 #sudo apt-get install libpappsomspp-dev #FIND_PACKAGE( Pappsomspp REQUIRED ) -# SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp") - SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp") + SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp") +# SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp") SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src") SET (PAPPSOMSPP_QT5_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/libpappsomspp-qt5.so") SET (PAPPSOMSPP_WIDGET_QT5_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/pappsomspp/widget/libpappsomspp-widget-qt5.so") diff --git a/src/core/identification_sources/identificationpwizfile.cpp b/src/core/identification_sources/identificationpwizfile.cpp index c7302963a2cad2a1259003509567e5bc53a2f255..c2f5cc4535c17f51175f4a20f2306a36539e9bbb 100644 --- a/src/core/identification_sources/identificationpwizfile.cpp +++ b/src/core/identification_sources/identificationpwizfile.cpp @@ -71,7 +71,7 @@ void IdentificationPwizFile::parseTo(Project* p_project) { setMsRunSp(msrun_sp); std::vector<IdentificationGroup *> identification_list = p_project->getIdentificationGroupList(); IdentificationGroup * identification_group_p = nullptr; - if (p_project->isCombineMode()) { + if (p_project->getProjectMode() == ProjectMode::combined) { if (identification_list.size() == 0) { identification_group_p = p_project->newIdentificationGroup(); } @@ -81,7 +81,7 @@ void IdentificationPwizFile::parseTo(Project* p_project) { } else { for (IdentificationGroup * identification_p_flist : identification_list) { - if (identification_p_flist->contains(msrun_sp.get())) { + if (identification_p_flist->containSample(msrun_sp.get()->getSampleName())) { identification_group_p = identification_p_flist; break; } diff --git a/src/core/identification_sources/identificationxtandemfile.cpp b/src/core/identification_sources/identificationxtandemfile.cpp index aa5bcdb29efd9e1d7e43fb22fee1c150f2250f85..09da37165a928cf37f7612f232f2e37604314583 100644 --- a/src/core/identification_sources/identificationxtandemfile.cpp +++ b/src/core/identification_sources/identificationxtandemfile.cpp @@ -60,7 +60,7 @@ void IdentificationXtandemFile::parseTo(Project* p_project) { setMsRunSp(msrun_sp); std::vector<IdentificationGroup *> identification_list = p_project->getIdentificationGroupList(); IdentificationGroup * identification_group_p = nullptr; - if (p_project->isCombineMode()) { + if (p_project->getProjectMode() == ProjectMode::combined) { if (identification_list.size() == 0) { identification_group_p = p_project->newIdentificationGroup(); } @@ -70,7 +70,7 @@ void IdentificationXtandemFile::parseTo(Project* p_project) { } else { for (IdentificationGroup * identification_p_flist : identification_list) { - if (identification_p_flist->contains(msrun_sp.get())) { + if (identification_p_flist->containSample(msrun_sp.get()->getSampleName())) { identification_group_p = identification_p_flist; break; } diff --git a/src/core/identificationgroup.cpp b/src/core/identificationgroup.cpp index 067e9a26c62baa0c277510bd48553d7cb2fd3e9d..dd7ec45b74524f673da6af88df834772de8c3d4d 100644 --- a/src/core/identificationgroup.cpp +++ b/src/core/identificationgroup.cpp @@ -196,6 +196,13 @@ bool IdentificationGroup::contains (const MsRun * p_msrun) const { return false; } +bool IdentificationGroup::containSample (const QString & sample) const { + for (const MsRunSp & msrun: _ms_run_list) { + if (msrun.get()->getSampleName() == sample) return true; + } + return false; +} + void IdentificationGroup::addIdentificationDataSourceP(IdentificationDataSource * p_identification_source) { addMsRunSp(p_identification_source->getMsRunSp()); auto it = std::find (_id_source_list.begin() ,_id_source_list.end(),p_identification_source); diff --git a/src/core/identificationgroup.h b/src/core/identificationgroup.h index bfb0d532d43aa578ddca3ade8247230847a54c45..0469f961e27236eedc99b260376599271e118b67 100644 --- a/src/core/identificationgroup.h +++ b/src/core/identificationgroup.h @@ -125,6 +125,7 @@ public: const QString getTabName() const; bool contains (const MsRun * p_msrun) const; + bool containSample (const QString & sample) const; /** @brief collect mass delta between theoretical mass and observed mass diff --git a/src/core/project.cpp b/src/core/project.cpp index ed1fb0cf3476ffb64ad7e19b23d28c56200990a3..937fec4e58f39490b568811090f909b2579def80 100644 --- a/src/core/project.cpp +++ b/src/core/project.cpp @@ -51,11 +51,11 @@ void Project::readResultFile(QString filename) { qDebug() << "Project::readResultFile end"; } -bool Project::isCombineMode() const { - return _is_combine_mode; +const ProjectMode Project::getProjectMode() const { + return _project_mode; } -void Project::setCombineMode(bool is_combine_mode) { - _is_combine_mode = is_combine_mode; +void Project::setProjectMode(ProjectMode mode) { + _project_mode = mode; } std::vector<IdentificationGroup *> Project::getIdentificationGroupList() { return _identification_goup_list; diff --git a/src/core/project.h b/src/core/project.h index b7cbebe58387400d762579821513045cfcf8a046..c4e762931564d0215084ebbc51a6175c0dba9ae2 100644 --- a/src/core/project.h +++ b/src/core/project.h @@ -66,11 +66,11 @@ public: void startGrouping(WorkMonitorInterface * p_work_monitor); const GroupingType getGroupingType() const; + const ProjectMode getProjectMode() const; + void setProjectMode(ProjectMode mode); std::vector<IdentificationGroup *> getIdentificationGroupList(); const std::vector<IdentificationGroup *> getIdentificationGroupList() const; - void setCombineMode(bool is_combine_mode); - bool isCombineMode() const; void readResultFile(QString filename); /** @brief check that modifications are coded with PSI MOD accessions @@ -89,7 +89,7 @@ public: private : LabelingMethodSp _labeling_method_sp; - bool _is_combine_mode =true; + ProjectMode _project_mode = ProjectMode::combined; std::vector<IdentificationGroup *> _identification_goup_list; IdentificationGroup* _p_current_identification_group = nullptr; diff --git a/src/gui/project_view/project_view.ui b/src/gui/project_view/project_view.ui index 4ad652d86e2881e34951ed51ca2a1dd9f4dd6523..5540a46603486f9144ee9889421c96c9062afa9f 100644 --- a/src/gui/project_view/project_view.ui +++ b/src/gui/project_view/project_view.ui @@ -343,8 +343,8 @@ <slot>doFdrChanged()</slot> <hints> <hint type="sourcelabel"> - <x>100</x> - <y>87</y> + <x>442</x> + <y>430</y> </hint> <hint type="destinationlabel"> <x>484</x> @@ -359,8 +359,8 @@ <slot>doMassPrecisionUnitChanged(QString)</slot> <hints> <hint type="sourcelabel"> - <x>295</x> - <y>94</y> + <x>253</x> + <y>113</y> </hint> <hint type="destinationlabel"> <x>489</x> @@ -368,9 +368,26 @@ </hint> </hints> </connection> + <connection> + <sender>identifications_combobox</sender> + <signal>currentIndexChanged(int)</signal> + <receiver>ProjectView</receiver> + <slot>doIdentificationsComboboxChanged(int)</slot> + <hints> + <hint type="sourcelabel"> + <x>217</x> + <y>95</y> + </hint> + <hint type="destinationlabel"> + <x>742</x> + <y>141</y> + </hint> + </hints> + </connection> </connections> <slots> <slot>doFdrChanged()</slot> <slot>doMassPrecisionUnitChanged(QString)</slot> + <slot>doIdentificationsComboboxChanged(int)</slot> </slots> </ui> diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index 7a6d0d6069acd0c304dcbc8b84cc431ac3448920..5a9189483abc28b6ce16a3b91d94bda09eaca2de 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -640,11 +640,13 @@ void ProjectWindow::setProjectSp(ProjectSp project_sp) { doViewProteinList(identification_list[0]); - + //qDeleteAll(ui->identifications_widget->children()); QLayoutItem *wItem; - while (wItem = ui->identifications_widget->layout()->takeAt(0)) - delete wItem; + while (wItem = ui->identifications_widget->layout()->takeAt(0)) { + wItem->widget()->setVisible(false); + delete wItem; + } qDebug() << " ProjectWindow::setProjectSp size=" << identification_list.size(); if (identification_list.size() == 1) { @@ -694,7 +696,14 @@ void ProjectWindow::setProjectSp(ProjectSp project_sp) { //doFdrChanged(); } - +void ProjectWindow::doIdentificationsComboboxChanged(int index_in) { + qDebug() << "ProjectWindow::doIdentificationsComboboxChanged begin "; + for (int index = 0; index < ui->identifications_combobox->count(); index++) { + qobject_cast<IdentificationGroupWidget*>(qvariant_cast<QObject*>(ui->identifications_combobox->itemData(index)))->setVisible(false); + } + qobject_cast<IdentificationGroupWidget*>(qvariant_cast<QObject*>(ui->identifications_combobox->itemData(index_in)))->setVisible(true); + qDebug() << "ProjectWindow::doIdentificationsComboboxChanged end "; +} void ProjectWindow::editModifications() { _p_edit_modifications->setProjectSp(_project_sp); diff --git a/src/gui/project_view/projectwindow.h b/src/gui/project_view/projectwindow.h index f96f03b512a57d62a2bb8e05271978faa8f075d7..727708b8bc859ca48476aff76376b1930eed1de0 100644 --- a/src/gui/project_view/projectwindow.h +++ b/src/gui/project_view/projectwindow.h @@ -71,6 +71,7 @@ public slots: void doOperationFailed(QString); void doOperationFinished(); void doGroupingFinished(); + void doIdentificationsComboboxChanged(int index); void doDisplayLoadingMessage(QString message); void doDisplayLoadingMessagePercent(QString message, int value); void refreshGroup(IdentificationGroup * p_ident_group); diff --git a/src/gui/protein_list_view/proteinlistwindow.cpp b/src/gui/protein_list_view/proteinlistwindow.cpp index e3e84d72845744559f3de9cfda41591349bd45cb..2b6f1f0fdf8737a3d0d747c6924a82426923a4e2 100644 --- a/src/gui/protein_list_view/proteinlistwindow.cpp +++ b/src/gui/protein_list_view/proteinlistwindow.cpp @@ -276,6 +276,9 @@ void ProteinListWindow::setIdentificationGroup(IdentificationGroup * p_identific _protein_table_model_p->setIdentificationGroup(p_identification_group); //_p_proxy_model->setSourceModel(_protein_table_model_p); + if (_project_window->getProjectP()->getProjectMode() == ProjectMode::individual ) { + this->setWindowTitle(QString("%1 protein list").arg(_p_identification_group->getTabName())); + } QStringList msrun_list; for (MsRunSp msrun_sp : _p_identification_group->getMsRunSpList()) { diff --git a/src/gui/workerthread.cpp b/src/gui/workerthread.cpp index 55561bb885ea6fedebfb35e6f525c7f06a3799e2..0931598239a3100a66376761013822257c5f76a5 100644 --- a/src/gui/workerthread.cpp +++ b/src/gui/workerthread.cpp @@ -267,7 +267,7 @@ void WorkerThread::doWritingXpipFile(QString filename, ProjectSp project_sp) { try { emit loadingMessage(tr("writing XPIP file, please wait")); - + Xpip xpip_file(filename); xpip_file.write(project_sp); xpip_file.close(); @@ -344,7 +344,12 @@ void WorkerThread::doLoadingResults(bool is_individual, AutomaticFilterParameter throw pappso::PappsoException(QObject::tr("file list is empty")); } ProjectSp project_sp = Project().makeProjectSp(); - project_sp.get()->setCombineMode(!is_individual); + if (is_individual) { + project_sp.get()->setProjectMode(ProjectMode::individual); + } + else { + project_sp.get()->setProjectMode(ProjectMode::combined); + } _p_work_monitor->setProgressMaximumValue(file_list.size()); int i=0; diff --git a/src/input/xpipsaxhandler.cpp b/src/input/xpipsaxhandler.cpp index 31f249be1693381adcc2a03f4ea629ae065d47d9..386b829f39162d0ba6af8e514a735ac42d0f7aa9 100644 --- a/src/input/xpipsaxhandler.cpp +++ b/src/input/xpipsaxhandler.cpp @@ -166,9 +166,9 @@ bool XpipSaxHandler::startElement_information(QXmlAttributes attributes) { //<information Data_Type="indiv" match_number="223"/> qDebug() << "startElement_information "; - _p_project->setCombineMode(true); + _p_project->setProjectMode(ProjectMode::combined); if (attributes.value("Data_Type").simplified() == "indiv") { - _p_project->setCombineMode(false); + _p_project->setProjectMode(ProjectMode::individual); } _total_protein_match = attributes.value("match_number").toUInt(); diff --git a/src/input/xtpxpipsaxhandler.cpp b/src/input/xtpxpipsaxhandler.cpp index 7dd37fa0a397148c74da7d14b78f0da1f9165668..ab4743b4bfa87873e7a38c5dee7cc93d2ef0c52c 100644 --- a/src/input/xtpxpipsaxhandler.cpp +++ b/src/input/xtpxpipsaxhandler.cpp @@ -282,9 +282,9 @@ bool XtpXpipSaxHandler::startElement_description(QXmlAttributes attributes) { // <description version="0.1.23" grouping="peptidemass" combine="true" date="2017-11-17T16:02:47"/> qDebug() << "startElement_description "; - _p_project->setCombineMode(false); + _p_project->setProjectMode(ProjectMode::individual); if (attributes.value("combine") == "true") { - _p_project->setCombineMode(true); + _p_project->setProjectMode(ProjectMode::combined); } //_total_protein_match = attributes.value("match_number").toUInt(); diff --git a/src/output/ods/groupingsheet.cpp b/src/output/ods/groupingsheet.cpp index fb7480879d77df1cd9236531378e04e2d5eef174..c25bc331382d90980548d5eead9e37d5c60084ad 100644 --- a/src/output/ods/groupingsheet.cpp +++ b/src/output/ods/groupingsheet.cpp @@ -47,7 +47,7 @@ GroupingSheet::GroupingSheet (OdsExport * p_ods_export, CalcWriterInterface * p_ void GroupingSheet::writeIdentificationGroup(IdentificationGroup * p_ident) { _p_writer->writeLine(); - if (!_p_project->isCombineMode()) { + if (_p_project->getProjectMode() == ProjectMode::individual) { _p_writer->writeCell(p_ident->getMsRunSpList().at(0).get()->getSampleName()); } _p_writer->writeCell((unsigned int) p_ident->countGroup()); @@ -66,7 +66,7 @@ void GroupingSheet::writeHeaders() { // groups, subgroups, proteins, psm, sequence, peptide/mass, pep FDR, prot FDR _p_writer->writeLine(); - if (!_p_project->isCombineMode()) { + if (_p_project->getProjectMode() == ProjectMode::individual) { _p_writer->writeCell("sample"); } _p_writer->setCellAnnotation("number of groups"); diff --git a/src/output/ods/infosheet.cpp b/src/output/ods/infosheet.cpp index ff5761fa80ccbd0ee7fd0d0237105750d8b7f7fb..d3225a32083af3ded3eeda61195bb56420047266 100644 --- a/src/output/ods/infosheet.cpp +++ b/src/output/ods/infosheet.cpp @@ -48,7 +48,7 @@ InfoSheet::InfoSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer, AutomaticFilterParameters filter_param = p_project->getAutomaticFilterParameters(); p_writer->writeCell("Mode"); - if (p_project->isCombineMode()) { + if (p_project->getProjectMode() == ProjectMode::combined) { p_writer->writeCell("combine"); } else { diff --git a/src/output/proticdbml.cpp b/src/output/proticdbml.cpp index 656eb8505e0448e56ffb8f3cba3ece441821a577..84c4c2058c5d4e73476dea029f38a1ba5cef3733 100644 --- a/src/output/proticdbml.cpp +++ b/src/output/proticdbml.cpp @@ -380,7 +380,7 @@ void ProticdbMl::writeIdentificationRun(IdentificationGroup * p_identification) // indi // combine // phospho - if (_sp_project.get()->isCombineMode()) { + if (_sp_project.get()->getProjectMode() == ProjectMode::combined) { writeCvParam("PROTICdbO:0000320", "combine", ""); } else { diff --git a/src/output/xpip.cpp b/src/output/xpip.cpp index db9c2e4d0d2ee2d8de6aa6720c408146ab47b387..6dff9b3c196ac21f698a77f19a8c6b93a91ddfa2 100644 --- a/src/output/xpip.cpp +++ b/src/output/xpip.cpp @@ -155,7 +155,12 @@ void Xpip::writeDescription() { _output_stream->writeStartElement("description"); _output_stream->writeAttribute("version",XTPCPP_VERSION); _output_stream->writeAttribute("grouping","peptidemass"); - writeBooleanAttribute("combine",_sp_project.get()->isCombineMode()); + if (_sp_project.get()->getProjectMode() == ProjectMode::combined) { + writeBooleanAttribute("combine",true); + } + else { + writeBooleanAttribute("combine",false); + } _output_stream->writeAttribute("date",QDateTime::currentDateTime().toString( Qt::ISODate)); _output_stream->writeEndElement(); } diff --git a/src/utils/types.h b/src/utils/types.h index 32925ba169a745d8831438416d5f9b1226b9cb37..16889a9b904ec2317f734c68cd11aa2a17f622c5 100644 --- a/src/utils/types.h +++ b/src/utils/types.h @@ -88,6 +88,15 @@ enum class MsRunStatistics: std::int8_t { +/** \def ProjectMode separate each samples or combine all + * + */ +enum class ProjectMode { + individual, ///< separate each biological samples (2D spots for example) + combined ///< combine every MS runs to get only one protein list +}; + + /** \def GroupingType list of available grouping algoritms * */