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

windows connection OK

parent 07f36413
No related branches found
No related tags found
No related merge requests found
......@@ -102,6 +102,7 @@ std::size_t IdentificationGroup::countSubGroup()const {
void IdentificationGroup::startGrouping (const GroupingType & grouping_type) {
qDebug() << "IdentificationGroup::startGrouping begin ";
if (_p_grp_experiment != nullptr) {
delete _p_grp_experiment;
}
......@@ -116,4 +117,5 @@ void IdentificationGroup::startGrouping (const GroupingType & grouping_type) {
p_protein_match->setGroupInstance(_group_store);
}
qDebug() << "IdentificationGroup::startGrouping end ";
}
......@@ -228,7 +228,7 @@ pappso::pappso_double ProteinMatch::getEvalue(const pappso::MsRunIdSp & sp_msrun
if (p_peptide_match->getMsRunIdSp().get() == sp_msrun_id.get()) {
auto ret = map_sequence_evalue.insert(std::pair<QString, pappso::pappso_double>(sequence, evalue));
if (ret.second == false) {
if (ret.first->second < evalue) {//get best evalue for sequence
if (ret.first->second > evalue) {//get best evalue for sequence
ret.first->second = evalue;
}
}
......@@ -238,7 +238,7 @@ pappso::pappso_double ProteinMatch::getEvalue(const pappso::MsRunIdSp & sp_msrun
//overall samples
auto ret = map_sequence_evalue.insert(std::pair<QString, pappso::pappso_double>(sequence, evalue));
if (ret.second == false) {
if (ret.first->second < evalue) {//get best evalue for sequence
if (ret.first->second > evalue) {//get best evalue for sequence
ret.first->second = evalue;
}
}
......
......@@ -45,8 +45,8 @@ PeptideListWindow::PeptideListWindow(ProjectWindow *parent):
ui->tableView->setSortingEnabled(true);
//connect(ui->tableView, SIGNAL(clicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableClicked(const QModelIndex &)));
#if QT_VERSION >= 0x050000
// Qt5 code
/*
......@@ -56,7 +56,12 @@ PeptideListWindow::PeptideListWindow(ProjectWindow *parent):
*/
#else
// Qt4 code
connect (this, SIGNAL(peptideDataChanged()), _peptide_table_model_p, SLOT(onPeptideDataChanged()));
connect (_project_window, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), this,SLOT(doIdentificationGroupGrouped(IdentificationGroup *)));
connect (this, SIGNAL(peptideDataChanged()), _peptide_table_model_p, SLOT(onPeptideDataChanged()));
connect(ui->tableView, SIGNAL(clicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableClicked(const QModelIndex &)));
/*
connect(&workerThread, SIGNAL(finished()), worker, SLOT(deleteLater()));
connect(this, SIGNAL(operateMsDataFile(QString)), worker,SLOT(doMsDataFileLoad(QString)));
......@@ -79,10 +84,11 @@ PeptideListWindow::~PeptideListWindow()
void PeptideListWindow::doIdentificationGroupGrouped(IdentificationGroup * p_identification_group) {
}
void PeptideListWindow::setProteinMatch(Project * p_project, ProteinMatch * p_protein_match) {
void PeptideListWindow::setProteinMatch(IdentificationGroup * p_identification_group, ProteinMatch * p_protein_match) {
if (_p_protein_match != p_protein_match) {
_p_identification_group = p_identification_group;
_p_protein_match = p_protein_match;
_peptide_table_model_p->setProteinMatch(p_project, p_protein_match);
_peptide_table_model_p->setProteinMatch( p_protein_match);
_p_proxy_model->setSourceModel(_peptide_table_model_p);
ui->proteinLabel->setText(p_protein_match->getProteinXtpSp().get()->getDescription());
}
......
......@@ -46,7 +46,7 @@ public:
explicit PeptideListWindow(ProjectWindow * parent = 0);
~PeptideListWindow();
void setProteinMatch(Project * p_project, ProteinMatch * p_protein_match);
void setProteinMatch(IdentificationGroup * p_identification_group, ProteinMatch * p_protein_match);
void edited();
public slots:
......
......@@ -39,9 +39,8 @@ PeptideTableModel::PeptideTableModel(QObject *parent)
}
void PeptideTableModel::setProteinMatch(Project * p_project, ProteinMatch * p_protein_match) {
void PeptideTableModel::setProteinMatch(ProteinMatch * p_protein_match) {
qDebug() << "PeptideTableModel::setProteinMatch begin " ;
_p_project = p_project;
_p_protein_match = p_protein_match;
QModelIndex topLeft = createIndex(0,0);
......
......@@ -39,7 +39,7 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
void setProteinMatch(Project * p_project, ProteinMatch * p_protein_match);
void setProteinMatch(ProteinMatch * p_protein_match);
ProteinMatch * getProteinMatch();
signals:
void peptideMatchClicked(PeptideMatch * p_peptide_match);
......@@ -50,7 +50,6 @@ public slots:
void onTableClicked(const QModelIndex &index);
private :
Project * _p_project;
ProteinMatch * _p_protein_match= nullptr;
};
......
......@@ -28,6 +28,8 @@
#include "gui/protein_list_view/proteinlistwindow.h"
#include <QDebug>
#include <QApplication>
#include <QMessageBox>
#include <pappsomspp/pappsoexception.h>
ProjectWindow::ProjectWindow(MainWindow *parent):
......@@ -74,20 +76,6 @@ void ProjectWindow::connectNewProteinListWindow() {
_p_current_protein_list_window = new ProteinListWindow(this);
_protein_list_window_collection.push_back(_p_current_protein_list_window);
#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 (_p_current_protein_list_window, SIGNAL(proteinMatchDoubleClicked(ProteinMatch *)), this,SLOT(doViewProteinDetail(ProteinMatch *)));
connect (this, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), _p_current_protein_list_window,SLOT(doIdentificationGroupGrouped(IdentificationGroup *)));
#endif
qDebug() << "ProjectWindow::connectNewProteinListWindow end";
}
......@@ -97,19 +85,6 @@ void ProjectWindow::connectNewProteinDetailWindow() {
_p_current_protein_detail_window = new ProteinWindow(this);
_protein_detail_window_collection.push_back(_p_current_protein_detail_window);
#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 (_p_current_peptide_list_window, SIGNAL(proteinMatchClicked(ProteinMatch *)), this,SLOT(doViewPeptideList(ProteinMatch *)));
#endif
qDebug() << "ProjectWindow::connectNewProteinDetailWindow end";
}
......@@ -119,47 +94,62 @@ void ProjectWindow::connectNewPeptideListWindow() {
_p_current_peptide_list_window = new PeptideListWindow(this);
_peptide_list_window_collection.push_back(_p_current_peptide_list_window);
#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 (_p_current_peptide_list_window, SIGNAL(proteinMatchClicked(ProteinMatch *)), this,SLOT(doViewPeptideList(ProteinMatch *)));
//connect (_p_current_peptide_list_window, SIGNAL(identificationGroupEdited(IdentificationGroup *)), this,SLOT(doIdentificationGroupEdited(IdentificationGroup *)));
// connect (this, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), _p_current_peptide_list_window,SLOT(doIdentificationGroupGrouped(IdentificationGroup *)));
#endif
qDebug() << "ProjectWindow::connectNewPeptideListWindow end";
}
void ProjectWindow::refreshGroup(IdentificationGroup * p_ident_group) {
qDebug() << "ProjectWindow::refreshGroup begin";
vector< MsRunIdSp > ms_run_list = p_ident_group->getMsRunIdSpList();
ui->sample_number_display->setText(QString("%1").arg(ms_run_list.size()));
ui->group_number_display->setText(QString("%1").arg(p_ident_group->countGroup()));
ui->subgroup_number_display->setText(QString("%1").arg(p_ident_group->countSubGroup()));
ui->protein_number_display->setText(QString("%1").arg(p_ident_group->countGrouped()));
emit identificationGroupGrouped(p_ident_group);
if (p_ident_group == nullptr) {
qDebug() << "ProjectWindow::refreshGroup p_ident_group == nullptr";
}
else {
try {
vector< MsRunIdSp > ms_run_list = p_ident_group->getMsRunIdSpList();
ui->sample_number_display->setText(QString("%1").arg(ms_run_list.size()));
ui->group_number_display->setText(QString("%1").arg(p_ident_group->countGroup()));
ui->subgroup_number_display->setText(QString("%1").arg(p_ident_group->countSubGroup()));
ui->protein_number_display->setText(QString("%1").arg(p_ident_group->countGrouped()));
emit identificationGroupGrouped(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::refreshGroup end";
}
void ProjectWindow::doIdentificationGroupEdited(IdentificationGroup * p_ident_group) {
qDebug() << "ProjectWindow::doIdentificationGroupEdited begin";
p_ident_group->startGrouping(_project_sp.get()->getGroupingType());
refreshGroup(p_ident_group);
qDebug() << "ProjectWindow::doIdentificationGroupEdited begin " << p_ident_group;
if (p_ident_group == nullptr) {
qDebug() << "ProjectWindow::doIdentificationGroupEdited p_ident_group == nullptr";
}
else {
try {
p_ident_group->startGrouping(_project_sp.get()->getGroupingType());
}
catch (pappso::PappsoException exception_pappso) {
QMessageBox::warning(this,
tr("Error grouping project :"), exception_pappso.qwhat());
}
catch (std::exception exception_std) {
QMessageBox::warning(this,
tr("Error grouping project :"), exception_std.what());
}
refreshGroup(p_ident_group);
}
qDebug() << "ProjectWindow::doIdentificationGroupEdited end";
}
void ProjectWindow::doViewPeptideList(ProteinMatch * protein_match) {
void ProjectWindow::doViewPeptideList(IdentificationGroup * p_ident_group, ProteinMatch * protein_match) {
qDebug() << "ProjectWindow::doViewPeptideList begin";
......@@ -172,7 +162,7 @@ void ProjectWindow::doViewPeptideList(ProteinMatch * protein_match) {
}
_p_current_peptide_list_window->setProteinMatch(_project_sp.get(), protein_match);
_p_current_peptide_list_window->setProteinMatch(p_ident_group, protein_match);
_p_current_peptide_list_window->show();
qDebug() << "ProjectWindow::doViewPeptideList end";
}
......
......@@ -58,7 +58,7 @@ signals:
//void peptideChanged(pappso::PeptideSp peptide);
protected :
void doViewPeptideList(ProteinMatch * protein_match);
void doViewPeptideList(IdentificationGroup * p_ident_group, ProteinMatch * protein_match);
void doViewProteinDetail(ProteinMatch * protein_match);
void doViewPeptideDetail(PeptideMatch * peptide_match);
void doIdentificationGroupEdited(IdentificationGroup * p_identification_group);
......
......@@ -72,6 +72,8 @@ ProteinListWindow::ProteinListWindow(ProjectWindow *parent):
*/
#else
// Qt4 code
connect (_project_window, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), this,SLOT(doIdentificationGroupGrouped(IdentificationGroup *)));
connect (this, SIGNAL(proteinDataChanged()), _protein_table_model_p, SLOT(onProteinDataChanged()));
connect(ui->tableView, SIGNAL(clicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableClicked(const QModelIndex &)));
//connect(ui->tableView, SIGNAL(doubleClicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableDoubleClicked(const QModelIndex &)));
......@@ -106,7 +108,7 @@ void ProteinListWindow::showAccessionColumn(bool show) {
void ProteinListWindow::askPeptideListView(ProteinMatch * p_protein_match) {
qDebug() << "ProteinListWindow::askPeptideListView begin";
_project_window->doViewPeptideList(p_protein_match);
_project_window->doViewPeptideList(_p_identification_group, p_protein_match);
qDebug() << "ProteinListWindow::askPeptideListView end";
//updateStatusBar();
}
......
......@@ -32,6 +32,7 @@ ProteinWindow::ProteinWindow(ProjectWindow *parent):
QMainWindow(parent),
ui(new Ui::ProteinDetailView)
{
_p_project_window = parent;
ui->setupUi(this);
/*
*/
......@@ -46,6 +47,8 @@ ProteinWindow::ProteinWindow(ProjectWindow *parent):
*/
#else
// Qt4 code
connect (_p_project_window, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), this,SLOT(doIdentificationGroupGrouped(IdentificationGroup *)));
//connect(_protein_table_model_p, SIGNAL(layoutChanged()), this, SLOT(updateStatusBar()));
#endif
}
......@@ -54,16 +57,19 @@ ProteinWindow::~ProteinWindow()
{
delete ui;
}
void ProteinWindow::doIdentificationGroupGrouped(IdentificationGroup * p_identification_group) {
updateDisplay();
}
void ProteinWindow::setProteinMatch(ProteinMatch * p_protein_match) {
void ProteinWindow::updateDisplay() {
try {
ui->descriptionLabel->setText(p_protein_match->getProteinXtpSp().get()->getAccession());
//ui->sequenceLabel->setText(p_protein_match->getProteinXtpSp().get()->getSequence());
ui->sequenceTextEdit->setText(p_protein_match->getHtmlSequence());
ui->coverage_label->setText(QString("%1 %").arg(p_protein_match->getCoverage()*100));
pappso::Peptide peptide(p_protein_match->getProteinXtpSp().get()->getSequence());
ui->descriptionLabel->setText(_p_protein_match->getProteinXtpSp().get()->getAccession());
//ui->sequenceLabel->setText(_p_protein_match->getProteinXtpSp().get()->getSequence());
ui->sequenceTextEdit->setText(_p_protein_match->getHtmlSequence());
ui->coverage_label->setText(QString("%1 %").arg(_p_protein_match->getCoverage()*100));
pappso::Peptide peptide(_p_protein_match->getProteinXtpSp().get()->getSequence());
ui->mw_label->setText(QString("%1 kDa").arg(peptide.getMass()/1000));
ui->evalue_label->setText(QString("%1 (log10: %2)").arg(p_protein_match->getEvalue()).arg(std::log10(p_protein_match->getEvalue())));
ui->evalue_label->setText(QString("%1 (log10: %2)").arg(_p_protein_match->getEvalue()).arg(std::log10(_p_protein_match->getEvalue())));
}
catch (pappso::PappsoException exception_pappso) {
QMessageBox::warning(this,
......@@ -73,4 +79,10 @@ void ProteinWindow::setProteinMatch(ProteinMatch * p_protein_match) {
QMessageBox::warning(this,
tr("Unable to display protein details :"), exception_std.what());
}
}
void ProteinWindow::setProteinMatch(ProteinMatch * p_protein_match) {
_p_protein_match = p_protein_match;
updateDisplay();
}
......@@ -42,9 +42,18 @@ public:
explicit ProteinWindow(ProjectWindow * parent = 0);
~ProteinWindow();
void setProteinMatch(ProteinMatch * p_protein_match);
public slots:
void doIdentificationGroupGrouped(IdentificationGroup * p_identification_group);
protected :
void updateDisplay();
private:
Ui::ProteinDetailView *ui;
QTextDocument sequence_text;
ProjectWindow * _p_project_window;
ProteinMatch * _p_protein_match = 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