Commit 6a84b4da authored by Langella Olivier's avatar Langella Olivier
Browse files

get rid of obiwarp code, untested

parent f3298947
...@@ -84,9 +84,7 @@ set(MASSCHROQ_LIB_SRCS ...@@ -84,9 +84,7 @@ set(MASSCHROQ_LIB_SRCS
./lib/mass_chroq.cpp ./lib/mass_chroq.cpp
./lib/alignments/alignment_base.cpp ./lib/alignments/alignment_base.cpp
./lib/alignments/alignment_obiwarp.cpp
./lib/alignments/alignment_ms2.cpp ./lib/alignments/alignment_ms2.cpp
./lib/alignments/lmatreader.cpp
./lib/alignments/monitors/monitor_alignment_base.cpp ./lib/alignments/monitors/monitor_alignment_base.cpp
./lib/alignments/monitors/monitor_alignment_time.cpp ./lib/alignments/monitors/monitor_alignment_time.cpp
...@@ -116,7 +114,6 @@ set(SAXLIB_SRCS ...@@ -116,7 +114,6 @@ set(SAXLIB_SRCS
# ./saxparsers/mzxmlSimpleParser.cpp # ./saxparsers/mzxmlSimpleParser.cpp
# ./saxparsers/mzmlSimpleParser.cpp # ./saxparsers/mzmlSimpleParser.cpp
# ./saxparsers/xmlParserFactory.cpp # ./saxparsers/xmlParserFactory.cpp
./saxparsers/xmlToLmatParser.cpp
# ./saxparsers/mzxmlToLmatParser.cpp # ./saxparsers/mzxmlToLmatParser.cpp
# ./saxparsers/mzmlToLmatParser.cpp # ./saxparsers/mzmlToLmatParser.cpp
./saxparsers/masschroqmlParser.cpp ./saxparsers/masschroqmlParser.cpp
...@@ -124,12 +121,6 @@ set(SAXLIB_SRCS ...@@ -124,12 +121,6 @@ set(SAXLIB_SRCS
./pepfileparser/pepParser.cpp ./pepfileparser/pepParser.cpp
) )
set(OBIWARP_SRCS
./libobiwarp/lmat.cpp
./libobiwarp/vec.cpp
./libobiwarp/mat.cpp
./libobiwarp/dynprog.cpp
)
set(GUI_SRCS set(GUI_SRCS
./gui/mcqgui/guiworkerthread.cpp ./gui/mcqgui/guiworkerthread.cpp
...@@ -159,7 +150,6 @@ set(STUDIO_SRCS ...@@ -159,7 +150,6 @@ set(STUDIO_SRCS
./gui/quantificationwidget/plot.cpp ./gui/quantificationwidget/plot.cpp
./gui/alignementwidget/plot_aligned.cpp ./gui/alignementwidget/plot_aligned.cpp
./gui/alignementwidget/alignment_widget.cpp ./gui/alignementwidget/alignment_widget.cpp
./gui/alignementwidget/obiwarp_alignment_widget.cpp
./gui/alignementwidget/ms2_alignment_widget.cpp ./gui/alignementwidget/ms2_alignment_widget.cpp
./gui/thread/mcqThread.cpp ./gui/thread/mcqThread.cpp
./gui/thread/msrunLoaderThread.cpp ./gui/thread/msrunLoaderThread.cpp
......
/*
* obiwarp_alignment_widget.cpp
*
* Created on: 31 juil. 2012
* Author: valot
*/
#include "obiwarp_alignment_widget.h"
#include "../engine/masschroq_gui_engin.h"
#include <QDoubleSpinBox>
#include <QFileDialog>
#include <QFormLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QMessageBox>
#include <QPushButton>
#include <pappsomspp/msfile/msfileaccessor.h>
ObiwarpAlignmentWidget::ObiwarpAlignmentWidget(QWidget *parent)
: AlignmentWidget(parent),
LMAT_PRECISION_WINDOW(1),
MZ_START(500),
MZ_STOP(1200)
{
// kill including widget
setAttribute(Qt::WA_DeleteOnClose);
_mainLayout = new QVBoxLayout;
this->addSelectionGroup();
this->addParameterGroup();
this->addAlignButton();
this->setLayout(_mainLayout);
this->initializeObiwarpMethod();
}
ObiwarpAlignmentWidget::~ObiwarpAlignmentWidget()
{
qDebug() << "Delete Obiwarp widget";
this->deleteLoadingThread();
delete(_alignmentBase);
delete(_monitor);
}
void
ObiwarpAlignmentWidget::addSelectionGroup()
{
QGroupBox *_selection_group = new QGroupBox("MsRun selection");
QVBoxLayout *groupLayout = new QVBoxLayout;
_text_edit_ref = new QLineEdit("No MsRun Ref Selected");
_text_edit_ref->setReadOnly(true);
groupLayout->addWidget(_text_edit_ref);
QHBoxLayout *layout = new QHBoxLayout;
_loadingMsrunRefLabel = new RunningQLabel(this);
layout->addWidget(_loadingMsrunRefLabel, 2);
QPushButton *extractButton1 = new QPushButton(tr("&Load"));
extractButton1->setDefault(true);
layout->addWidget(extractButton1, 0);
groupLayout->addLayout(layout);
_text_edit_toAligned = new QLineEdit("No MsRun to Aligned Selected");
_text_edit_toAligned->setReadOnly(true);
groupLayout->addWidget(_text_edit_toAligned);
QHBoxLayout *layout2 = new QHBoxLayout;
_loadingMsruntoALignedLabel = new RunningQLabel(this);
layout2->addWidget(_loadingMsruntoALignedLabel, 2);
QPushButton *extractButton2 = new QPushButton(tr("&Load"));
extractButton2->setDefault(true);
layout2->addWidget(extractButton2, 0);
groupLayout->addLayout(layout2);
_selection_group->setLayout(groupLayout);
_mainLayout->addWidget(_selection_group);
#if QT_VERSION >= 0x050000
// Qt5 code
connect(extractButton1,
&QPushButton::clicked,
this,
&ObiwarpAlignmentWidget::startLoadindMsrunRef);
connect(extractButton2,
&QPushButton::clicked,
this,
&ObiwarpAlignmentWidget::startLoadindMsrunAligned);
#else
// Qt4 code
connect(
extractButton1, SIGNAL(clicked()), this, SLOT(startLoadindMsrunRef()));
connect(
extractButton2, SIGNAL(clicked()), this, SLOT(startLoadindMsrunAligned()));
#endif
}
void
ObiwarpAlignmentWidget::addParameterGroup()
{
QGroupBox *_parameter_group = new QGroupBox("Obiwarp Parameters");
QFormLayout *layout = new QFormLayout;
QDoubleSpinBox *lmat_box = new QDoubleSpinBox;
lmat_box->setMaximum(20);
lmat_box->setWrapping(true);
lmat_box->setSingleStep(1);
lmat_box->setDecimals(0);
lmat_box->setValue(LMAT_PRECISION_WINDOW);
layout->addRow(tr("Lmat precision window (Th)"), lmat_box);
QDoubleSpinBox *mz_start_box = new QDoubleSpinBox;
mz_start_box->setMaximum(10000);
mz_start_box->setWrapping(true);
mz_start_box->setSingleStep(1);
mz_start_box->setDecimals(2);
mz_start_box->setValue(MZ_START);
layout->addRow(tr("m/z Start"), mz_start_box);
QDoubleSpinBox *mz_stop_box = new QDoubleSpinBox;
mz_stop_box->setMaximum(10000);
mz_stop_box->setWrapping(true);
mz_stop_box->setSingleStep(1);
mz_stop_box->setDecimals(2);
mz_stop_box->setValue(MZ_STOP);
layout->addRow(tr("m/z stop"), mz_stop_box);
_parameter_group->setLayout(layout);
_mainLayout->addWidget(_parameter_group);
#if QT_VERSION >= 0x050000
// Qt5 code
connect(lmat_box,
static_cast<void (QDoubleSpinBox::*)(double)>(
&QDoubleSpinBox::valueChanged),
this,
&ObiwarpAlignmentWidget::setLmatPrecision);
connect(mz_start_box,
static_cast<void (QDoubleSpinBox::*)(double)>(
&QDoubleSpinBox::valueChanged),
this,
&ObiwarpAlignmentWidget::setMzStart);
connect(mz_stop_box,
static_cast<void (QDoubleSpinBox::*)(double)>(
&QDoubleSpinBox::valueChanged),
this,
&ObiwarpAlignmentWidget::setMzStop);
#else
// Qt4 code
connect(lmat_box,
SIGNAL(valueChanged(double)),
this,
SLOT(setLmatPrecision(double)));
connect(
mz_start_box, SIGNAL(valueChanged(double)), this, SLOT(setMzStart(double)));
connect(
mz_stop_box, SIGNAL(valueChanged(double)), this, SLOT(setMzStop(double)));
#endif
}
void
ObiwarpAlignmentWidget::addAlignButton()
{
QHBoxLayout *layout = new QHBoxLayout;
_runningQLabel = new RunningQLabel(this);
layout->addWidget(_runningQLabel, 2);
QPushButton *extractButton = new QPushButton(tr("&Align"));
extractButton->setDefault(true);
layout->addWidget(extractButton, 0);
_mainLayout->addLayout(layout);
#if QT_VERSION >= 0x050000
// Qt5 code
connect(extractButton,
&QPushButton::clicked,
this,
&ObiwarpAlignmentWidget::startAlignment);
#else
// Qt4 code
connect(extractButton, SIGNAL(clicked()), this, SLOT(startAlignment()));
#endif
}
void
ObiwarpAlignmentWidget::initializeObiwarpMethod()
{
_monitor = new MonitorAlignmentBase();
_alignmentBase = new AlignmentObiwarp(_monitor);
AlignmentObiwarp *align((AlignmentObiwarp *)_alignmentBase);
align->setLmatPrecision(LMAT_PRECISION_WINDOW);
align->setMassStart(MZ_START);
align->setMassEnd(MZ_STOP);
_msunToAligned = 0;
_msrunRef = 0;
}
void
ObiwarpAlignmentWidget::startLoadindMsrunRef()
{
if(this->isAlignmentRunning())
return;
QString filename = this->getMsrunFilename();
if(filename.isEmpty())
return;
pappso::MsFileAccessor file_access(filename, QString("msfile"));
pappso::MsRunReaderSPtr run_reader =
file_access.getMsRunReaderSPtrByRunId("", "msrun");
MsrunSp msrun =
std::make_shared<Msrun>(Msrun(run_reader.get()->getMsRunId()));
// MasschroqGuiEngin::getInstance()->setCurrentMsrunRef(msrun);
this->triggerLoadingMsRunRef(msrun);
}
void
ObiwarpAlignmentWidget::startLoadindMsrunAligned()
{
if(this->isAlignmentRunning())
return;
QString filename = this->getMsrunFilename();
if(filename.isEmpty())
return;
pappso::MsFileAccessor file_access(filename, QString("msfile"));
pappso::MsRunReaderSPtr run_reader =
file_access.getMsRunReaderSPtrByRunId("", "msrun_to_align");
MsrunSp msrun =
std::make_shared<Msrun>(Msrun(run_reader.get()->getMsRunId()));
// MasschroqGuiEngin::getInstance()->setCurrentMsrunToAlign(msrun);
triggerLoadingMsRunToAlign(msrun);
}
QString
ObiwarpAlignmentWidget::getMsrunFilename()
{
QString filename =
QFileDialog::getOpenFileName(this,
tr("Open Msrun File"),
QString::null,
tr("mzXML or mzML files (*.mzXML *.mzML)"));
if(!filename.isEmpty())
{
QFileInfo filenameInfo(filename);
if(!filenameInfo.exists())
{
this->viewError(
tr("The chosen MS run file '%1', does not exist..\nPlease, change "
"the read permissions on this file or load another one. ")
.arg(filename));
return ("");
}
else if(!filenameInfo.isReadable())
{
this->viewError(
tr("The chosen MS run file '%1', is not readable.\nPlease, change "
"the read permissions on this file or load another one. ")
.arg(filename));
return ("");
}
}
return (filename);
}
void
ObiwarpAlignmentWidget::setLmatPrecision(double precision)
{
AlignmentObiwarp *align((AlignmentObiwarp *)_alignmentBase);
align->setLmatPrecision(precision);
}
void
ObiwarpAlignmentWidget::setMzStart(double mz)
{
AlignmentObiwarp *align((AlignmentObiwarp *)_alignmentBase);
align->setMassStart(mz);
}
void
ObiwarpAlignmentWidget::completDataToMsrun(MsrunSp msrun [[maybe_unused]])
{
qDebug() << "Complete data to Msrun";
}
void
ObiwarpAlignmentWidget::emitSignalDoneAlignement()
{
emit newAlignmentCurve();
emit finishAlignment(_msunToAligned);
}
void
ObiwarpAlignmentWidget::setMzStop(double mz)
{
AlignmentObiwarp *align((AlignmentObiwarp *)_alignmentBase);
align->setMassEnd(mz);
}
void
ObiwarpAlignmentWidget::writeElement(MasschroqDomDocument *domDocument) const
{
AlignmentObiwarp *align((AlignmentObiwarp *)_alignmentBase);
domDocument->addObiwarpMethod(*align);
}
/*
* obiwarp_alignment_widget.h
*
* Created on: 31 juil. 2012
* Author: valot
*/
#pragma once
#include "../../lib/alignments/alignment_obiwarp.h"
#include "alignment_widget.h"
#include <QLineEdit>
#include <QVBoxLayout>
#include <QWidget>
class ObiwarpAlignmentWidget : public AlignmentWidget
{
Q_OBJECT
public:
ObiwarpAlignmentWidget(QWidget *parent = 0);
virtual ~ObiwarpAlignmentWidget();
void writeElement(MasschroqDomDocument *domDocument) const;
private slots:
void setLmatPrecision(double precision);
void setMzStart(double mz);
void setMzStop(double mz);
void startLoadindMsrunRef();
void startLoadindMsrunAligned();
protected:
virtual void completDataToMsrun(MsrunSp msrun) override;
virtual void emitSignalDoneAlignement() override;
private:
void initializeObiwarpMethod();
void addSelectionGroup();
void addParameterGroup();
void addAlignButton();
QString getMsrunFilename();
QVBoxLayout *_mainLayout;
QLineEdit *_text_edit_ref;
QLineEdit *_text_edit_toAligned;
const mcq_double LMAT_PRECISION_WINDOW;
const mcq_double MZ_START;
const mcq_double MZ_STOP;
};
...@@ -212,35 +212,6 @@ MasschroqDomDocument::newAlignementMethod() ...@@ -212,35 +212,6 @@ MasschroqDomDocument::newAlignementMethod()
_dom.appendChild(_alignmethod); _dom.appendChild(_alignmethod);
} }
void
MasschroqDomDocument::addObiwarpMethod(const AlignmentObiwarp &align)
{
if(_alignmethod.isNull())
{
throw mcqError("alignment_method element have not been initialised");
return;
}
if(_alignmethod.childNodes().size() > 0)
{
throw mcqError("alignment_method element is not empty");
return;
}
QDomElement obiwarp = _dom.createElement("obiwarp");
_alignmethod.appendChild(obiwarp);
QDomElement lmat_precision = _dom.createElement("lmat_precision");
lmat_precision.appendChild(
_dom.createTextNode(QString::number(align.getLmatPrecision(), 'f', 1)));
obiwarp.appendChild(lmat_precision);
QDomElement mz_start = _dom.createElement("mz_start");
mz_start.appendChild(
_dom.createTextNode(QString::number(align.getMassStart(), 'f', 2)));
obiwarp.appendChild(mz_start);
QDomElement mz_stop = _dom.createElement("mz_stop");
mz_stop.appendChild(
_dom.createTextNode(QString::number(align.getMassEnd(), 'f', 2)));
obiwarp.appendChild(mz_stop);
}
void void
MasschroqDomDocument::addMs2AlignmentMethod(const AlignmentMs2 &align) MasschroqDomDocument::addMs2AlignmentMethod(const AlignmentMs2 &align)
{ {
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#pragma once #pragma once
#include "../../lib/alignments/alignment_ms2.h" #include "../../lib/alignments/alignment_ms2.h"
#include "../../lib/alignments/alignment_obiwarp.h"
#include <QDomDocument> #include <QDomDocument>
#include <QDomElement> #include <QDomElement>
#include <pappsomspp/processing/detection/tracedetectionzivy.h> #include <pappsomspp/processing/detection/tracedetectionzivy.h>
...@@ -30,7 +29,6 @@ class MasschroqDomDocument ...@@ -30,7 +29,6 @@ class MasschroqDomDocument
bool verifyQuantificationMethod(); bool verifyQuantificationMethod();
void newAlignementMethod(); void newAlignementMethod();
void addObiwarpMethod(const AlignmentObiwarp &align);
void addMs2AlignmentMethod(const AlignmentMs2 &align); void addMs2AlignmentMethod(const AlignmentMs2 &align);
QString getXMLString() const; QString getXMLString() const;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "../lib/consoleout.h" #include "../lib/consoleout.h"
#include "../mcqsession.h" #include "../mcqsession.h"
#include "alignementwidget/ms2_alignment_widget.h" #include "alignementwidget/ms2_alignment_widget.h"
#include "alignementwidget/obiwarp_alignment_widget.h"
#include "dom_methods/masschroqDomDocument.h" #include "dom_methods/masschroqDomDocument.h"
#include "engine/masschroq_gui_engin.h" #include "engine/masschroq_gui_engin.h"
#include "logQIODevice.h" #include "logQIODevice.h"
...@@ -280,10 +279,6 @@ ParameterMainWindow::LoadAlignmentWorkspace() ...@@ -280,10 +279,6 @@ ParameterMainWindow::LoadAlignmentWorkspace()
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
// Qt5 code // Qt5 code
connect(obiwarpAct,
&QAction::triggered,
this,
&ParameterMainWindow::obiwarpAlignmentWidget);
connect(ms2Act, connect(ms2Act,
&QAction::triggered, &QAction::triggered,
this, this,
...@@ -521,11 +516,11 @@ ParameterMainWindow::filterBackgroundWidget() ...@@ -521,11 +516,11 @@ ParameterMainWindow::filterBackgroundWidget()
void void
ParameterMainWindow::filterSpikeWidget() ParameterMainWindow::filterSpikeWidget()
{ {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " ";
TreatmentBoxXicFilter *treat = TreatmentBoxXicFilter *treat =
MasschroqGuiEngin::getInstance()->getChain().addNewTreatmentBoxXicFilter(); MasschroqGuiEngin::getInstance()->getChain().addNewTreatmentBoxXicFilter();
FilterSpikeWidget *spikeFilter = new FilterSpikeWidget(treat, dockwidget); FilterSpikeWidget *spikeFilter = new FilterSpikeWidget(treat, dockwidget);
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " ";
vbox->removeItem(vbox->itemAt(vbox->count() - 1)); vbox->removeItem(vbox->itemAt(vbox->count() - 1));
vbox->addWidget(spikeFilter); vbox->addWidget(spikeFilter);
vbox->addStretch(0); vbox->addStretch(0);
...@@ -585,38 +580,6 @@ ParameterMainWindow::detectionZivyWidget() ...@@ -585,38 +580,6 @@ ParameterMainWindow::detectionZivyWidget()
#endif #endif
} }
void
ParameterMainWindow::obiwarpAlignmentWidget()
{
qDebug() << "New Obiwarp widget" << endl;
this->resetDockTools();
ObiwarpAlignmentWidget *obiwarp = new ObiwarpAlignmentWidget(dockwidget);
vbox->addWidget(obiwarp);
vbox->addStretch(1);
#if QT_VERSION >= 0x050000
// Qt5 code
connect(obiwarp,
&ObiwarpAlignmentWidget::newAlignmentCurve,
_plot_area_aligned,
&PlotAligned::clearPlot);
connect(obiwarp,
&ObiwarpAlignmentWidget::finishAlignment,
_plot_area_aligned,
&PlotAligned::viewAlignedMsRun);
#else
// Qt4 code
connect(obiwarp,
SIGNAL(newAlignmentCurve()),
_plot_area_aligned,
SLOT(clearPlot()));
connect(obiwarp,
SIGNAL(finishAlignment(const Msrun *)),
_plot_area_aligned,
SLOT(viewAlignedMsRun(const Msrun *)));
#endif
}
void void
ParameterMainWindow::ms2AlignmentWidget() ParameterMainWindow::ms2AlignmentWidget()
{ {
......
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
* \author Edlira Nano * \author Edlira Nano
*/ */
#ifndef PARAMETERMAINWINDOW_H_ #pragma once
#define PARAMETERMAINWINDOW_H_ 1
#include <QMainWindow> #include <QMainWindow>
#include <QTextEdit> #include <QTextEdit>
...@@ -50,7 +49,6 @@ class ParameterMainWindow : public QMainWindow ...@@ -50,7 +49,6 @@ class ParameterMainWindow : public QMainWindow
void filterBackgroundWidget(); void filterBackgroundWidget();
void filterSpikeWidget(); void filterSpikeWidget();
void detectionZivyWidget();