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

first PTM island table !

parent b7342213
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,9 @@ IdentificationGroup::~IdentificationGroup()
}
}
const PtmGroupingExperiment * IdentificationGroup::getPtmGroupingExperiment() const {
return _p_grp_ptm_experiment;
}
const GroupStore & IdentificationGroup::getGroupStore() const {
return _group_store;
}
......
......@@ -50,6 +50,8 @@ public:
void addProteinMatch(ProteinMatch * protein_match);
std::vector<ProteinMatch *> & getProteinMatchList();
void addIdentificationDataSourceP(IdentificationDataSource * p_identification_source);
const PtmGroupingExperiment * getPtmGroupingExperiment() const;
/** @brief count groups
* */
......
......@@ -72,7 +72,7 @@ PtmGroupingExperiment::~PtmGroupingExperiment()
}
const std::vector<PtmIslandSp> & PtmGroupingExperiment::getPtmIslandList() {
const std::vector<PtmIslandSp> & PtmGroupingExperiment::getPtmIslandList() const {
return _ptm_island_list;
}
......
......@@ -46,7 +46,7 @@ public:
void addProteinMatch(const ProteinMatch* p_protein_match);
void startGrouping();
const std::vector<PtmIslandSp> & getPtmIslandList();
const std::vector<PtmIslandSp> & getPtmIslandList() const;
private:
std::vector<unsigned int> getPtmPositions(const ProteinMatch * protein_match) const;
......
......@@ -107,6 +107,12 @@ void ProjectWindow::setDefaultProteinListWindow(ProteinListWindow* p_protein_lis
qDebug() << "ProjectWindow::setDefaultProteinListWindow end";
}
void ProjectWindow::connectNewPtmIslandListWindow() {
qDebug() << "ProjectWindow::connectNewPtmIslandListWindow begin";
_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";
}
void ProjectWindow::connectNewProteinListWindow() {
qDebug() << "ProjectWindow::connectNewProteinListWindow begin";
_p_current_protein_list_window = new ProteinListWindow(this);
......@@ -141,6 +147,27 @@ void ProjectWindow::connectNewPeptideListWindow() {
qDebug() << "ProjectWindow::connectNewPeptideListWindow end";
}
void ProjectWindow::refreshPtmGroup(IdentificationGroup * p_ident_group) {
qDebug() << "ProjectWindow::refreshPtmGroup begin";
hideWaitingMessage();
if (p_ident_group == nullptr) {
qDebug() << "ProjectWindow::refreshPtmGroup p_ident_group == nullptr";
}
else {
try {
emit identificationPtmGroupGrouped(p_ident_group);
}
catch (pappso::PappsoException exception_pappso) {
QMessageBox::warning(this,
tr("Unable to display project :"), exception_pappso.qwhat());
}
catch (std::exception exception_std) {
QMessageBox::warning(this,
tr("Unable to display project :"), exception_std.what());
}
}
qDebug() << "ProjectWindow::refreshPtmGroup end";
}
void ProjectWindow::refreshGroup(IdentificationGroup * p_ident_group) {
qDebug() << "ProjectWindow::refreshGroup begin";
hideWaitingMessage();
......@@ -281,7 +308,7 @@ void ProjectWindow::doGroupingFinished() {
}
refresh();
qDebug() << "ProjectWindow::doGroupingFinished end";
}
......@@ -358,23 +385,29 @@ void ProjectWindow::doViewPtmIslandList(IdentificationGroup* p_identification_gr
qDebug() << "ProjectWindow::doViewPtmIslandList begin " << p_identification_group;
//if (p_identification_group == nullptr) {
//}
if (_protein_list_window_collection.size() == 0) {
connectNewProteinListWindow();
if (_ptm_island_list_window_collection.size() == 0) {
connectNewPtmIslandListWindow();
}
Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers();
if (modifier == Qt::ControlModifier) {
connectNewProteinListWindow();
connectNewPtmIslandListWindow();
}
_p_current_protein_list_window->show();
_p_current_ptm_island_list_window->show();
//_p_current_protein_list_window->raise();
//_p_current_protein_list_window->activateWindow();
qDebug() << "ProjectWindow::doViewPtmIslandList end " << p_identification_group;
_p_current_protein_list_window->setIdentificationGroup(p_identification_group);
_p_current_ptm_island_list_window->setIdentificationGroup(p_identification_group);
emit identificationGroupGrouped(p_identification_group);
if (p_identification_group->getPtmGroupingExperiment() == nullptr) {
showWaitingMessage(tr("Computing PTM islands"));
emit operatePtmGroupingOnIdentification(p_identification_group);
}
//emit identificationGroupGrouped(p_identification_group);
qDebug() << "ProjectWindow::doViewPtmIslandList end";
}
......@@ -420,6 +453,12 @@ void ProjectWindow::setProjectSp(ProjectSp project_sp) {
item->setData(QVariant(QString("%1").arg(fasta_file.get()->getAbsoluteFilePath())),Qt::UserRole);
}
for (auto && p_window :_ptm_island_list_window_collection) {
delete p_window;
}
_ptm_island_list_window_collection.clear();
_p_current_ptm_island_list_window = nullptr;
for (auto && p_window :_peptide_list_window_collection) {
delete p_window;
......@@ -450,8 +489,8 @@ void ProjectWindow::setProjectSp(ProjectSp project_sp) {
}
std::vector<IdentificationGroup *> identification_list = _project_sp.get()->getIdentificationGroupList();
doViewProteinList(identification_list[0]);
qDebug() << " ProjectWindow::setProjectSp size=" << identification_list.size();
if (identification_list.size() == 1) {
......@@ -485,8 +524,8 @@ void ProjectWindow::setProjectSp(ProjectSp project_sp) {
refresh();
this->setEnabled(true);
}
......
......@@ -32,6 +32,7 @@
#include "../edit_modifications/editmodifications.h"
#include "../protein_list_view/proteinlistwindow.h"
#include "../peptide_list_view/peptidelistwindow.h"
#include "../ptm_island_list_view/ptmislandlistwindow.h"
#include "../protein_view/proteinwindow.h"
#include "../peptide_detail_view/peptidewindow.h"
#include "gui/project_view/automatic_filter_widget/automaticfilterwidget.h"
......@@ -70,13 +71,16 @@ public slots:
void doGroupingFinished();
void doDisplayLoadingMessage(QString message);
void refreshGroup(IdentificationGroup * p_ident_group);
void refreshPtmGroup(IdentificationGroup * p_ident_group);
void doAcceptedLabelingMethod();
// void setColor(const QColor &color);
// void setShape(Shape shape);
signals:
void identificationGroupGrouped(IdentificationGroup * p_identification_group);
void identificationPtmGroupGrouped(IdentificationGroup * p_identification_group);
void peptideMatchSelected(PeptideMatch * peptide_match);
void operateGrouping(ProjectSp project_sp);
void operatePtmGroupingOnIdentification(IdentificationGroup * p_identification_group);
void operateGroupingOnIdentification(IdentificationGroup * p_identification_group, GroupingType grouping_type);
//void peptideChanged(pappso::PeptideSp peptide);
......@@ -89,6 +93,7 @@ protected :
void computeMassPrecision();
private :
void connectNewPtmIslandListWindow();
void connectNewProteinListWindow();
void connectNewPeptideListWindow();
void connectNewProteinDetailWindow();
......@@ -113,6 +118,8 @@ private:
ProteinWindow * _p_current_protein_detail_window = nullptr;
std::list <PeptideWindow *> _peptide_detail_window_collection;
PeptideWindow * _p_current_peptide_detail_window = nullptr;
std::list <PtmIslandListWindow *> _ptm_island_list_window_collection;
PtmIslandListWindow * _p_current_ptm_island_list_window = nullptr;
EditModifications * _p_edit_modifications = nullptr;
EditLabelMethods * _p_edit_label_methods = nullptr;
......
......@@ -63,6 +63,10 @@ PtmIslandListWindow::PtmIslandListWindow(ProjectWindow *parent):
*/
#else
// Qt4 code
connect (this, SIGNAL(ptmIslandDataChanged()), _ptm_table_model_p, SLOT(onPtmIslandDataChanged()));
connect (_project_window, SIGNAL(identificationPtmGroupGrouped(IdentificationGroup *)), this,SLOT(doIdentificationPtmGroupGrouped(IdentificationGroup *)));
#endif
}
......@@ -72,4 +76,31 @@ PtmIslandListWindow::~PtmIslandListWindow()
}
void PtmIslandListWindow::setIdentificationGroup(IdentificationGroup * p_identification_group) {
qDebug() << "PtmIslandListWindow::setIdentificationGroup begin " ;
if (p_identification_group != nullptr) {
qDebug() << "PtmIslandListWindow::setIdentificationGroup not null";
_p_identification_group = p_identification_group;
_ptm_table_model_p->setIdentificationGroup(p_identification_group);
//_p_proxy_model->setSourceModel(_protein_table_model_p);
}
else {
qDebug() << "PtmIslandListWindow::setIdentificationGroup null";
}
qDebug() << "PtmIslandListWindow::setIdentificationGroup end";
}
void PtmIslandListWindow::doIdentificationPtmGroupGrouped(IdentificationGroup * p_identification_group) {
qDebug() << "PtmIslandListWindow::doIdentificationPtmGroupGrouped begin";
if (_p_identification_group == p_identification_group) {
//_protein_table_model_p->setIdentificationGroup(p_identification_group);
//_p_proxy_model->setSourceModel(_protein_table_model_p);
emit ptmIslandDataChanged();
}
qDebug() << "PtmIslandListWindow::doIdentificationPtmGroupGrouped end";
}
......@@ -50,6 +50,11 @@ public:
void setIdentificationGroup(IdentificationGroup * p_identification_group);
public slots:
void doIdentificationPtmGroupGrouped(IdentificationGroup * p_identification_group);
signals:
void ptmIslandDataChanged();
private:
IdentificationGroup * _p_identification_group=nullptr;
......
......@@ -39,35 +39,39 @@ PtmIslandTableModel::~PtmIslandTableModel()
{
}
void PtmIslandTableModel::setPtmGroupingExperiment(PtmGroupingExperiment * p_grp_ptm_experiment) {
qDebug() << "PtmIslandTableModel::setPtmGroupingExperiment begin ";
void PtmIslandTableModel::setIdentificationGroup(IdentificationGroup * p_identification_group) {
qDebug() << "PtmIslandTableModel::setIdentificationGroup begin ";
beginResetModel();
_p_grp_ptm_experiment = p_grp_ptm_experiment;
_p_identification_group = p_identification_group;
//emit headerDataChanged(Qt::Horizontal, 0,11);
//refresh();
qDebug() << "PtmIslandTableModel::setPtmGroupingExperiment end ";
qDebug() << "PtmIslandTableModel::setIdentificationGroup end ";
endResetModel();
}
const PtmGroupingExperiment * PtmIslandTableModel::getPtmGroupingExperiment() const {
if (_p_identification_group == nullptr) {return nullptr;
}
return _p_identification_group->getPtmGroupingExperiment();
}
int PtmIslandTableModel::rowCount(const QModelIndex &parent ) const {
//qDebug() << "ProteinTableModel::rowCount begin ";
if (_p_grp_ptm_experiment != nullptr) {
if (getPtmGroupingExperiment() != nullptr) {
//qDebug() << "ProteinTableModel::rowCount(const QModelIndex &parent ) " << _p_identification_group->getProteinMatchList().size();
return (int) _p_grp_ptm_experiment->getPtmIslandList().size();
return (int) getPtmGroupingExperiment()->getPtmIslandList().size();
}
return 0;
}
int PtmIslandTableModel::columnCount(const QModelIndex &parent ) const {
//qDebug() << "ProteinTableModel::columnCount begin ";
if (_p_grp_ptm_experiment != nullptr) {
if (getPtmGroupingExperiment() != nullptr) {
return 3;
}
return 0;
}
QVariant PtmIslandTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (_p_grp_ptm_experiment == nullptr) return QVariant();
if (getPtmGroupingExperiment() == nullptr) return QVariant();
if (orientation == Qt::Horizontal)
{
}
......@@ -75,8 +79,29 @@ QVariant PtmIslandTableModel::headerData(int section, Qt::Orientation orientatio
}
QVariant PtmIslandTableModel::data(const QModelIndex &index, int role ) const {
// generate a log message when this method gets called
if (_p_grp_ptm_experiment == nullptr) return QVariant();
if (getPtmGroupingExperiment() == nullptr) return QVariant();
int row = index.row();
int col = index.column();
switch(role) {
case Qt::DisplayRole:
if (_p_identification_group == nullptr) {
return QVariant();
}
switch (col) {
case 0:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getGroupingId());
break;
case 1:
return QVariant(getPtmGroupingExperiment()->getPtmIslandList().at(row).get()->getProteinMatch()->getProteinXtpSp().get()->getAccession());
break;
}
}
return QVariant();
}
void PtmIslandTableModel::onPtmIslandDataChanged() {
qDebug() << "PtmIslandTableModel::onPtmIslandDataChanged begin " << rowCount();
emit layoutAboutToBeChanged();
emit layoutChanged();
}
\ No newline at end of file
......@@ -31,6 +31,7 @@
#define PTMISLANDTABLEMODEL_H
#include <QAbstractTableModel>
#include "../../core/identificationgroup.h"
#include "../../grouping/ptm/ptmgroupingexperiment.h"
class PtmIslandListWindow;
......@@ -42,14 +43,18 @@ public:
~PtmIslandTableModel();
void setPtmGroupingExperiment(PtmGroupingExperiment * p_grp_ptm_experiment);
void setIdentificationGroup(IdentificationGroup * p_identification_group);
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
public slots:
void onPtmIslandDataChanged();
private :
PtmGroupingExperiment * _p_grp_ptm_experiment=nullptr;
const PtmGroupingExperiment * getPtmGroupingExperiment() const;
private :
IdentificationGroup * _p_identification_group=nullptr;
};
#endif // PTMISLANDTABLEMODEL_H
......@@ -91,7 +91,12 @@ WorkerThread::WorkerThread(ProjectWindow * p_project_window)
//grouping
connect(p_project_window, SIGNAL(operateGrouping(ProjectSp)), this,SLOT(doGrouping(ProjectSp)));
connect(this, SIGNAL(groupingFinished()), p_project_window,SLOT(doGroupingFinished()));
//PTM grouping on IdentificationGroup
connect(p_project_window, SIGNAL(operatePtmGroupingOnIdentification(IdentificationGroup *)), this,SLOT(doPtmGroupingOnIdentification(IdentificationGroup *)));
connect(this, SIGNAL(ptmGroupingOnIdentificationFinished(IdentificationGroup *)), p_project_window,SLOT(refreshPtmGroup(IdentificationGroup *)));
//grouping on IdentificationGroup
connect(p_project_window, SIGNAL(operateGroupingOnIdentification(IdentificationGroup *, GroupingType)), this,SLOT(doGroupingOnIdentification(IdentificationGroup *, GroupingType)));
connect(this, SIGNAL(groupingOnIdentificationFinished(IdentificationGroup *)), p_project_window,SLOT(refreshGroup(IdentificationGroup *)));
......@@ -128,6 +133,28 @@ void WorkerThread::doXpipFileLoad(QString filename) {
qDebug() << "WorkerThread::doXpipFileLoad end";
}
void WorkerThread::doPtmGroupingOnIdentification(IdentificationGroup * p_identification_group) {
qDebug() << "WorkerThread::doPtmGroupingOnIdentification begin ";
try {
emit loadingMessage(tr("computing PTM islands"));
try {
p_identification_group->startPtmGrouping();
}
catch (pappso::PappsoException exception_pappso) {
emit operationFailed(tr("Error computing PTM islands : %1").arg(exception_pappso.qwhat()));
}
catch (std::exception exception_std) {
emit operationFailed(tr("Error computing PTM islands : %1").arg(exception_std.what()));
}
emit loadingMessage(tr("computing PTM islands finished"));
emit ptmGroupingOnIdentificationFinished(p_identification_group);
}
catch (pappso::PappsoException & error) {
emit operationFailed(tr("Error while computing PTM islands :\n%1").arg(error.qwhat()));
}
qDebug() << "WorkerThread::doPtmGroupingOnIdentification end ";
}
void WorkerThread::doGroupingOnIdentification(IdentificationGroup * p_identification_group, GroupingType grouping_type) {
qDebug() << "WorkerThread::doGroupingOnIdentification begin ";
......
......@@ -61,6 +61,7 @@ public slots:
void doWritingProticFile(QString filename, ProjectSp project_sp);
void doGrouping(ProjectSp project_sp);
void doGroupingOnIdentification(IdentificationGroup * p_identification_group, GroupingType grouping_type);
void doPtmGroupingOnIdentification(IdentificationGroup * p_identification_group);
signals:
......@@ -69,6 +70,7 @@ signals:
void projectNotReady(QString error);
void groupingFinished();
void groupingOnIdentificationFinished(IdentificationGroup * p_identification_group);
void ptmGroupingOnIdentificationFinished(IdentificationGroup * p_identification_group);
void operationFinished();
void operationFailed(QString error);
};
......
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