From 98cea20b0e3c2b80c1a792013a3242c027078baa Mon Sep 17 00:00:00 2001 From: Olivier Langella <Olivier.Langella@moulon.inra.fr> Date: Thu, 30 Mar 2017 22:43:53 +0200 Subject: [PATCH] refresh and signal OK --- src/core/identificationgroup.cpp | 10 ++++++++++ src/core/identificationgroup.h | 6 +++++- src/core/peptidematch.cpp | 10 ++++++++++ src/core/peptidematch.h | 1 + src/core/proteinmatch.cpp | 10 ++++++++++ src/core/proteinmatch.h | 1 + src/gui/project_view/project_view.ui | 16 +++++++++++++++- src/gui/project_view/projectwindow.cpp | 18 ++++++++++++------ src/gui/project_view/projectwindow.h | 1 + 9 files changed, 65 insertions(+), 8 deletions(-) diff --git a/src/core/identificationgroup.cpp b/src/core/identificationgroup.cpp index 2aaf9e41..4ccd2196 100644 --- a/src/core/identificationgroup.cpp +++ b/src/core/identificationgroup.cpp @@ -62,6 +62,16 @@ std::vector<ProteinMatch *> & IdentificationGroup::getProteinMatchList() { return _protein_match_list; } +size_t IdentificationGroup::countGrouped()const { + size_t i=0; + for (auto & p_protein_match : _protein_match_list) { + if (p_protein_match->isGrouped()) { + i++; + } + } + return i; +} + size_t IdentificationGroup::countValidAndChecked()const { size_t i=0; for (auto & p_protein_match : _protein_match_list) { diff --git a/src/core/identificationgroup.h b/src/core/identificationgroup.h index 9d27dd38..ccce83c5 100644 --- a/src/core/identificationgroup.h +++ b/src/core/identificationgroup.h @@ -54,7 +54,11 @@ public: /** @brief count valid and manually checked proteins * */ std::size_t countValidAndChecked()const; - + + /** @brief count grouped proteins + * */ + std::size_t countGrouped()const; + /** @brief count groups * */ std::size_t countGroup()const; diff --git a/src/core/peptidematch.cpp b/src/core/peptidematch.cpp index 4d62a408..12afc44b 100644 --- a/src/core/peptidematch.cpp +++ b/src/core/peptidematch.cpp @@ -79,6 +79,16 @@ bool PeptideMatch::isChecked() const { bool PeptideMatch::isValidAndChecked() const { return _proxy_valid && _checked; } + +bool PeptideMatch::isGrouped() const { + if (_sp_grp_peptide.get() == nullptr) { + return false; + } + if (_sp_grp_peptide.get()->getGroupNumber() ==0) { + return false; + } + return true; +} void PeptideMatch::setIdentificationDataSource(IdentificationDataSource* identification_source) { _p_identification_source = identification_source; } diff --git a/src/core/peptidematch.h b/src/core/peptidematch.h index 8f36a831..3fd03a27 100644 --- a/src/core/peptidematch.h +++ b/src/core/peptidematch.h @@ -55,6 +55,7 @@ public : bool isChecked() const; bool isValid() const; bool isValidAndChecked() const; + bool isGrouped() const; const pappso::MsRunIdSp & getMsRunIdSp() const; IdentificationDataSource* getIdentificationDataSource () const; diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index de37d490..0b046a4c 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -107,6 +107,16 @@ bool ProteinMatch::isValidAndChecked() const { return _proxy_valid && _checked; } +bool ProteinMatch::isGrouped() const { + if (_sp_grp_protein.get() == nullptr) { + return false; + } + if (_sp_grp_protein.get()->getGroupNumber() == 0) { + return false; + } + return true; +} + void ProteinMatch::setChecked(bool arg1) { _checked = arg1; } diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index 9269a875..ec757235 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -81,6 +81,7 @@ public: bool isChecked() const; bool isValid() const; bool isValidAndChecked() const; + bool isGrouped() const; /** @brief count valid spectrums * */ diff --git a/src/gui/project_view/project_view.ui b/src/gui/project_view/project_view.ui index fd1ecee5..46400275 100644 --- a/src/gui/project_view/project_view.ui +++ b/src/gui/project_view/project_view.ui @@ -85,6 +85,20 @@ </property> </widget> </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Number of grouped proteins</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QLabel" name="protein_number_display"> + <property name="text"> + <string>0</string> + </property> + </widget> + </item> </layout> </item> </layout> @@ -140,7 +154,7 @@ <x>0</x> <y>0</y> <width>445</width> - <height>23</height> + <height>25</height> </rect> </property> </widget> diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index 06c18052..6d6dbd3d 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -139,13 +139,23 @@ void ProjectWindow::connectNewPeptideListWindow() { qDebug() << "ProjectWindow::connectNewPeptideListWindow end"; } +void ProjectWindow::refreshGroup(IdentificationGroup * p_ident_group) { + + vector< MsRunIdSp > ms_run_list = p_ident_group->getMsRunIdSpList(); + ui->sample_number_display->setText(QString("%1").arg(ms_run_list.size())); + + ui->group_number_display->setText(QString("%1").arg(p_ident_group->countGroup())); + ui->subgroup_number_display->setText(QString("%1").arg(p_ident_group->countSubGroup())); + ui->protein_number_display->setText(QString("%1").arg(p_ident_group->countGrouped())); + emit identificationGroupGrouped(p_ident_group); +} void ProjectWindow::doIdentificationGroupEdited(IdentificationGroup * p_ident_group) { qDebug() << "ProjectWindow::doIdentificationGroupEdited begin"; p_ident_group->startGrouping(_project_sp.get()->getGroupingType()); - emit identificationGroupGrouped(p_ident_group); + refreshGroup(p_ident_group); qDebug() << "ProjectWindow::doIdentificationGroupEdited end"; } @@ -220,11 +230,7 @@ void ProjectWindow::setProjectSp(ProjectSp project_sp) { _p_current_protein_list_window = nullptr; _project_sp = project_sp; - vector< MsRunIdSp > ms_run_list = _project_sp.get()->getCurrentIdentificationGroupP()->getMsRunIdSpList(); - ui->sample_number_display->setText(QString("%1").arg(ms_run_list.size())); - - ui->group_number_display->setText(QString("%1").arg(_project_sp.get()->getCurrentIdentificationGroupP()->countGroup())); - ui->subgroup_number_display->setText(QString("%1").arg(_project_sp.get()->getCurrentIdentificationGroupP()->countSubGroup())); + refreshGroup(_project_sp.get()->getCurrentIdentificationGroupP()); //_protein_list_window->setIdentificationGroup(_project_sp.get()->getCurrentIdentificationGroupP()); //_protein_list_window->show(); this->setEnabled(true); diff --git a/src/gui/project_view/projectwindow.h b/src/gui/project_view/projectwindow.h index d770c8fb..3522a96c 100644 --- a/src/gui/project_view/projectwindow.h +++ b/src/gui/project_view/projectwindow.h @@ -62,6 +62,7 @@ private : void connectNewProteinListWindow(); void connectNewPeptideListWindow(); void connectNewProteinDetailWindow(); + void refreshGroup(IdentificationGroup * p_ident_group); private: Ui::ProjectView *ui; MainWindow * main_window; -- GitLab