diff --git a/src/gui/peptide_list_view/peptide_view.ui b/src/gui/peptide_list_view/peptide_view.ui index 78c200c54a7df9743cb0d712fee9977bc107a053..3f1cf3ad707674b6de9e8bb0d9cd1c0249f29f23 100644 --- a/src/gui/peptide_list_view/peptide_view.ui +++ b/src/gui/peptide_list_view/peptide_view.ui @@ -86,6 +86,11 @@ <string>peptide</string> </property> </item> + <item> + <property name="text"> + <string>modifications</string> + </property> + </item> <item> <property name="text"> <string>msrun/scan</string> @@ -101,6 +106,9 @@ <item> <widget class="QLineEdit" name="peptide_search_edit"/> </item> + <item> + <widget class="QLineEdit" name="mod_auto_completion"/> + </item> <item> <widget class="QLineEdit" name="msrun_auto_completion"/> </item> @@ -241,6 +249,22 @@ </hint> </hints> </connection> + <connection> + <sender>mod_auto_completion</sender> + <signal>textChanged(QString)</signal> + <receiver>PeptideView</receiver> + <slot>doModificationSearch(QString)</slot> + <hints> + <hint type="sourcelabel"> + <x>436</x> + <y>360</y> + </hint> + <hint type="destinationlabel"> + <x>699</x> + <y>506</y> + </hint> + </hints> + </connection> </connections> <slots> <slot>doNotValidHide(bool)</slot> @@ -250,5 +274,6 @@ <slot>doSearchOn(QString)</slot> <slot>doMsrunFileSearch(QString)</slot> <slot>doScanNumberSearch(int)</slot> + <slot>doModificationSearch(QString)</slot> </slots> </ui> diff --git a/src/gui/peptide_list_view/peptidelistwindow.cpp b/src/gui/peptide_list_view/peptidelistwindow.cpp index 7538ed8f9deb7b5a5d628ecbdf21ac0c8d871522..058c4b2dbaee42cd710b768eb31eb98f32214450 100644 --- a/src/gui/peptide_list_view/peptidelistwindow.cpp +++ b/src/gui/peptide_list_view/peptidelistwindow.cpp @@ -103,6 +103,7 @@ PeptideListWindow::PeptideListWindow(ProjectWindow *parent): ui->scan_number_edit->setVisible(false); ui->msrun_auto_completion->setVisible(false); + ui->mod_auto_completion->setVisible(false); ui->peptide_search_edit->setVisible(true); #if QT_VERSION >= 0x050000 @@ -172,6 +173,19 @@ void PeptideListWindow::setProteinMatch(IdentificationGroup * p_identification_g completer->setFilterMode(Qt::MatchContains); ui->msrun_auto_completion->setCompleter(completer); + QStringList mod_list; + for (pappso::AaModificationP mod :_project_window->getProjectP()->getPeptideStore().getModificationCollection()) { + mod_list << QString("[%1] %2 %3").arg(mod->getAccession()).arg(mod->getName()).arg(mod->getMass()); + //qDebug() << "ProteinListWindow::setIdentificationGroup " << msrun_sp.get()->getFilename(); + } + completer = new QCompleter(mod_list, this); + completer->setCaseSensitivity(Qt::CaseInsensitive); + + completer->setCompletionMode(QCompleter::PopupCompletion); + completer->setModelSorting(QCompleter::CaseSensitivelySortedModel); + completer->setFilterMode(Qt::MatchContains); + ui->mod_auto_completion->setCompleter(completer); + } } @@ -227,6 +241,10 @@ void PeptideListWindow::doPeptideSearchEdit(QString protein_search_string) { emit peptideDataChanged(); } +void PeptideListWindow::doModificationSearch(QString mod_search) { + //_p_proxy_model->setMsrunFileSearch(msr_run_file_search); + emit peptideDataChanged(); +} void PeptideListWindow::doMsrunFileSearch(QString msr_run_file_search) { qDebug() << "PeptideListWindow::doMsrunFileSearch begin " << msr_run_file_search; emit peptideDataChanged(); @@ -239,17 +257,22 @@ void PeptideListWindow::doSearchOn(QString search_on) { qDebug() << "PeptideListWindow::doSearchOn begin " << search_on; _p_proxy_model->setSearchOn( search_on); + ui->scan_number_edit->setVisible(false); + ui->msrun_auto_completion->setVisible(false); + ui->peptide_search_edit->setVisible(false); + ui->mod_auto_completion->setVisible(false); if (search_on == "msrun/scan" ) { qDebug() << "PeptideListWindow::doSearchOn visible " << search_on; ui->scan_number_edit->setVisible(true); ui->msrun_auto_completion->setVisible(true); - ui->peptide_search_edit->setVisible(false); + } else if (search_on == "modifications" ) { + + qDebug() << "PeptideListWindow::doSearchOn visible " << search_on; + ui->mod_auto_completion->setVisible(true); } else { qDebug() << "PeptideListWindow::doSearchOn hidden " << search_on; - ui->scan_number_edit->setVisible(false); - ui->msrun_auto_completion->setVisible(false); ui->peptide_search_edit->setVisible(true); } //emit proteinDataChanged(); diff --git a/src/gui/peptide_list_view/peptidelistwindow.h b/src/gui/peptide_list_view/peptidelistwindow.h index 8b8e62fc09cd5a672d393f072c67a9d535e5bc3e..7188d3ebebf7cc3b2b94222316e5f4c4aad4412f 100644 --- a/src/gui/peptide_list_view/peptidelistwindow.h +++ b/src/gui/peptide_list_view/peptidelistwindow.h @@ -95,6 +95,7 @@ protected slots: void doNotGroupedHide(bool hide); void doPeptideSearchEdit(QString peptide_search_string); void doMsrunFileSearch(QString msr_run_file_search); + void doModificationSearch(QString mod_search); void doScanNumberSearch(int scan_num); void doSearchOn(QString search_on); void updateStatusBar(); diff --git a/src/gui/peptide_list_view/peptidetableproxymodel.cpp b/src/gui/peptide_list_view/peptidetableproxymodel.cpp index 20f2bc363a024e1aac9be39c55305e884d9077a0..dacab94c4833093d493877d7c86e46e9ab3c9b73 100644 --- a/src/gui/peptide_list_view/peptidetableproxymodel.cpp +++ b/src/gui/peptide_list_view/peptidetableproxymodel.cpp @@ -56,6 +56,27 @@ bool PeptideTableProxyModel::filterAcceptsRow(int source_row, PeptideEvidence * peptide_evidence = _peptide_table_model_p->getProteinMatch()->getPeptideMatchList().at(source_row).getPeptideEvidence(); qDebug() << "PeptideTableProxyModel::filterAcceptsRow protein_match " << source_row; + qDebug() << "PeptideTableProxyModel::filterAcceptsRow valid "; + if (_hide_not_valid) { + if (! peptide_evidence->isValid()) { + return false; + } + } + qDebug() << "PeptideTableProxyModel::filterAcceptsRow checked "; + if (_hide_not_checked) { + if (! peptide_evidence->isChecked()) { + return false; + } + } + + qDebug() << "PeptideTableProxyModel::filterAcceptsRow grouped "; + if (_hide_not_grouped) { + if (! peptide_evidence->isGrouped()) { + return false; + } + + } + if (_search_on == "msrun/scan") { unsigned int scan_num = this->_p_peptide_list_window->ui->scan_number_edit->value(); QString file_search_string = this->_p_peptide_list_window->ui->msrun_auto_completion->text().toLower(); @@ -102,25 +123,24 @@ bool PeptideTableProxyModel::filterAcceptsRow(int source_row, } } - qDebug() << "PeptideTableProxyModel::filterAcceptsRow valid "; - if (_hide_not_valid) { - if (! peptide_evidence->isValid()) { - return false; - } - } - qDebug() << "PeptideTableProxyModel::filterAcceptsRow checked "; - if (_hide_not_checked) { - if (! peptide_evidence->isChecked()) { - return false; - } - } - qDebug() << "PeptideTableProxyModel::filterAcceptsRow grouped "; - if (_hide_not_grouped) { - if (! peptide_evidence->isGrouped()) { - return false; - } + if (_search_on == "modifications") { + QString mod_search_string = this->_p_peptide_list_window->ui->mod_auto_completion->text(); + std::vector<pappso::AaModificationP> mod_list; + for (pappso::AaModificationP mod :_p_peptide_list_window->getProjectWindow()->getProjectP()->getPeptideStore().getModificationCollection()) { + if (QString("[%1] %2 %3").arg(mod->getAccession()).arg(mod->getName()).arg(mod->getMass()).contains(mod_search_string)) { + mod_list.push_back(mod); + } + //qDebug() << "ProteinListWindow::setIdentificationGroup " << msrun_sp.get()->getFilename(); + } + //qDebug() << "ProteinTableProxyModel::filterAcceptsRow msrun/scan " << file_search_string << " " << scan_num; + for (pappso::AaModificationP mod :mod_list) { + if (peptide_evidence->getPeptideXtpSp().get()->getNumberOfModification(mod) > 0) { + return true; + } + } + return false; } return true; } diff --git a/src/gui/protein_list_view/proteintableproxymodel.cpp b/src/gui/protein_list_view/proteintableproxymodel.cpp index f6c227895af42a10071e72668889757200653b6c..507b9f220827c3bf4627acf62b229095f7e0ff4e 100644 --- a/src/gui/protein_list_view/proteintableproxymodel.cpp +++ b/src/gui/protein_list_view/proteintableproxymodel.cpp @@ -146,7 +146,6 @@ bool ProteinTableProxyModel::filterAcceptsRow(int source_row, if (_search_on == "modifications") { - unsigned int scan_num = this->_p_protein_list_window->ui->scan_number_edit->value(); QString mod_search_string = this->_p_protein_list_window->ui->mod_auto_completion->text(); std::vector<pappso::AaModificationP> mod_list;