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

xic box infrastructure

parent d4397f21
No related branches found
No related tags found
No related merge requests found
...@@ -28,8 +28,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS} ${Qt5 ...@@ -28,8 +28,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS} ${Qt5
#sudo apt-get install libpappsomspp-dev #sudo apt-get install libpappsomspp-dev
#FIND_PACKAGE( Pappsomspp REQUIRED ) #FIND_PACKAGE( Pappsomspp REQUIRED )
SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp") # SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp")
# SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp") SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp")
SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src") SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src")
SET (PAPPSOMSPP_QT5_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/libpappsomspp-qt5.so") SET (PAPPSOMSPP_QT5_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/libpappsomspp-qt5.so")
SET (PAPPSOMSPP_WIDGET_QT5_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/pappsomspp/widget/libpappsomspp-widget-qt5.so") SET (PAPPSOMSPP_WIDGET_QT5_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/pappsomspp/widget/libpappsomspp-widget-qt5.so")
...@@ -158,7 +158,9 @@ SET(XTPCPP_SRCS ...@@ -158,7 +158,9 @@ SET(XTPCPP_SRCS
./gui/ptm_peptide_list_view/ptmsequencedelegate.cpp ./gui/ptm_peptide_list_view/ptmsequencedelegate.cpp
./gui/tandem_run_dialog/tandemrundialog.cpp ./gui/tandem_run_dialog/tandemrundialog.cpp
./gui/waiting_message_dialog/waitingmessagedialog.cpp ./gui/waiting_message_dialog/waitingmessagedialog.cpp
./gui/xic_view/xic_box/xicbox.cpp
./gui/xic_view/xicwindow.cpp ./gui/xic_view/xicwindow.cpp
./gui/xic_view/xicworkerthread.cpp
./gui/workerthread.cpp ./gui/workerthread.cpp
./utils/workmonitor.cpp ./utils/workmonitor.cpp
) )
...@@ -183,6 +185,7 @@ SET (GUI_UIS ...@@ -183,6 +185,7 @@ SET (GUI_UIS
./gui/ptm_peptide_list_view/ptm_peptide_list_view.ui ./gui/ptm_peptide_list_view/ptm_peptide_list_view.ui
./gui/tandem_run_dialog/tandem_run_dialog.ui ./gui/tandem_run_dialog/tandem_run_dialog.ui
./gui/waiting_message_dialog/waiting_message_dialog.ui ./gui/waiting_message_dialog/waiting_message_dialog.ui
./gui/xic_view/xic_box/xic_box.ui
./gui/xic_view/xic_window.ui ./gui/xic_view/xic_window.ui
) )
...@@ -215,7 +218,9 @@ SET(XTPCPP_MOC_HDRS ...@@ -215,7 +218,9 @@ SET(XTPCPP_MOC_HDRS
./gui/ptm_peptide_list_view/ptmsequencedelegate.h ./gui/ptm_peptide_list_view/ptmsequencedelegate.h
./gui/tandem_run_dialog/tandemrundialog.h ./gui/tandem_run_dialog/tandemrundialog.h
./gui/waiting_message_dialog/waitingmessagedialog.h ./gui/waiting_message_dialog/waitingmessagedialog.h
./gui/xic_view/xic_box/xicbox.h
./gui/xic_view/xicwindow.h ./gui/xic_view/xicwindow.h
./gui/xic_view/xicworkerthread.h
./gui/workerthread.h ./gui/workerthread.h
./utils/workmonitor.h ./utils/workmonitor.h
) )
......
...@@ -239,16 +239,6 @@ void PeptideWindow::doSpectrumSpReady(pappso::SpectrumSp spectrum_sp, QString er ...@@ -239,16 +239,6 @@ void PeptideWindow::doSpectrumSpReady(pappso::SpectrumSp spectrum_sp, QString er
ui->spectrum_widget->rescale(); ui->spectrum_widget->rescale();
_spectrum_is_ready = true; _spectrum_is_ready = true;
try {
pappso::MassRange mass_range(_p_peptide_evidence->getPeptideXtpSp().get()->getMz(_p_peptide_evidence->getCharge()), pappso::Precision::getPpmInstance(10));
pappso::XicSp xic_sp = SpectrumStore::getXicSpFromMsRunSp(_p_peptide_evidence->getMsRunP(), mass_range, XixExtactMethod::max);
}
catch (pappso::PappsoException & error) {
QMessageBox::warning(this,
tr("Error trying to save spectrum to SVG file :"), error.qwhat());
}
} }
if (!error.isEmpty()) { if (!error.isEmpty()) {
//not found //not found
......
...@@ -770,5 +770,7 @@ void ProjectWindow::openInXicViewer(const PeptideEvidence * p_peptide_evidence) ...@@ -770,5 +770,7 @@ void ProjectWindow::openInXicViewer(const PeptideEvidence * p_peptide_evidence)
} }
_p_xic_window->show(); _p_xic_window->show();
_p_xic_window->addXic(p_peptide_evidence);
qDebug() << "ProjectWindow::openInXicViewer end"; qDebug() << "ProjectWindow::openInXicViewer end";
} }
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>XicBox</class>
<widget class="QWidget" name="XicBox">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="peptide_label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="pappso::XicWidget" name="xic_widget" native="true"/>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>pappso::XicWidget</class>
<extends>QWidget</extends>
<header>pappsomspp/widget/xicwidget/xicwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
/**
* \file src/gui/xic_view/xic_box/xicbox.cpp
* \date 12/1/2018
* \author Olivier Langella
* \brief XIC box widget
*/
/*******************************************************************************
* Copyright (c) 2018 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#include "xicbox.h"
#include "ui_xic_box.h"
#include <QMessageBox>
#include <pappsomspp/pappsoexception.h>
#include "../xicworkerthread.h"
XicBox::XicBox(XicWindow *parent):
QWidget(parent),
ui(new Ui::XicBox)
{
_p_xic_window = parent;
ui->setupUi(this);
XicWorkerThread * p_worker = new XicWorkerThread();
p_worker->moveToThread(&_xic_thread);
_xic_thread.start();
#if QT_VERSION >= 0x050000
// Qt5 code
connect(this, &XicBox::loadXic, p_worker, &XicWorkerThread::doXicLoad);
connect(p_worker, &XicWorkerThread::xicLoaded,this, &XicBox::setXic);
connect(p_worker, &XicWorkerThread::operationFailed, this, &XicBox::error);
#else
// Qt4 code
#endif
}
XicBox::~XicBox()
{
qDebug() << "XicBox::~XicBox";
_xic_thread.quit();
_xic_thread.wait();
}
void XicBox::error(QString error_message) {
QMessageBox::warning(this,
tr("Error trying to save spectrum to SVG file :"), error_message);
}
void XicBox::setPeptideEvidence(const PeptideEvidence * p_peptide_evidence) {
_p_peptide_evidence = p_peptide_evidence;
ui->peptide_label->setText(_p_peptide_evidence->getPeptideXtpSp().get()->toString());
emit loadXic(_p_peptide_evidence->getMsRunP(), _p_peptide_evidence->getPeptideXtpSp().get()->getMz(_p_peptide_evidence->getCharge()), _p_xic_window->getXicExtractPrecision(), XicExtractMethod::max);
}
void XicBox::setXic(pappso::XicSp xic_sp) {
qDebug() << "XicBox::setXic begin";
qDebug() << "XicBox::setXic end";
}
/**
* \file src/gui/xic_view/xic_box/xicbox.h
* \date 12/1/2018
* \author Olivier Langella
* \brief XIC box widget
*/
/*******************************************************************************
* Copyright (c) 2018 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#ifndef XICBOX_H
#define XICBOX_H
#include <QWidget>
#include <QThread>
#include "../../../utils/types.h"
#include "../../../core/peptideevidence.h"
#include "../xicwindow.h"
#include <pappsomspp/xic/xic.h>
namespace Ui {
class XicBox;
}
class XicBox: public QWidget
{
Q_OBJECT
public:
explicit XicBox(XicWindow * parent = 0);
~XicBox();
void setPeptideEvidence(const PeptideEvidence * p_peptide_evidence) ;
signals :
void loadXic(const MsRun * p_msrun, pappso::mz mz, pappso::PrecisionP precision, XicExtractMethod method);
private slots:
void setXic(pappso::XicSp xic_sp);
void error(QString error_message);
private:
Ui::XicBox *ui;
QThread _xic_thread;
XicWindow * _p_xic_window;
const PeptideEvidence * _p_peptide_evidence;
};
#endif // XICBOX_H
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "xicwindow.h" #include "xicwindow.h"
#include "ui_xic_window.h" #include "ui_xic_window.h"
#include "../project_view/projectwindow.h" #include "../project_view/projectwindow.h"
#include "xic_box/xicbox.h"
XicWindow::XicWindow(ProjectWindow *parent): XicWindow::XicWindow(ProjectWindow *parent):
QMainWindow(parent), QMainWindow(parent),
...@@ -39,9 +39,6 @@ XicWindow::XicWindow(ProjectWindow *parent): ...@@ -39,9 +39,6 @@ XicWindow::XicWindow(ProjectWindow *parent):
_project_window = parent; _project_window = parent;
ui->setupUi(this); ui->setupUi(this);
XicWorkerThread * p_worker = new XicWorkerThread();
p_worker->moveToThread(&_xic_thread);
_xic_thread.start();
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
...@@ -58,3 +55,13 @@ XicWindow::~XicWindow() ...@@ -58,3 +55,13 @@ XicWindow::~XicWindow()
{ {
qDebug() << "XicWindow::~XicWindow"; qDebug() << "XicWindow::~XicWindow";
} }
void XicWindow::addXic(const PeptideEvidence * p_peptide_evidence) {
XicBox * p_box = new XicBox(this);
p_box->setPeptideEvidence(p_peptide_evidence);
ui->xic_vertical_layout->addWidget(p_box);
}
pappso::PrecisionP XicWindow::getXicExtractPrecision() const {
return (pappso::Precision::getPpmInstance(10));
}
...@@ -29,41 +29,38 @@ ...@@ -29,41 +29,38 @@
#ifndef XICWINDOW_H #ifndef XICWINDOW_H
#define XICWINDOW_H #define XICWINDOW_H
#include <QThread>
#include <QMainWindow> #include <QMainWindow>
class ProjectWindow; #include "../../core/peptideevidence.h"
class XicWorkerThread : public QObject
{
Q_OBJECT
public:
protected:
void closeEvent(QCloseEvent *event); class ProjectWindow;
};
namespace Ui { namespace Ui {
class XicWindow; class XicWindow;
} }
class XicBox;
class XicWindow: public QMainWindow { class XicWindow: public QMainWindow {
Q_OBJECT Q_OBJECT
friend XicBox;
public: public:
explicit XicWindow(ProjectWindow * parent = 0); explicit XicWindow(ProjectWindow * parent = 0);
~XicWindow(); ~XicWindow();
void addXic(const PeptideEvidence * p_peptide_evidence);
pappso::PrecisionP getXicExtractPrecision() const;
protected:
private: private:
ProjectWindow * _project_window; ProjectWindow * _project_window;
QThread _xic_thread;
Ui::XicWindow *ui; Ui::XicWindow *ui;
pappso::PrecisionP _xic_extract_precision;
}; };
#endif // XICWINDOW_H #endif // XICWINDOW_H
/**
* \file src/gui/xic_view/xicworkerthread.cpp
* \date 12/1/2018
* \author Olivier Langella
* \brief XIC worker
*/
/*******************************************************************************
* Copyright (c) 2018 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#include "xicworkerthread.h"
#include "../../utils/readspectrum.h"
#include <pappsomspp/pappsoexception.h>
void XicWorkerThread::doXicLoad(const MsRun * p_msrun, pappso::mz mz, pappso::PrecisionP precision, XicExtractMethod method) {
try {
pappso::MassRange mass_range(mz, precision);
pappso::XicSp xic_sp = SpectrumStore::getXicSpFromMsRunSp(p_msrun, mass_range, method);
emit xicLoaded(xic_sp);
}
catch (pappso::PappsoException & error) {
emit operationFailed(tr("Error extracting XIC :\n%1").arg(error.qwhat()));
}
}
/**
* \file src/gui/xic_view/xicworkerthread.h
* \date 12/1/2018
* \author Olivier Langella
* \brief XIC worker
*/
/*******************************************************************************
* Copyright (c) 2018 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#ifndef XICWORKERTHREAD_H
#define XICWORKERTHREAD_H
#include <pappsomspp/xic/xic.h>
#include<QObject>
#include "../../core/msrun.h"
class XicWorkerThread : public QObject
{
Q_OBJECT
public:
public slots:
void doXicLoad(const MsRun * p_msrun, pappso::mz mz, pappso::PrecisionP precision, XicExtractMethod method);
signals:
void xicLoaded(pappso::XicSp xic_sp);
void operationFailed(QString error);
};
#endif // XICWORKERTHREAD_H
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <pappsomspp/pappsoexception.h> #include <pappsomspp/pappsoexception.h>
#include "config.h" #include "config.h"
#include "gui/mainwindow.h" #include "gui/mainwindow.h"
#include "utils/types.h"
using namespace std; using namespace std;
...@@ -36,6 +37,11 @@ int main(int argc, char *argv[]) ...@@ -36,6 +37,11 @@ int main(int argc, char *argv[])
QApplication app(argc, argv); QApplication app(argc, argv);
qRegisterMetaType<TandemRunBatch>("TandemRunBatch"); qRegisterMetaType<TandemRunBatch>("TandemRunBatch");
qRegisterMetaType<pappso::mz>("pappso::mz");
qRegisterMetaType<pappso::PrecisionP>("pappso::PrecisionP");
qRegisterMetaType<pappso::XicSp>("pappso::XicSp");
qRegisterMetaType<XicExtractMethod>("XicExtractMethod");
try { try {
QCoreApplication::setOrganizationName("PAPPSO"); QCoreApplication::setOrganizationName("PAPPSO");
......
...@@ -47,7 +47,7 @@ pwiz::msdata::MSDataFile * getPwizMSDataFile(const QString & filename); ...@@ -47,7 +47,7 @@ pwiz::msdata::MSDataFile * getPwizMSDataFile(const QString & filename);
pappso::QualifiedSpectrum getQualifiedSpectrumFromPwizMSDataFile(pwiz::msdata::MSDataFile * p_ms_data_file, unsigned int scan_num); pappso::QualifiedSpectrum getQualifiedSpectrumFromPwizMSDataFile(pwiz::msdata::MSDataFile * p_ms_data_file, unsigned int scan_num);
void getXicFromPwizMSDataFile(pwiz::msdata::MSDataFile * p_mzdata, pappso::Xic * p_xic, const pappso::MassRange & mass_range, XixExtactMethod method); void getXicFromPwizMSDataFile(pwiz::msdata::MSDataFile * p_mzdata, pappso::Xic * p_xic, const pappso::MassRange & mass_range, XicExtractMethod method);
pwiz::msdata::MSDataFile * getPwizMSDataFile(const QString & filename) { pwiz::msdata::MSDataFile * getPwizMSDataFile(const QString & filename) {
...@@ -78,7 +78,7 @@ pwiz::msdata::MSDataFile * getPwizMSDataFile(const QString & filename) { ...@@ -78,7 +78,7 @@ pwiz::msdata::MSDataFile * getPwizMSDataFile(const QString & filename) {
return dataFile; return dataFile;
} }
void getXicFromPwizMSDataFile(pwiz::msdata::MSDataFile * p_ms_data_file, pappso::Xic * p_xic, const pappso::MassRange & mass_range, XixExtactMethod method) { void getXicFromPwizMSDataFile(pwiz::msdata::MSDataFile * p_ms_data_file, pappso::Xic * p_xic, const pappso::MassRange & mass_range, XicExtractMethod method) {
std::string env; std::string env;
env=setlocale(LC_ALL,""); env=setlocale(LC_ALL,"");
...@@ -110,7 +110,7 @@ void getXicFromPwizMSDataFile(pwiz::msdata::MSDataFile * p_ms_data_file, pappso: ...@@ -110,7 +110,7 @@ void getXicFromPwizMSDataFile(pwiz::msdata::MSDataFile * p_ms_data_file, pappso:
{ {
//qDebug() << "it->mz " << it->mz << " it->intensity" << it->intensity; //qDebug() << "it->mz " << it->mz << " it->intensity" << it->intensity;
if (mass_range.contains(it->mz)) { if (mass_range.contains(it->mz)) {
if (method == XixExtactMethod::max) { if (method == XicExtractMethod::max) {
if (peak.intensity < it->intensity) { if (peak.intensity < it->intensity) {
peak.intensity = it->intensity; peak.intensity = it->intensity;
} }
...@@ -380,7 +380,7 @@ pappso::SpectrumSp SpectrumStore::getSpectrumSpFromMsRunSp(MsRun * msrun, unsign ...@@ -380,7 +380,7 @@ pappso::SpectrumSp SpectrumStore::getSpectrumSpFromMsRunSp(MsRun * msrun, unsign
} }
pappso::XicSp SpectrumStore::getXicSpFromMsRunSp(const MsRun * p_msrun, const pappso::MassRange & mass_range, XixExtactMethod method) { pappso::XicSp SpectrumStore::getXicSpFromMsRunSp(const MsRun * p_msrun, const pappso::MassRange & mass_range, XicExtractMethod method) {
qDebug() << "SpectrumStore::getXicSpFromMsRunSp begin" ; qDebug() << "SpectrumStore::getXicSpFromMsRunSp begin" ;
pwiz::msdata::MSDataFile * p_msdatafile = findPwizMSDataFile(p_msrun); pwiz::msdata::MSDataFile * p_msdatafile = findPwizMSDataFile(p_msrun);
......
...@@ -43,7 +43,7 @@ class MSDataFile; ...@@ -43,7 +43,7 @@ class MSDataFile;
class SpectrumStore { class SpectrumStore {
public: public:
static pappso::SpectrumSp getSpectrumSpFromMsRunSp(MsRun * p_msrun, unsigned int scan_num); static pappso::SpectrumSp getSpectrumSpFromMsRunSp(MsRun * p_msrun, unsigned int scan_num);
static pappso::XicSp getXicSpFromMsRunSp(const MsRun * p_msrun, const pappso::MassRange & mass_range, XixExtactMethod method); static pappso::XicSp getXicSpFromMsRunSp(const MsRun * p_msrun, const pappso::MassRange & mass_range, XicExtractMethod method);
/** @brief try to find MS run statistics /** @brief try to find MS run statistics
*/ */
static void checkMsRunStatistics(MsRun *); static void checkMsRunStatistics(MsRun *);
......
...@@ -91,9 +91,9 @@ enum class MsRunStatistics: std::int8_t { ...@@ -91,9 +91,9 @@ enum class MsRunStatistics: std::int8_t {
/** \def XixExtactMethod method to extract Xic /** \def XixExtactMethod method to extract Xic
* *
*/ */
enum class XixExtactMethod { enum class XicExtractMethod: std::int8_t {
sum, ///< sum of intensities sum=1, ///< sum of intensities
max ///< maximum of intensities max=2 ///< maximum of intensities
}; };
......
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