Skip to content
Snippets Groups Projects
Commit ab1a7600 authored by Olivier Langella's avatar Olivier Langella
Browse files

first protein search

parent 9a5ebc02
No related branches found
No related tags found
No related merge requests found
......@@ -11,10 +11,17 @@
</rect>
</property>
<property name="windowTitle">
<string>Protein list</string>
<string>Peptide list</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="proteinLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QTableView" name="tableView"/>
</item>
......@@ -26,7 +33,7 @@
<x>0</x>
<y>0</y>
<width>826</width>
<height>19</height>
<height>31</height>
</rect>
</property>
</widget>
......
......@@ -73,6 +73,7 @@ PeptideListWindow::~PeptideListWindow()
void PeptideListWindow::setProteinMatch(Project * p_project, ProteinMatch * p_protein_match) {
_peptide_table_model_p->setProteinMatch(p_project, p_protein_match);
_p_proxy_model->setSourceModel(_peptide_table_model_p);
ui->proteinLabel->setText(p_protein_match->getProteinSp().get()->getDescription());
}
......@@ -18,6 +18,9 @@
<item>
<widget class="QTableView" name="tableView"/>
</item>
<item>
<widget class="QLineEdit" name="proteinSearchEdit"/>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
......@@ -26,7 +29,7 @@
<x>0</x>
<y>0</y>
<width>826</width>
<height>19</height>
<height>31</height>
</rect>
</property>
</widget>
......
......@@ -31,22 +31,6 @@ ProteinListWindow::ProteinListWindow(QWidget *parent):
ui(new Ui::ProteinView)
{
ui->setupUi(this);
#if QT_VERSION >= 0x050000
// Qt5 code
/*
connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater);
connect(this, &PtSpectrumViewer::operateMsDataFile, worker, &PwizLoaderThread::doMsDataFileLoad);
connect(worker, &PwizLoaderThread::msDataReady, this, &PtSpectrumViewer::handleMsDataFile);
*/
#else
// Qt4 code
/*
connect(&workerThread, SIGNAL(finished()), worker, SLOT(deleteLater()));
connect(this, SIGNAL(operateMsDataFile(QString)), worker,SLOT(doMsDataFileLoad(QString)));
connect(worker, SIGNAL(msDataReady(pwiz::msdata::MSDataFile *)), this, SLOT(handleMsDataFile(pwiz::msdata::MSDataFile *)));
*/
#endif
/*
*/
......@@ -59,7 +43,21 @@ ProteinListWindow::ProteinListWindow(QWidget *parent):
ui->tableView->setModel( _p_proxy_model );
ui->tableView->setSortingEnabled(true);
#if QT_VERSION >= 0x050000
// Qt5 code
/*
connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater);
connect(this, &PtSpectrumViewer::operateMsDataFile, worker, &PwizLoaderThread::doMsDataFileLoad);
connect(worker, &PwizLoaderThread::msDataReady, this, &PtSpectrumViewer::handleMsDataFile);
*/
#else
// Qt4 code
connect(ui->tableView, SIGNAL(clicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableClicked(const QModelIndex &)));
connect(ui->proteinSearchEdit, SIGNAL(textChanged(QString)), _protein_table_model_p, SLOT(onProteinSearchEdit(QString)));
#endif
}
void ProteinListWindow::clickOnproteinMatch(ProteinMatch * p_protein_match) {
......
......@@ -38,7 +38,6 @@ bool ProteinTableProxyModel::filterAcceptsRow(int source_row,
return _protein_table_model_p->acceptRow(source_row);
//return true;
}
void ProteinTableProxyModel::onTableClicked(const QModelIndex &index)
{
qDebug() << "ProteinTableProxyModel::onTableClicked begin " << index.row();
......@@ -94,6 +93,14 @@ ProteinTableModel::ProteinTableModel(QObject *parent, ProteinListWindow * p_prot
}
void ProteinTableModel::onProteinSearchEdit(QString protein_search_string) {
qDebug() << "ProteinTableModel::onProteinSearchEdit begin " << protein_search_string;
_protein_search_string = protein_search_string;
QModelIndex topLeft = createIndex(0,0);
QModelIndex bottomRight = createIndex(rowCount(),columnCount());
emit dataChanged(topLeft, bottomRight);
}
void ProteinTableModel::setIdentificationGroup(IdentificationGroup * p_identification_group) {
qDebug() << "ProteinTableModel::setIdentificationGroup begin " << p_identification_group->getProteinMatchList().size();
_p_identification_group = p_identification_group;
......@@ -210,7 +217,13 @@ void ProteinTableModel::onTableClicked(const QModelIndex &index)
}
bool ProteinTableModel::acceptRow(int source_row) {
if (_p_identification_group->isValid(_p_identification_group->getProteinMatchList().at(source_row))) {
ProteinMatch * protein_match = _p_identification_group->getProteinMatchList().at(source_row);
if (!_protein_search_string.isEmpty()) {
if (!protein_match->getProteinSp().get()->getDescription().contains(_protein_search_string)) {
return false;
}
}
if (_p_identification_group->isValid(protein_match)) {
return true;
}
return false;
......
......@@ -66,9 +66,11 @@ public:
public slots:
void onTableClicked(const QModelIndex &index);
void onProteinSearchEdit(QString protein_search_string);
private :
IdentificationGroup * _p_identification_group = nullptr;
ProteinListWindow * _p_protein_list_window;
QString _protein_search_string;
};
#endif // PROTEINTABLEMODEL_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment