From 7ecd65489442066139e078c9a6a39921d84c690d Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Mon, 15 Oct 2018 19:21:00 +0200 Subject: [PATCH] new controls on decoy and contaminant widgets --- src/gui/project_view/project_view.ui | 49 ++--- src/gui/project_view/projectwindow.cpp | 177 ++++-------------- src/gui/project_view/projectwindow.h | 5 +- .../contaminant_widget/contaminantwidget.cpp | 67 ++++--- src/gui/widgets/decoy_widget/decoy_widget.ui | 80 ++------ src/gui/widgets/decoy_widget/decoywidget.cpp | 79 +++++--- src/utils/fastafilestore.cpp | 4 +- 7 files changed, 179 insertions(+), 282 deletions(-) diff --git a/src/gui/project_view/project_view.ui b/src/gui/project_view/project_view.ui index b89a7c5dd..e3bdb7040 100644 --- a/src/gui/project_view/project_view.ui +++ b/src/gui/project_view/project_view.ui @@ -199,9 +199,9 @@ </spacer> </item> <item> - <widget class="QPushButton" name="fdr_button"> + <widget class="QPushButton" name="apply_fdr_button"> <property name="text"> - <string>OK</string> + <string>apply</string> </property> </widget> </item> @@ -376,22 +376,6 @@ </customwidgets> <resources/> <connections> - <connection> - <sender>fdr_button</sender> - <signal>clicked()</signal> - <receiver>ProjectView</receiver> - <slot>doFdrChanged()</slot> - <hints> - <hint type="sourcelabel"> - <x>448</x> - <y>219</y> - </hint> - <hint type="destinationlabel"> - <x>484</x> - <y>334</y> - </hint> - </hints> - </connection> <connection> <sender>precision_unit_combobox</sender> <signal>currentIndexChanged(QString)</signal> @@ -399,8 +383,8 @@ <slot>doMassPrecisionUnitChanged(QString)</slot> <hints> <hint type="sourcelabel"> - <x>119</x> - <y>104</y> + <x>253</x> + <y>113</y> </hint> <hint type="destinationlabel"> <x>489</x> @@ -431,8 +415,8 @@ <slot>doFilterChanged()</slot> <hints> <hint type="sourcelabel"> - <x>119</x> - <y>104</y> + <x>131</x> + <y>101</y> </hint> <hint type="destinationlabel"> <x>815</x> @@ -447,8 +431,8 @@ <slot>doApplyFilter()</slot> <hints> <hint type="sourcelabel"> - <x>119</x> - <y>104</y> + <x>448</x> + <y>136</y> </hint> <hint type="destinationlabel"> <x>689</x> @@ -472,6 +456,22 @@ </hint> </hints> </connection> + <connection> + <sender>apply_fdr_button</sender> + <signal>clicked()</signal> + <receiver>ProjectView</receiver> + <slot>doApplyDecoy()</slot> + <hints> + <hint type="sourcelabel"> + <x>424</x> + <y>201</y> + </hint> + <hint type="destinationlabel"> + <x>682</x> + <y>284</y> + </hint> + </hints> + </connection> </connections> <slots> <slot>doFdrChanged()</slot> @@ -481,5 +481,6 @@ <slot>doSelectContaminantSource()</slot> <slot>doFilterChanged()</slot> <slot>doApplyFilter()</slot> + <slot>doApplyDecoy()</slot> </slots> </ui> diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index 8ee7b7e54..2d8240d6c 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -126,22 +126,20 @@ ProjectWindow::ProjectWindow(MainWindow *parent) ProjectWindow::~ProjectWindow() { - qDebug() << "ProjectWindow::~ProjectWindow"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; // if (_p_ms_data_file != nullptr) delete _p_ms_data_file; _worker_thread.quit(); _worker_thread.wait(); - qDebug() << "ProjectWindow::~ProjectWindow1"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; delete ui; - qDebug() << "ProjectWindow::~ProjectWindow2"; - delete _p_fasta_str_li; - qDebug() << "ProjectWindow::~ProjectWindow3"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; delete _p_edit_modifications; - qDebug() << "ProjectWindow::~ProjectWindow5"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; delete _p_edit_label_methods; - qDebug() << "ProjectWindow::~ProjectWindow6"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; delete _p_waiting_message_dialog; - qDebug() << "ProjectWindow::~ProjectWindow end"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; } Project * @@ -153,29 +151,29 @@ void ProjectWindow::setDefaultProteinListWindow( ProteinListWindow *p_protein_list_window) { - qDebug() << "ProjectWindow::setDefaultProteinListWindow begin"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; _p_current_protein_list_window = p_protein_list_window; - qDebug() << "ProjectWindow::setDefaultProteinListWindow end"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; } void ProjectWindow::connectNewPtmIslandListWindow() { - qDebug() << "ProjectWindow::connectNewPtmIslandListWindow begin"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; _p_current_ptm_island_list_window = new PtmIslandListWindow(this); _ptm_island_list_window_collection.push_back( _p_current_ptm_island_list_window); - qDebug() << "ProjectWindow::connectNewPtmIslandListWindow end"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; } void ProjectWindow::connectNewProteinListWindow() { - qDebug() << "ProjectWindow::connectNewProteinListWindow begin"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; _p_current_protein_list_window = new ProteinListWindow(this); _protein_list_window_collection.push_back(_p_current_protein_list_window); - qDebug() << "ProjectWindow::connectNewProteinListWindow end"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; } void @@ -395,69 +393,6 @@ ProjectWindow::computeMassPrecision() } qDebug() << "ProjectWindow::computeMassPrecision end"; } - -void -ProjectWindow::doFdrChanged() -{ - qDebug() << "ProjectWindow::doFdrChanged begin "; - try - { - showWaitingMessage(tr("FDR modifications")); - doDisplayLoadingMessage(tr("tagging decoy proteins")); - if(ui->decoy_regexp_radiobutton->isChecked()) - { - _project_sp.get()->getProteinStore().setRegexpDecoyPattern( - ui->decoy_protein_regexp_line_edit->text()); - } - else - { - _project_sp.get()->getProteinStore().clearDecoys(); - QModelIndexList index_list = - ui->decoy_database_listview->selectionModel()->selectedIndexes(); - if(index_list.size() > 0) - { - qDebug() << "ProjectWindow::doFdrChanged index_list.size()=" - << index_list.size(); - 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 *>()")); - } - } - } - } - doDisplayLoadingMessage(tr("updating filters")); - _project_sp.get()->updateAutomaticFilters( - _project_sp.get()->getAutomaticFilterParameters()); - - // re group - emit operateGrouping(_project_sp); - } - 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()); - } - - qDebug() << "ProjectWindow::doFdrChanged end "; -} void ProjectWindow::refresh() { @@ -475,6 +410,14 @@ ProjectWindow::doContaminantSelectionChanged() qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; } +void +ProjectWindow::doDecoySelectionChanged() +{ + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; + ui->apply_fdr_button->setEnabled(true); + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; +} + void ProjectWindow::doAutomaticFilterParametersChanged( AutomaticFilterParameters parameters) @@ -687,39 +630,17 @@ ProjectWindow::doViewProteinList(IdentificationGroup *p_identification_group) void ProjectWindow::setProjectSp(ProjectSp project_sp) { - qDebug() << "ProjectWindow::setProjectSp begin"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; _project_sp = project_sp; - ui->decoy_regexp_radiobutton->setChecked(true); - ui->decoy_regexp_groupbox->setVisible(true); - ui->decoy_database_groupbox->setVisible(false); - if(_project_sp.get()->getProteinStore().getDecoyFastaFileList().size() > 0) - { - ui->decoy_database_files_radiobutton->setChecked(true); - ui->decoy_regexp_groupbox->setVisible(false); - ui->decoy_database_groupbox->setVisible(true); - } - ui->contaminant_widget->getProjectContaminants(_project_sp.get()); + ui->decoy_widget->getProjectDecoys(_project_sp.get()); - qDebug() << "ProjectWindow::setProjectSp begin " + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " " << _project_sp.get()->getFastaFileStore().getFastaFileList().size(); _fastafile_list = _project_sp.get()->getFastaFileStore().getFastaFileList(); - _p_fasta_str_li->removeRows(0, _p_fasta_str_li->rowCount()); - for(FastaFileSp fasta_file : _fastafile_list) - { - - QStandardItem *item; - item = - new QStandardItem(QString("%1").arg(fasta_file.get()->getFilename())); - item->setEditable(false); - item->setData(QVariant::fromValue(fasta_file.get()), Qt::UserRole); - _p_fasta_str_li->appendRow(item); - // item->setData(QVariant(QString("%1").arg(fasta_file.get()->getAbsoluteFilePath())),Qt::UserRole); - } - for(auto &&p_window : _ptm_island_list_window_collection) { delete p_window; @@ -783,7 +704,8 @@ ProjectWindow::setProjectSp(ProjectSp project_sp) _p_xic_window = nullptr; } - qDebug() << " ProjectWindow::setProjectSp size=" + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ + << " ProjectWindow::setProjectSp size=" << identification_list.size(); if(identification_list.size() == 1) { @@ -836,19 +758,18 @@ ProjectWindow::setProjectSp(ProjectSp project_sp) //_protein_list_window->setIdentificationGroup(_project_sp.get()->getCurrentIdentificationGroupP()); //_protein_list_window->show(); - ui->decoy_protein_regexp_line_edit->setText( - _project_sp.get()->getProteinStore().getRegexpDecoy().pattern()); - refresh(); this->setEnabled(true); + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; // doAutomaticFilterParametersChanged(params); // doFdrChanged(); } void ProjectWindow::doIdentificationsComboboxChanged(int index_in) { - qDebug() << "ProjectWindow::doIdentificationsComboboxChanged begin "; + + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; for(int index = 0; index < ui->identifications_combobox->count(); index++) { qobject_cast<IdentificationGroupWidget *>( @@ -858,7 +779,8 @@ ProjectWindow::doIdentificationsComboboxChanged(int index_in) qobject_cast<IdentificationGroupWidget *>( qvariant_cast<QObject *>(ui->identifications_combobox->itemData(index_in))) ->setVisible(true); - qDebug() << "ProjectWindow::doIdentificationsComboboxChanged end "; + + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; } void @@ -901,8 +823,7 @@ ProjectWindow::doIdentificationGroupEdited( { showWaitingMessage(tr("Updating identification group")); - qDebug() << "ProjectWindow::doIdentificationGroupEdited emit " - "operateGroupingOnIdentification(_project_sp) "; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; emit operateGroupingOnIdentification(p_identification_group, _project_sp.get()->getGroupingType()); } @@ -918,7 +839,8 @@ ProjectWindow::viewError(QString error) void ProjectWindow::doAcceptedLabelingMethod() { - qDebug() << "ProjectWindow::doAcceptedLabelingMethod"; + + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; showWaitingMessage(tr("Apply labeling method")); LabelingMethodSp labeling_method_sp = @@ -928,8 +850,7 @@ ProjectWindow::doAcceptedLabelingMethod() doDisplayLoadingMessage(tr("labeling peptides")); - qDebug() << "ProjectWindow::doAcceptedLabelingMethod emit " - "operateGrouping(_project_sp) "; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; emit operateGrouping(_project_sp); } @@ -937,7 +858,8 @@ ProjectWindow::doAcceptedLabelingMethod() void ProjectWindow::openInXicViewer(const PeptideEvidence *p_peptide_evidence) { - qDebug() << "ProjectWindow::openInXicViewer begin"; + + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; if(_p_xic_window == nullptr) { _p_xic_window = new XicWindow(this); @@ -946,38 +868,22 @@ ProjectWindow::openInXicViewer(const PeptideEvidence *p_peptide_evidence) _p_xic_window->show(); _p_xic_window->addXic(p_peptide_evidence); - qDebug() << "ProjectWindow::openInXicViewer end"; -} - -void -ProjectWindow::doSelectDecoySource() -{ - qDebug() << "ProjectWindow::doSelectDecoySource begin"; - ui->decoy_database_groupbox->setVisible(false); - ui->decoy_regexp_groupbox->setVisible(false); - if(ui->decoy_database_files_radiobutton->isChecked()) - { - ui->decoy_database_groupbox->setVisible(true); - } - else - { - ui->decoy_regexp_groupbox->setVisible(true); - } - qDebug() << "ProjectWindow::doSelectDecoySource end"; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; } + void ProjectWindow::doFilterChanged() { ui->apply_filter_button->setEnabled(true); - ui->fdr_button->setEnabled(true); + ui->apply_fdr_button->setEnabled(true); } void ProjectWindow::doApplyDecoy() { - ui->fdr_button->setEnabled(false); + ui->apply_fdr_button->setEnabled(false); // doAutomaticFilterParametersChanged(automatic_filter); try { @@ -991,8 +897,7 @@ ProjectWindow::doApplyDecoy() doDisplayLoadingMessage(tr("updating filters")); _project_sp.get()->updateAutomaticFilters( _project_sp.get()->getAutomaticFilterParameters()); - - + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; emit operateGrouping(_project_sp); diff --git a/src/gui/project_view/projectwindow.h b/src/gui/project_view/projectwindow.h index 6ff7aa6cb..836e4d3da 100644 --- a/src/gui/project_view/projectwindow.h +++ b/src/gui/project_view/projectwindow.h @@ -67,8 +67,6 @@ class ProjectWindow : public QMainWindow void doViewProteinList(IdentificationGroup *p_identification_group = nullptr); void setDefaultProteinListWindow(ProteinListWindow *p_protein_list_window); void doAutomaticFilterParametersChanged(AutomaticFilterParameters parameters); - void doFdrChanged(); - void doSelectDecoySource(); void doMassPrecisionUnitChanged(QString combo_value); void doOperationFailed(QString); void doOperationFinished(); @@ -82,6 +80,7 @@ class ProjectWindow : public QMainWindow void doViewPeptideDetail(PeptideEvidence *peptide_evidence); void doFilterChanged(); void doApplyFilter(); + void doApplyDecoy(); // void setColor(const QColor &color); // void setShape(Shape shape); signals: @@ -141,9 +140,7 @@ class ProjectWindow : public QMainWindow ProjectSp _project_sp; - QStandardItemModel *_p_fasta_str_li; std::vector<FastaFileSp> _fastafile_list; WaitingMessageDialog *_p_waiting_message_dialog; // QCPBars *_p_bars; }; - diff --git a/src/gui/widgets/contaminant_widget/contaminantwidget.cpp b/src/gui/widgets/contaminant_widget/contaminantwidget.cpp index 2ab9d7847..5e167b1d4 100644 --- a/src/gui/widgets/contaminant_widget/contaminantwidget.cpp +++ b/src/gui/widgets/contaminant_widget/contaminantwidget.cpp @@ -120,41 +120,56 @@ ContaminantWidget::setProjectContaminants(Project *p_project) { qDebug() << "ContaminantWidget::setProjectContaminants begin"; _emit_changed = false; - if(ui->contaminant_file_radiobutton->isChecked()) + try { - QModelIndexList index_list = - ui->contaminant_database_listview->selectionModel()->selectedIndexes(); - p_project->getProteinStore().clearContaminants(); - if(index_list.size() > 0) + if(ui->contaminant_file_radiobutton->isChecked()) { - for(QModelIndex index : index_list) + QModelIndexList index_list = + ui->contaminant_database_listview->selectionModel() + ->selectedIndexes(); + p_project->getProteinStore().clearContaminants(); + if(index_list.size() > 0) { - if(index.data(Qt::UserRole).canConvert<FastaFileSp>()) - { - FastaFileSp p_fasta_file = - index.data(Qt::UserRole).value<FastaFileSp>(); - p_fasta_file.get()->setContaminants( - p_project->getProteinStore()); - } - else + for(QModelIndex index : index_list) { - throw pappso::PappsoException( - QObject::tr("can not convert to FastaFile " - "index.data().canConvert<FastaFile *>()")); + if(index.data(Qt::UserRole).canConvert<FastaFileSp>()) + { + FastaFileSp p_fasta_file = + index.data(Qt::UserRole).value<FastaFileSp>(); + p_fasta_file.get()->setContaminants( + p_project->getProteinStore()); + } + else + { + throw pappso::PappsoException( + QObject::tr("can not convert to FastaFile " + "index.data().canConvert<FastaFile *>()")); + } } } - } - if(_no_project) + if(_no_project) + { + ui->control_list_widget->setVisible(true); + } + } + else { - ui->control_list_widget->setVisible(true); + p_project->getProteinStore().setRegexpContaminantPattern( + ui->contaminant_protein_regexp_line_edit->text()); + ui->control_list_widget->setVisible(false); } } - else + + catch(pappso::PappsoException &exception_pappso) + { + _emit_changed = true; + throw exception_pappso; + } + catch(std::exception &exception_std) { - p_project->getProteinStore().setRegexpContaminantPattern( - ui->contaminant_protein_regexp_line_edit->text()); - ui->control_list_widget->setVisible(false); + _emit_changed = true; + throw exception_std; } _emit_changed = true; qDebug() << "ContaminantWidget::setProjectContaminants end"; @@ -200,7 +215,9 @@ ContaminantWidget::doSelectFastaFile() settings.value("path/fastafiles_directory", "").toString(); QStringList filenames = QFileDialog::getOpenFileNames( - this, tr("FASTA files"), default_fasta_location, + this, + tr("FASTA files"), + default_fasta_location, tr("FASTA files (*.fasta);;all files (*)")); if(filenames.size() > 0) diff --git a/src/gui/widgets/decoy_widget/decoy_widget.ui b/src/gui/widgets/decoy_widget/decoy_widget.ui index 2530fec86..1f6656a07 100644 --- a/src/gui/widgets/decoy_widget/decoy_widget.ui +++ b/src/gui/widgets/decoy_widget/decoy_widget.ui @@ -17,7 +17,7 @@ <item> <widget class="QGroupBox" name="decoy_groupbox"> <property name="title"> - <string>Contaminants</string> + <string>Decoys</string> </property> <layout class="QVBoxLayout" name="verticalLayout_6"> <item> @@ -28,7 +28,7 @@ <string>select decoys from fasta files</string> </property> <property name="text"> - <string>decoy file</string> + <string>deco&y file</string> </property> <property name="checked"> <bool>true</bool> @@ -136,82 +136,34 @@ </hints> </connection> <connection> - <sender>contaminant_regexp_radiobutton</sender> - <signal>clicked()</signal> - <receiver>ContaminantWidget</receiver> - <slot>doSelectContaminantSource()</slot> - <hints> - <hint type="sourcelabel"> - <x>226</x> - <y>52</y> - </hint> - <hint type="destinationlabel"> - <x>670</x> - <y>79</y> - </hint> - </hints> - </connection> - <connection> - <sender>pushButton_2</sender> - <signal>clicked()</signal> - <receiver>ContaminantWidget</receiver> - <slot>doSelectFastaFile()</slot> - <hints> - <hint type="sourcelabel"> - <x>333</x> - <y>229</y> - </hint> - <hint type="destinationlabel"> - <x>690</x> - <y>146</y> - </hint> - </hints> - </connection> - <connection> - <sender>pushButton</sender> - <signal>clicked()</signal> - <receiver>ContaminantWidget</receiver> - <slot>doClearList()</slot> - <hints> - <hint type="sourcelabel"> - <x>269</x> - <y>220</y> - </hint> - <hint type="destinationlabel"> - <x>508</x> - <y>201</y> - </hint> - </hints> - </connection> - <connection> - <sender>contaminant_database_listview</sender> - <signal>clicked(QModelIndex)</signal> - <receiver>ContaminantWidget</receiver> + <sender>decoy_protein_regexp_line_edit</sender> + <signal>textChanged(QString)</signal> + <receiver>DecoyWidget</receiver> <slot>doChanged()</slot> <hints> <hint type="sourcelabel"> - <x>317</x> - <y>102</y> + <x>167</x> + <y>267</y> </hint> <hint type="destinationlabel"> - <x>714</x> - <y>107</y> + <x>657</x> + <y>303</y> </hint> </hints> </connection> <connection> - <sender>decoy_protein_regexp_line_edit</sender> - <signal>textChanged(QString)</signal> + <sender>decoy_regexp_radiobutton</sender> + <signal>clicked()</signal> <receiver>DecoyWidget</receiver> - <slot>doChanged()</slot> + <slot>doSelectDecoySource()</slot> <hints> <hint type="sourcelabel"> - <x>167</x> - <y>267</y> + <x>358</x> + <y>57</y> </hint> <hint type="destinationlabel"> - <x>657</x> - <y>303</y> + <x>602</x> + <y>99</y> </hint> </hints> </connection> diff --git a/src/gui/widgets/decoy_widget/decoywidget.cpp b/src/gui/widgets/decoy_widget/decoywidget.cpp index 9c8101f81..b2289982a 100644 --- a/src/gui/widgets/decoy_widget/decoywidget.cpp +++ b/src/gui/widgets/decoy_widget/decoywidget.cpp @@ -65,9 +65,11 @@ DecoyWidget::~DecoyWidget() void DecoyWidget::setRegexpDecoyPattern(const QString &pattern) { + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; _emit_changed = false; ui->decoy_protein_regexp_line_edit->setText(pattern); _emit_changed = true; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; } @@ -75,6 +77,7 @@ void DecoyWidget::setFastaFileList(std::vector<FastaFileSp> fasta_file_list) { + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; _p_fasta_str_li->removeRows(0, _p_fasta_str_li->rowCount()); for(FastaFileSp fasta_file : fasta_file_list) { @@ -87,16 +90,20 @@ DecoyWidget::setFastaFileList(std::vector<FastaFileSp> fasta_file_list) _p_fasta_str_li->appendRow(item); // item->setData(QVariant(QString("%1").arg(fasta_file.get()->getAbsoluteFilePath())),Qt::UserRole); } + + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; } void DecoyWidget::getProjectDecoys(const Project *p_project) { + + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; _emit_changed = false; ui->decoy_regexp_radiobutton->setChecked(true); ui->decoy_protein_regexp_line_edit->setVisible(true); ui->decoy_database_listview->setVisible(false); - if(p_project->getProteinStore().getContaminantFastaFileList().size() > 0) + if(p_project->getProteinStore().getDecoyFastaFileList().size() > 0) { ui->decoy_file_radiobutton->setChecked(true); ui->decoy_protein_regexp_line_edit->setVisible(false); @@ -104,13 +111,15 @@ DecoyWidget::getProjectDecoys(const Project *p_project) } ui->decoy_protein_regexp_line_edit->setText( - p_project->getProteinStore().getRegexpContaminant().pattern()); + p_project->getProteinStore().getRegexpDecoy().pattern()); this->setFastaFileList(p_project->getFastaFileStore().getFastaFileList()); ui->control_list_widget->setVisible(false); _no_project = false; _emit_changed = true; + + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; } void @@ -119,41 +128,56 @@ DecoyWidget::setProjectDecoys(Project *p_project) qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; _emit_changed = false; - if(ui->decoy_file_radiobutton->isChecked()) + try { - QModelIndexList index_list = - ui->decoy_database_listview->selectionModel()->selectedIndexes(); - p_project->getProteinStore().clearContaminants(); - if(index_list.size() > 0) + if(ui->decoy_file_radiobutton->isChecked()) { - for(QModelIndex index : index_list) + QModelIndexList index_list = + ui->decoy_database_listview->selectionModel()->selectedIndexes(); + p_project->getProteinStore().clearDecoys(); + if(index_list.size() > 0) { - if(index.data(Qt::UserRole).canConvert<FastaFileSp>()) + for(QModelIndex index : index_list) { - FastaFileSp p_fasta_file = - index.data(Qt::UserRole).value<FastaFileSp>(); - p_fasta_file.get()->setContaminants( - p_project->getProteinStore()); - } - else - { - throw pappso::PappsoException( - QObject::tr("can not convert to FastaFile " - "index.data().canConvert<FastaFile *>()")); + if(index.data(Qt::UserRole).canConvert<FastaFileSp>()) + { + FastaFileSp p_fasta_file = + index.data(Qt::UserRole).value<FastaFileSp>(); + + p_fasta_file.get()->setDecoys( + p_project->getProteinStore()); + } + else + { + throw pappso::PappsoException( + QObject::tr("can not convert to FastaFile " + "index.data().canConvert<FastaFile *>()")); + } } } - } - if(_no_project) + + if(_no_project) + { + ui->control_list_widget->setVisible(true); + } + } + else { - ui->control_list_widget->setVisible(true); + p_project->getProteinStore().setRegexpDecoyPattern( + ui->decoy_protein_regexp_line_edit->text()); + ui->control_list_widget->setVisible(false); } } - else + catch(pappso::PappsoException &exception_pappso) { - p_project->getProteinStore().setRegexpContaminantPattern( - ui->decoy_protein_regexp_line_edit->text()); - ui->control_list_widget->setVisible(false); + _emit_changed = true; + throw exception_pappso; + } + catch(std::exception &exception_std) + { + _emit_changed = true; + throw exception_std; } _emit_changed = true; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; @@ -163,7 +187,8 @@ DecoyWidget::setProjectDecoys(Project *p_project) void DecoyWidget::doChanged() { - qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ + << _emit_changed; if(_emit_changed) emit changed(); qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; diff --git a/src/utils/fastafilestore.cpp b/src/utils/fastafilestore.cpp index 040024de0..224086760 100644 --- a/src/utils/fastafilestore.cpp +++ b/src/utils/fastafilestore.cpp @@ -73,8 +73,8 @@ FastaFileStore::getInstance(const FastaFile &location) const std::vector<FastaFileSp> & FastaFileStore::getFastaFileList() const { - qDebug() << "FastaFileStore::getFastaFileList() begin"; - qDebug() << "FastaFileStore::getFastaFileList() begin" + + qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " " << _map_fastafile.size(); return _map_fastafile; } -- GitLab