From cafd9651cda4bf0563d55d8f1a6ba3e734530c5d Mon Sep 17 00:00:00 2001 From: Olivier Langella <Olivier.Langella@moulon.inra.fr> Date: Sat, 1 Apr 2017 12:14:00 +0200 Subject: [PATCH] trying to update valid protein status --- src/core/project.cpp | 4 +- src/core/project.h | 1 + src/core/proteinmatch.cpp | 44 ++++++------ src/core/proteinmatch.h | 4 +- .../peptide_list_view/peptidelistwindow.cpp | 2 + .../peptidetableproxymodel.cpp | 1 + src/gui/project_view/projectwindow.cpp | 4 ++ src/gui/project_view/projectwindow.h | 1 + src/gui/protein_view/protein_detail_view.ui | 70 +++++++++++++------ src/gui/protein_view/proteinwindow.cpp | 1 + 10 files changed, 85 insertions(+), 47 deletions(-) diff --git a/src/core/project.cpp b/src/core/project.cpp index 7c09d5e3..ff0b7c75 100644 --- a/src/core/project.cpp +++ b/src/core/project.cpp @@ -48,7 +48,9 @@ PeptideStore & Project::getPeptideStore() { ProteinStore & Project::getProteinStore() { return _protein_store; } - +const AutomaticFilterParameters & Project::getAutomaticFilterParameters() const { + return _automatic_filter_parameters; +} void Project::updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters) { _automatic_filter_parameters = automatic_filter_parameters; for (auto & p_id_group : _identification_goup_list) { diff --git a/src/core/project.h b/src/core/project.h index 677f54ad..5f64afb9 100644 --- a/src/core/project.h +++ b/src/core/project.h @@ -52,6 +52,7 @@ public: /** @brief validate or invalidate peptides and proteins based automatic filters and manual checks * */ void updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters); + const AutomaticFilterParameters & getAutomaticFilterParameters() const; void startGrouping(); const GroupingType getGroupingType() const; diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index e00020a3..98b5a7ee 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -42,7 +42,7 @@ ProteinMatch::~ProteinMatch() } 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(); @@ -69,12 +69,14 @@ void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & auto } } + if (number_of_valid_peptides > 0) { - if (number_of_valid_peptides < automatic_filter_parameters.getFilterMinimumPeptidePerMatch()) { - } - else { - if (_evalue <= automatic_filter_parameters.getFilterProteinEvalue()) { - _proxy_valid = true; + if (number_of_valid_peptides < automatic_filter_parameters.getFilterMinimumPeptidePerMatch()) { + } + else { + if (getEvalue() <= automatic_filter_parameters.getFilterProteinEvalue()) { + _proxy_valid = true; + } } } qDebug() <<"ProteinMatch::updateAutomaticFilters end " << number_of_valid_peptides ; @@ -270,7 +272,7 @@ pappso::pappso_double ProteinMatch::getPAI(const pappso::MsRunIdSp & sp_msrun_id const QString ProteinMatch::getHtmlSequence() const { - size_t prot_size = _protein_sp.get()->size(); + size_t prot_size = _protein_sp.get()->size(); //qDebug() << "ProteinMatch::getCoverage begin prot_size=" << prot_size << " " << _protein_sp.get()-//>getSequence(); if (prot_size == 0) return 0; bool cover_bool[prot_size] = {false}; @@ -287,21 +289,21 @@ const QString ProteinMatch::getHtmlSequence() const } QString sequence = getProteinXtpSp().get()->getSequence(); QString sequence_html; - for (unsigned int i=0; i < prot_size; i++) { - - if(cover_bool[i]) { - sequence_html.append(QString("<span style=\"background-color:yellow;\">%1").arg(sequence[i])); - i++; - for (;i < prot_size; i++) { - if(cover_bool[i]) { - sequence_html.append(sequence[i]); - } - else { - sequence_html.append(QString("</span>%1").arg(sequence[i])); - break; - } + for (unsigned int i=0; i < prot_size; i++) { + + if(cover_bool[i]) { + sequence_html.append(QString("<span style=\"background-color:yellow;\">%1").arg(sequence[i])); + i++; + for (; i < prot_size; i++) { + if(cover_bool[i]) { + sequence_html.append(sequence[i]); } - sequence_html.append(QString("</span>")); + else { + sequence_html.append(QString("</span>%1").arg(sequence[i])); + break; + } + } + sequence_html.append(QString("</span>")); } else { sequence_html.append(sequence[i]); diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index ec757235..49cc8fca 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -98,12 +98,12 @@ public: const pappso::GrpProteinSp & getGrpProteinSp() const; const GroupingGroupSp & getGroupingGroupSp() const; -protected : - /** @brief validate or invalidate peptides and proteins based automatic filters and manual checks * */ void updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters); +protected : + void setGroupingExperiment(GroupingExperiment * p_grp_experiment); void setGroupInstance(GroupStore & group_store); diff --git a/src/gui/peptide_list_view/peptidelistwindow.cpp b/src/gui/peptide_list_view/peptidelistwindow.cpp index ed693ec9..c25b24f2 100644 --- a/src/gui/peptide_list_view/peptidelistwindow.cpp +++ b/src/gui/peptide_list_view/peptidelistwindow.cpp @@ -99,6 +99,8 @@ void PeptideListWindow::setProteinMatch(IdentificationGroup * p_identification_g void PeptideListWindow::edited() { qDebug() << "PeptideListWindow::edited begin"; //emit dataChanged(index, index); + + _p_protein_match->updateAutomaticFilters(_project_window->getProjectP()->getAutomaticFilterParameters()); _project_window->doIdentificationGroupEdited(_p_identification_group); //updateStatusBar(); diff --git a/src/gui/peptide_list_view/peptidetableproxymodel.cpp b/src/gui/peptide_list_view/peptidetableproxymodel.cpp index 71db91f3..4326afaf 100644 --- a/src/gui/peptide_list_view/peptidetableproxymodel.cpp +++ b/src/gui/peptide_list_view/peptidetableproxymodel.cpp @@ -65,6 +65,7 @@ bool PeptideTableProxyModel::filterAcceptsRow(int source_row, } } + return true; } catch (pappso::PappsoException exception_pappso) { diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index 45d9fa46..a0c28b9a 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -65,6 +65,10 @@ ProjectWindow::~ProjectWindow() delete ui; } + +Project * ProjectWindow::getProjectP() { + return _project_sp.get(); +} void ProjectWindow::setDefaultProteinListWindow(ProteinListWindow* p_protein_list_window) { qDebug() << "ProjectWindow::setDefaultProteinListWindow begin"; _p_current_protein_list_window = p_protein_list_window; diff --git a/src/gui/project_view/projectwindow.h b/src/gui/project_view/projectwindow.h index c82caf7b..56854003 100644 --- a/src/gui/project_view/projectwindow.h +++ b/src/gui/project_view/projectwindow.h @@ -45,6 +45,7 @@ class ProjectWindow: public QMainWindow { public: explicit ProjectWindow(MainWindow * parent = 0); + Project * getProjectP(); void setProjectSp(ProjectSp project_sp); ~ProjectWindow(); diff --git a/src/gui/protein_view/protein_detail_view.ui b/src/gui/protein_view/protein_detail_view.ui index eb49e155..026af897 100644 --- a/src/gui/protein_view/protein_detail_view.ui +++ b/src/gui/protein_view/protein_detail_view.ui @@ -18,29 +18,53 @@ <item row="1" column="0"> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QLabel" name="descriptionLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>167</height> - </size> - </property> - <property name="text"> - <string>TextLabel</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - <property name="textInteractionFlags"> - <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> - </property> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="descriptionLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>167</height> + </size> + </property> + <property name="text"> + <string>TextLabel</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="textInteractionFlags"> + <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="validCheckBox"> + <property name="text"> + <string>valid</string> + </property> + </widget> + </item> + </layout> </item> <item> <widget class="QTextEdit" name="sequenceTextEdit"> diff --git a/src/gui/protein_view/proteinwindow.cpp b/src/gui/protein_view/proteinwindow.cpp index 5dc6e5de..8da3bcb8 100644 --- a/src/gui/protein_view/proteinwindow.cpp +++ b/src/gui/protein_view/proteinwindow.cpp @@ -63,6 +63,7 @@ void ProteinWindow::doIdentificationGroupGrouped(IdentificationGroup * p_identif void ProteinWindow::updateDisplay() { try { + if (_p_protein_match->isValid()) ui->validCheckBox->setCheckState(Qt::Checked); 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()); -- GitLab