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

check protein is OK

parent 2051e213
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,10 @@ const pappso::ProteinSp & ProteinMatch::getProteinSp() const {
void ProteinMatch::setEvalue(pappso::pappso_double evalue) {
_evalue = evalue;
}
pappso::pappso_double ProteinMatch::getEvalue() const {
return _evalue;
}
void ProteinMatch::setProteinSp(pappso::ProteinSp protein_sp) {
_protein_sp = protein_sp;
}
......
......@@ -37,6 +37,7 @@ public:
const pappso::ProteinSp & getProteinSp() const;
void setEvalue(pappso::pappso_double evalue);
pappso::pappso_double getEvalue() const;
void setProteinSp(pappso::ProteinSp protein_sp);
void addPeptideMatch(PeptideMatch * peptide_match);
std::vector<PeptideMatch *> & getPeptideMatchList();
......
......@@ -58,6 +58,8 @@ ProteinListWindow::ProteinListWindow(QWidget *parent):
_p_proxy_model->setDynamicSortFilter(true);
ui->tableView->setModel( _p_proxy_model );
ui->tableView->setSortingEnabled(true);
connect(ui->tableView, SIGNAL(clicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableClicked(const QModelIndex &)));
}
ProteinListWindow::~ProteinListWindow()
......
......@@ -34,8 +34,15 @@ ProteinTableProxyModel::ProteinTableProxyModel(QObject *parent,ProteinTableModel
bool ProteinTableProxyModel::filterAcceptsRow(int source_row,
const QModelIndex &source_parent) const {
//return _protein_table_model_p->acceptRow(source_row);
return true;
return _protein_table_model_p->acceptRow(source_row);
//return true;
}
void ProteinTableProxyModel::onTableClicked(const QModelIndex &index)
{
qDebug() << "ProteinTableProxyModel::onTableClicked begin " << index.row();
qDebug() << "ProteinTableProxyModel::onTableClicked begin " << this->mapToSource(index).row();
_protein_table_model_p->onTableClicked(this->mapToSource(index));
}
bool ProteinTableProxyModel::lessThan(const QModelIndex & left, const QModelIndex & right) const {
......@@ -44,8 +51,11 @@ bool ProteinTableProxyModel::lessThan(const QModelIndex & left, const QModelInde
if (leftData.type() == QVariant::UInt) {
return leftData.toUInt() < rightData.toUInt();
}
if (leftData.type() == QVariant::Int) {
return leftData.toInt() < rightData.toInt();
if (leftData.type() == QVariant::UInt) {
return leftData.toUInt() < rightData.toUInt();
}
if (leftData.type() == QVariant::Double) {
return leftData.toDouble() < rightData.toDouble();
}
return leftData.toString() < rightData.toString();
//if (leftData.type() == QVariant::DateTime) {
......@@ -101,7 +111,7 @@ int ProteinTableModel::rowCount(const QModelIndex &parent ) const {
return 0;
}
int ProteinTableModel::columnCount(const QModelIndex &parent ) const {
return 3;
return 4;
}
QVariant ProteinTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
......@@ -111,11 +121,13 @@ QVariant ProteinTableModel::headerData(int section, Qt::Orientation orientation,
switch (section)
{
case 0:
return QString("group");
return QString("checked");
case 1:
return QString("subgroup");
return QString("accession");
case 2:
return QString("protein description");
case 3:
return QString("Evalue");
}
}
}
......@@ -143,10 +155,7 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const {
break;
case Qt::DisplayRole:
if (col == 0) {
if (_p_identification_group != nullptr) {
return QVariant ((quint16) _p_identification_group->getProteinMatchList().at(row)->getPeptideMatchList().size());
}
return QVariant();
}
if (col == 1) {
if (_p_identification_group != nullptr) {
......@@ -158,6 +167,20 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const {
return _p_identification_group->getProteinMatchList().at(row)->getProteinSp().get()->getDescription();
}
}
if (col == 3) {
if (_p_identification_group != nullptr) {
return _p_identification_group->getProteinMatchList().at(row)->getEvalue();
}
}
if (col == 4) {
if (_p_identification_group != nullptr) {
return QVariant ((quint16) _p_identification_group->getProteinMatchList().at(row)->getPeptideMatchList().size());
}
}
return QString("Row%1, Column%2")
.arg(index.row() + 1)
.arg(index.column() +1);
......@@ -165,6 +188,21 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const {
return QVariant();
}
void ProteinTableModel::onTableClicked(const QModelIndex &index)
{
int row = index.row();
int col = index.column();
if (col == 0) //add a checkbox to cell(1,0)
{
if ( _p_identification_group->getProteinMatchList().at(row)->isChecked()) {
_p_identification_group->getProteinMatchList().at(row)->setChecked(false);
}
else {
_p_identification_group->getProteinMatchList().at(row)->setChecked(true);
}
//emit dataChanged(index, index);
}
}
bool ProteinTableModel::acceptRow(int source_row) {
if (_p_identification_group->isValid(_p_identification_group->getProteinMatchList().at(source_row))) {
......
......@@ -41,8 +41,7 @@ public:
bool lessThan(const QModelIndex & left, const QModelIndex & right) const override;
public slots:
//void setMinGravity(double minGravity);
// void setMinDensity(double minDensity);
void onTableClicked(const QModelIndex &index);
private:
double m_minGravity;
double m_minDensity;
......@@ -62,7 +61,8 @@ public:
void setIdentificationGroup(IdentificationGroup * p_identification_group);
bool acceptRow(int source_row);
public slots:
void onTableClicked(const QModelIndex &index);
private :
IdentificationGroup * _p_identification_group = nullptr;
};
......
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