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

load spectrum in a separate thread

parent a5357f06
No related branches found
No related tags found
No related merge requests found
......@@ -28,15 +28,30 @@
#include <pappsomspp/spectrum/qualifiedspectrum.h>
#include <QMessageBox>
#include <QSettings>
#include <QDebug>
void SpectrumSpLoaderThread::doLoadSpectrumSp (PeptideMatch * p_peptide_match) {
qDebug() << "SpectrumSpLoaderThread::doLoadSpectrumSp begin";
pappso::SpectrumSp spectrum = p_peptide_match->getIdentificationDataSource()->getSpectrumSp(p_peptide_match->getScan());
emit spectrumSpReady(spectrum, QString(""));
qDebug() << "SpectrumSpLoaderThread::doLoadSpectrumSp end";
}
PeptideWindow::PeptideWindow(ProjectWindow *parent):
QMainWindow(parent),
ui(new Ui::PeptideDetailView)
{
qDebug() << "PeptideWindow::PeptideWindow begin";
_p_project_window = parent;
ui->setupUi(this);
/*
*/
SpectrumSpLoaderThread * worker = new SpectrumSpLoaderThread;
worker->moveToThread(&_spectrum_loader_thread);
_spectrum_loader_thread.start();
QSettings settings;
QString unit = settings.value("peptideview/precision_unit", "dalton").toString();
......@@ -47,7 +62,8 @@ PeptideWindow::PeptideWindow(ProjectWindow *parent):
} else {
_p_precision = Precision::getPpmInstance(precision);
}
qRegisterMetaType<pappso::SpectrumSp>("pappso::SpectrumSp");
#if QT_VERSION >= 0x050000
// Qt5 code
/*
......@@ -59,8 +75,13 @@ PeptideWindow::PeptideWindow(ProjectWindow *parent):
// Qt4 code
connect (_p_project_window, SIGNAL(identificationGroupGrouped(IdentificationGroup *)), this,SLOT(doIdentificationGroupGrouped(IdentificationGroup *)));
connect (this, SIGNAL(loadSpectrumSp(PeptideMatch *)), worker,SLOT(doLoadSpectrumSp(PeptideMatch *)));
connect (worker, SIGNAL(spectrumSpReady(pappso::SpectrumSp, QString)), this,SLOT(doSpectrumSpReady(pappso::SpectrumSp, QString)));
//connect(_protein_table_model_p, SIGNAL(layoutChanged()), this, SLOT(updateStatusBar()));
#endif
qDebug() << "PeptideWindow::PeptideWindow end";
}
PeptideWindow::~PeptideWindow()
......@@ -80,8 +101,8 @@ void PeptideWindow::updateDisplay() {
ui->z_label->setText(QString("%1").arg(_p_peptide_match->getCharge()));
ui->scan_label->setText(QString("%1").arg(_p_peptide_match->getScan()));
ui->modification_label->setText(_p_peptide_match->getPeptideXtpSp().get()->getModifString());
}
catch (pappso::PappsoException exception_pappso) {
QMessageBox::warning(this,
......@@ -94,17 +115,29 @@ void PeptideWindow::updateDisplay() {
}
void PeptideWindow::setPeptideMatch(PeptideMatch * p_peptide_match) {
_p_peptide_match = p_peptide_match;
SpectrumSp spectrum = _p_peptide_match->getIdentificationDataSource()->getSpectrumSp(_p_peptide_match->getScan());
void PeptideWindow::doSpectrumSpReady(SpectrumSp spectrum_sp, QString error) {
qDebug() << "PeptideWindow::doSpectrumSpReady begin";
pappso::QualifiedSpectrum spectrum_copy;
spectrum_copy.setPrecursorCharge(_p_peptide_match->getCharge());
spectrum_copy.setOriginalSpectrumSp(spectrum);
spectrum_copy.setOriginalSpectrumSp(spectrum_sp);
ui->spectrumWidget->setQualifiedSpectrum(spectrum_copy);
qDebug() << "PeptideWindow::doSpectrumSpReady end";
}
pappso::PeptideSp peptide = p_peptide_match->getPeptideXtpSp();
void PeptideWindow::setPeptideMatch(PeptideMatch * p_peptide_match) {
qDebug() << "PeptideWindow::setPeptideMatch begin";
_p_peptide_match = p_peptide_match;
qDebug() << "PeptideWindow::setPeptideMatch emit loadSpectrumSp(_p_peptide_match)";
emit loadSpectrumSp(_p_peptide_match);
pappso::PeptideSp peptide = _p_peptide_match->getPeptideXtpSp();
ui->spectrumWidget->setPrecision(_p_precision);
ui->spectrumWidget->setPeptideSp(peptide);
ui->spectrumWidget->setQualifiedSpectrum(spectrum_copy);
updateDisplay();
qDebug() << "PeptideWindow::setPeptideMatch end";
}
......@@ -25,7 +25,9 @@
#include <QMainWindow>
#include <QTextDocument>
#include <QThread>
#include <pappsomspp/mass_range.h>
#include <pappsomspp/spectrum/spectrum.h>
#include "../../core/peptidematch.h"
#include "../../core/identificationgroup.h"
......@@ -35,6 +37,26 @@ namespace Ui {
class PeptideDetailView;
}
class SpectrumSpLoaderThread : public QObject
{
Q_OBJECT
public:
public slots:
void doLoadSpectrumSp(PeptideMatch * p_peptide_match);
signals:
void spectrumSpReady(pappso::SpectrumSp spectrum_sp, QString error);
protected:
void closeEvent(QCloseEvent *event);
};
class PeptideWindow: public QMainWindow {
Q_OBJECT
......@@ -47,10 +69,18 @@ public:
public slots:
void doIdentificationGroupGrouped(IdentificationGroup * p_identification_group);
signals:
void loadSpectrumSp(PeptideMatch * p_peptide_match);
protected slots:
void doSpectrumSpReady(pappso::SpectrumSp spectrum_sp, QString error);
protected :
void updateDisplay();
private:
QThread _spectrum_loader_thread;
Ui::PeptideDetailView *ui;
ProjectWindow * _p_project_window;
PeptideMatch * _p_peptide_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