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

system to display only present columns

parent 6b256679
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,7 @@ PeptideTableModel::setProteinMatch(ProteinMatch *p_protein_match)
// QModelIndex topLeft = createIndex(0,0);
// QModelIndex bottomRight = createIndex(rowCount(),columnCount());
std::set<PeptideListColumn> engine_columns;
_engine_columns_to_display.clear();
bool first = true;
for(auto &&peptide_match : _p_protein_match->getPeptideMatchList())
{
......@@ -65,11 +65,15 @@ PeptideTableModel::setProteinMatch(ProteinMatch *p_protein_match)
PeptideEvidenceParam::peptide_prophet_probability);
if(!var.isNull())
{
_engine_columns_to_display.insert(
PeptideListColumn::peptide_prophet_probability);
}
var = peptide_match.getPeptideEvidence()->getParam(
PeptideEvidenceParam::peptide_inter_prophet_probability);
if(!var.isNull())
{
_engine_columns_to_display.insert(
PeptideListColumn::peptide_inter_prophet_probability);
}
first = false;
}
......@@ -77,17 +81,24 @@ PeptideTableModel::setProteinMatch(ProteinMatch *p_protein_match)
peptide_match.getPeptideEvidence()->getIdentificationEngine();
if(engine == IdentificationEngine::XTandem)
{
engine_columns.insert(PeptideListColumn::tandem_hyperscore);
_engine_columns_to_display.insert(
PeptideListColumn::tandem_hyperscore);
}
else if(engine == IdentificationEngine::mascot)
{
engine_columns.insert(PeptideListColumn::mascot_score);
_engine_columns_to_display.insert(PeptideListColumn::mascot_score);
_engine_columns_to_display.insert(
PeptideListColumn::mascot_expectation_value);
}
}
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
<< _engine_columns_to_display.size();
_p_peptide_list_window->resizeColumnsToContents();
// emit dataChanged(topLeft, topLeft);
// emit headerDataChanged(Qt::Horizontal, 0,3);
// emit headerDataChanged(Qt::Horizontal, 0,33);
emit layoutAboutToBeChanged();
emit layoutChanged();
qDebug() << "PeptideTableModel::setProteinMatch end ";
}
......@@ -407,7 +418,7 @@ PeptideTableModel::getTitle(PeptideListColumn column)
const QString
PeptideTableModel::getDescription(PeptideListColumn column)
{
qDebug() << "PeptideTableModel::columnCount begin ";
// qDebug() << "PeptideTableModel::columnCount begin ";
return PeptideTableModel::getDescription((std::int8_t)column);
// qDebug() << "ProteinTableModel::columnCount end ";
}
......@@ -416,7 +427,7 @@ const QString
PeptideTableModel::getTitle(std::int8_t column)
{
qDebug() << "PeptideTableModel::getTitle begin " << column;
// qDebug() << "PeptideTableModel::getTitle begin " << column;
switch(column)
{
......@@ -586,7 +597,7 @@ PeptideTableModel::getDescription(std::int8_t column)
int
PeptideTableModel::getColumnWidth(int column)
{
qDebug() << "PeptideTableModel::getColumnWidth " << column;
// qDebug() << "PeptideTableModel::getColumnWidth " << column;
switch(column)
{
......@@ -605,3 +616,21 @@ PeptideTableModel::getColumnWidth(int column)
}
return 100;
}
bool
PeptideTableModel::hasColumn(PeptideListColumn column)
{
if((std::int8_t)column < 21)
{
return true;
}
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
<< _engine_columns_to_display.size();
if(_engine_columns_to_display.find(column) !=
_engine_columns_to_display.end())
{
return true;
}
return false;
}
......@@ -87,6 +87,7 @@ class PeptideTableModel : public QAbstractTableModel
static const QString getTitle(PeptideListColumn column);
static const QString getDescription(PeptideListColumn column);
static PeptideListColumn getPeptideListColumn(std::int8_t column);
bool hasColumn(PeptideListColumn column);
void setProteinMatch(ProteinMatch *p_protein_match);
ProteinMatch *getProteinMatch();
......@@ -104,6 +105,8 @@ class PeptideTableModel : public QAbstractTableModel
private:
ProteinMatch *_p_protein_match = nullptr;
PeptideListWindow *_p_peptide_list_window = nullptr;
//contains columns to display (present in this peptide match)
std::set<PeptideListColumn> _engine_columns_to_display;
};
#endif // PEPTIDETABLEMODEL_H
......@@ -65,18 +65,23 @@ bool
PeptideTableProxyModel::filterAcceptsColumn(
int source_column, const QModelIndex &source_parent) const
{
if(_peptide_table_model_p->getPeptideListColumn(source_column) ==
PeptideListColumn::label)
if(_column_display[source_column])
{
if(_p_peptide_list_window->getProjectWindow()
->getProjectP()
->getLabelingMethodSp()
.get() == nullptr)
PeptideListColumn peptide_column =
_peptide_table_model_p->getPeptideListColumn(source_column);
if(peptide_column == PeptideListColumn::label)
{
return false;
if(_p_peptide_list_window->getProjectWindow()
->getProjectP()
->getLabelingMethodSp()
.get() == nullptr)
{
return false;
}
}
return _peptide_table_model_p->hasColumn(peptide_column);
}
return _column_display[source_column];
return false;
}
bool
......
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