Commit a2105f39 authored by Filippo Rusconi's avatar Filippo Rusconi
Browse files

Merge branch 'master' of forgemia.inra.fr:pappso/xtpcpp

parents 48acef3f d1359d35
find_path(Alglib_INCLUDE_DIR alglibinternal.h
PATHS /usr/local/include/libalglib /usr/include/libalglib)
find_library(Alglib_LIBRARY NAMES alglib
HINTS /usr/lib /usr/local/lib)
if(Alglib_INCLUDE_DIR AND Alglib_LIBRARY)
mark_as_advanced(Alglib_INCLUDE_DIR)
mark_as_advanced(Alglib_LIBRARY)
set(Alglib_FOUND TRUE)
endif()
if(Alglib_FOUND)
if(NOT Alglib_FIND_QUIETLY)
message(STATUS "Found Alglib_LIBRARY: ${Alglib_LIBRARY}")
endif()
if(NOT TARGET Alglib::Alglib)
add_library(Alglib::Alglib UNKNOWN IMPORTED)
set_target_properties(Alglib::Alglib PROPERTIES
IMPORTED_LOCATION "${Alglib_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Alglib_INCLUDE_DIR}")
endif()
else()
if(Alglib_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libalglib. Please do specify the
Alglib_INCLUDE_DIR and Alglib_LIBRARY variables using cmake!")
endif()
endif()
# Copyright : ETH Zurich
# License : three-clause BSD license
# Authors : Witold Wolski
# for full text refer to files: LICENSE, AUTHORS and COPYRIGHT
#FIND_PATH(Pwiz_INCLUDE_DIR pwiz/Version.hpp)
FIND_PATH( Pwiz_INCLUDE_DIR pwiz/Version.hpp
PATHS /usr/local/include /usr/include
PATH_SUFFIXES proteowizard pwiz libpwiz ENV PATH)
FIND_LIBRARY(Pwiz_LIBRARY NAMES pwiz)
IF (Pwiz_INCLUDE_DIR AND Pwiz_LIBRARY)
MESSAGE(STATUS "XXXXXXXXXXXXX ${Pwiz_LIBRARY} XXXXXXXXXXXXXXX")
SET(Pwiz_FOUND TRUE)
ENDIF (Pwiz_INCLUDE_DIR AND Pwiz_LIBRARY)
IF (Pwiz_FOUND)
# show which CppUnit was found only if not quiet
IF (NOT Pwiz_FIND_QUIETLY)
MESSAGE(STATUS "Found Pwiz: ${Pwiz_LIBRARY}")
ENDIF (NOT Pwiz_FIND_QUIETLY)
if(NOT TARGET Pwiz::Pwiz)
add_library(Pwiz::Pwiz UNKNOWN IMPORTED)
set_target_properties(Pwiz::Pwiz PROPERTIES
IMPORTED_LOCATION "${Pwiz_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Pwiz_INCLUDE_DIR}")
endif()
ELSE (Pwiz_FOUND)
# fatal error if CppUnit is required but not found
IF (Pwiz_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Pwiz please do specify the Pwiz_INCLUDE_DIR and the Pwiz_LIBRARY variables using ccmake!")
ENDIF (Pwiz_FIND_REQUIRED)
ENDIF (Pwiz_FOUND)
find_path(Zstd_INCLUDE_DIRS zstd.h
PATHS /usr/local/include /usr/include)
find_library(Zstd_LIBRARY NAMES zstd
HINTS /usr/lib /usr/local/lib)
if(Zstd_INCLUDE_DIRS AND Zstd_LIBRARY)
mark_as_advanced(Zstd_INCLUDE_DIRS)
mark_as_advanced(Zstd_LIBRARY)
set(Zstd_FOUND TRUE)
endif()
if(Zstd_FOUND)
if(NOT Zstd_FIND_QUIETLY)
message(STATUS "Found Zstd_LIBRARY: ${Zstd_LIBRARY}")
endif()
if(NOT TARGET Zstd::Zstd)
add_library(Zstd::Zstd UNKNOWN IMPORTED)
set_target_properties(Zstd::Zstd PROPERTIES
IMPORTED_LOCATION "${Zstd_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${Zstd_INCLUDE_DIRS}")
endif()
else()
if(Zstd_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libzstd. Please do specify the
Zstd_INCLUDE_DIRS and Zstd_LIBRARY variables using cmake!")
endif()
endif()
......@@ -20,11 +20,4 @@ endif (NOT PappsoMSpp_FOUND)
set(Alglib_DIR ${CMAKE_MODULE_PATH})
find_package(Alglib REQUIRED)
find_package( ZLIB REQUIRED )
set(Zstd_DIR ${CMAKE_MODULE_PATH})
find_package(Zstd REQUIRED)
......@@ -10,8 +10,6 @@ Build-Depends: debhelper-compat (= 12),
libpappsomspp-dev (>= 0.8.11),
libpappsomspp-widget-dev (>= 0.8.11),
libodsstream-dev,
libalglib-dev,
libzstd-dev (>= 1.3.3),
libqt5svg5-dev,
libqcustomplot-dev,
docbook-to-man,
......
......@@ -10,8 +10,6 @@ Build-Depends: debhelper-compat (= 12),
libpappsomspp-dev (>= @LIBPAPPSOMSPP_VERSION@),
libpappsomspp-widget-dev (>= @LIBPAPPSOMSPP_VERSION@),
libodsstream-dev,
libalglib-dev,
libzstd-dev (>= 1.3.3),
libqt5svg5-dev,
libqcustomplot-dev,
docbook-to-man,
......
......@@ -255,8 +255,6 @@ target_link_libraries(xtpcpp
Qt5::Sql
Qt5::Concurrent
ZLIB::ZLIB
Alglib::Alglib
Zstd::Zstd
${QCustomPlot_LIBRARIES}
${Quazip5_LIBRARY}
)
......
......@@ -154,8 +154,10 @@ EditTandemPresetDialog::doCopy()
{
delete _p_tandem_preset_file;
}
qDebug() << new_preset_file_name;
_p_tandem_preset_file = new TandemParametersFile(
QString("%1/%2.xml").arg(_preset_directory).arg(new_preset_file_name));
doSave();
}
......
......@@ -355,6 +355,13 @@ MainWindow::doProjectReady(ProjectSp project_sp)
_project_sp->addMsRunAlignmentGroupToList(name);
}
// Reset masschroq_run_dialog with new project
if(_p_export_masschroq_dialog != nullptr)
{
delete _p_export_masschroq_dialog;
_p_export_masschroq_dialog = nullptr;
}
_project_window->show();
showProjectName();
......
......@@ -1150,7 +1150,8 @@ ProjectWindow::doExportXicAreaToCsv(QString filename,
{
qDebug() << "Export Xic to csv";
showWaitingMessage("Export All XIC area to CSV");
emit operateWriteXicAreaInCsv(filename, xic_boxs);
QString project_name = getProjectSP()->getProjectName();
emit operateWriteXicAreaInCsv(filename, project_name, xic_boxs);
}
void
ProjectWindow::doExportXicAreaToCsvFinished()
......
......@@ -119,6 +119,7 @@ class ProjectWindow : public QMainWindow
void bestMsRunFound(MsRunSp msrun_sp);
void operateMassChroqExportDialog();
void operateWriteXicAreaInCsv(QString filename,
QString project_name,
std::vector<XicBox *> xic_boxs);
protected:
......
......@@ -923,10 +923,10 @@ WorkerThread::doCheckMsrunFilePath(ProjectSp msp_project)
void
WorkerThread::doWriteXicAreaInCsv(QString filename,
QString project_name,
std::vector<XicBox *> xic_boxs)
{
CalcWriterInterface *p_writer = nullptr;
emit loadingMessage(tr("writing TSV files, please wait"));
QSettings settings;
QString xic_export_file =
......@@ -934,18 +934,18 @@ WorkerThread::doWriteXicAreaInCsv(QString filename,
p_writer = new TsvDirectoryWriter(filename);
if(xic_export_file == "both")
{
XicAreaSheet(p_writer, xic_boxs);
XicAreaSheet(p_writer, project_name, xic_boxs);
bool all_data = true;
XicAreaSheet(p_writer, xic_boxs, all_data);
XicAreaSheet(p_writer, project_name, xic_boxs, all_data);
}
else if(xic_export_file == "all")
{
bool all_data = true;
XicAreaSheet(p_writer, xic_boxs, all_data);
XicAreaSheet(p_writer, project_name, xic_boxs, all_data);
}
else // xic_export_file == "area"
{
XicAreaSheet(p_writer, xic_boxs);
XicAreaSheet(p_writer, project_name, xic_boxs);
}
p_writer->close();
emit exportXicToCsvFinished();
......
......@@ -90,7 +90,9 @@ class WorkerThread : public QObject
void doFindBestMsrunForAlignment(ProjectSp project_sp,
MsRunAlignmentGroupSp alignment_group);
void doCheckMsrunFilePath(ProjectSp project_sp);
void doWriteXicAreaInCsv(QString filename, std::vector<XicBox *> xic_boxs);
void doWriteXicAreaInCsv(QString filename,
QString project_name,
std::vector<XicBox *> xic_boxs);
signals:
void loadingMessage(QString message);
......
......@@ -88,7 +88,8 @@
<string>new XIC</string>
</property>
<property name="icon">
<iconset theme="tab-new"/>
<iconset theme="tab-new">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
......@@ -176,7 +177,8 @@
<string/>
</property>
<property name="icon">
<iconset theme="window-close"/>
<iconset theme="window-close">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="iconSize">
<size>
......@@ -194,7 +196,7 @@
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="4,1">
<property name="spacing">
<number>0</number>
</property>
......
......@@ -181,6 +181,20 @@ XicBox::XicBox(XicWindow *parent) : QWidget(parent), ui(new Ui::XicBox)
&XicWindow::rtUnitChangeNeeded,
this,
&XicBox::onRtUnitChanged);
/** @brief Handle axis size to move simultaneously in boxs
*/
connect(ui->xic_widget->getRtAxisP(),
qOverload<const QCPRange &>(&QCPAxis::rangeChanged),
this,
&XicBox::doGetNewRtRange);
connect(ui->xic_widget->getIntensityAxisP(),
qOverload<const QCPRange &>(&QCPAxis::rangeChanged),
this,
&XicBox::doGetNewIntensityRange);
connect(
this, &XicBox::fitAxisRangeInXics, _p_xic_window, &XicWindow::doFitAllAxis);
#else
// Qt4 code
#endif
......@@ -205,6 +219,25 @@ XicBox::~XicBox()
_xic_thread.wait();
}
void
XicBox::rescaleXicWidget(QString axis_name, QCPRange new_range)
{
ui->xic_widget->rescaleOneRange(axis_name, new_range);
}
void
XicBox::doGetNewRtRange(QCPRange new_range)
{
emit fitAxisRangeInXics("xAxis", new_range);
}
void
XicBox::doGetNewIntensityRange(QCPRange new_range)
{
emit fitAxisRangeInXics("yAxis", new_range);
}
void
XicBox::onXicWidgetClick(double rt [[maybe_unused]],
double intensity [[maybe_unused]])
......@@ -513,7 +546,8 @@ XicBox::drawObservedAreaBars(
}
// m_observedRatioBars->setPen(QPen(QColor("red")));
m_observedAreaBars->setPen(QPen(QColor("yellow")));
m_observedAreaBars->setPen(QColor(180, 15, 32, 200));
m_observedAreaBars->setBrush(QColor(180, 15, 32, 200));
//_graph_peak_surface_list.back()->setScatterStyle(QCPScatterStyle::ssDot);
// observed_intensity->setBrush(QBrush(QColor(170, 255, 0, 0)));
......@@ -536,11 +570,27 @@ XicBox::drawObservedAreaBars(
if(ticks.size() > 0)
{
for(double &tick : ticks)
{
tick += 0.1;
}
m_observedAreaBars->setData(ticks, observed_intensity_data);
m_observedAreaBars->setWidth(0.6);
// QVector<QString> labels;
// for(double tick : ticks)
// {
// labels.push_back(QString::number(tick));
// }
// QSharedPointer<QCPAxisTickerText> textTicker(new
// QCPAxisTickerText); textTicker->addTicks(ticks, labels);
// ui->histo_widget->yAxis->setTicker(textTicker);
// m_observedRatioBars->setData(ticks, observed_ratio_data);
ui->histo_widget->yAxis2->setVisible(true);
ui->histo_widget->yAxis2->setRange(0, sum);
ui->histo_widget->yAxis2->setLabel("observed intensity");
ui->histo_widget->yAxis2->setLabelPadding(0);
ui->histo_widget->replot();
}
qDebug();
......@@ -578,6 +628,8 @@ XicBox::setIsotopeMassList(
}
m_theoreticalRatioBars->setName("th. ratio");
ui->histo_widget->xAxis->setLabel("isotopes");
m_theoreticalRatioBars->setPen(QColor(59, 154, 178));
m_theoreticalRatioBars->setBrush(QColor(59, 154, 178));
// ui->histo_widget->yAxis->setLabel("th. ratio");
QVector<double> theoretical_ratio_data;
......@@ -605,14 +657,15 @@ XicBox::setIsotopeMassList(
isotope_name.append(QString(" (%1%)").arg((
int)(xic_isotope.peptide_natural_isotope_sp.get()->getIntensityRatio() *
100)));
labels << isotope_name;
labels << QString::number(
xic_isotope.peptide_natural_isotope_sp.get()->getIsotopeNumber());
ticks << i;
i++;
}
// QSharedPointer<QCPAxisTickerText> textTicker(new QCPAxisTickerText);
// textTicker->addTicks(ticks, labels);
// ui->histo_widget->xAxis->setTicker(textTicker);
ui->histo_widget->xAxis->setTickLabelRotation(60);
QSharedPointer<QCPAxisTickerText> textTicker(new QCPAxisTickerText);
textTicker->addTicks(ticks, labels);
ui->histo_widget->xAxis->setTicker(textTicker);
ui->histo_widget->xAxis->setTickLabelRotation(0);
// ui->histo_widget->xAxis->setSubTicks(false);
// ui->histo_widget->xAxis->setTickLength(0, 4);
// ui->histo_widget->xAxis->setRange(0, 8);
......@@ -622,12 +675,18 @@ XicBox::setIsotopeMassList(
ui->histo_widget->xAxis->setTickStep(1);
*/
for(double &tick : ticks)
{
tick -= 0.1;
}
m_theoreticalRatioBars->setData(ticks, theoretical_ratio_data);
m_theoreticalRatioBars->setWidth(0.6);
ui->histo_widget->yAxis->setRange(0, sum);
ui->histo_widget->xAxis->setRange(-0.8, _natural_isotope_list.size());
ui->histo_widget->yAxis->setLabel("intensity ratio");
ui->histo_widget->yAxis->setLabelPadding(0);
ui->histo_widget->xAxis->setRange(-0.5, _natural_isotope_list.size() - 0.5);
ui->histo_widget->replot();
}
......
......@@ -71,6 +71,8 @@ class XicBox : public QWidget
std::vector<XicBoxNaturalIsotope> getNaturalIsotopList() const;
MsRunSp getMsRunSp();
void rescaleXicWidget(QString axis_name, QCPRange intensity_range);
signals:
void loadXic(MsRunSp p_msrun,
std::vector<pappso::pappso_double> mz_list,
......@@ -80,6 +82,8 @@ class XicBox : public QWidget
unsigned int charge,
pappso::PrecisionPtr precision,
double minimum_isotope_pattern_ratio);
void fitAxisRangeInXics(QString axis_name, QCPRange new_range);
private slots:
void remove();
void reExtractXic();
......@@ -93,6 +97,8 @@ class XicBox : public QWidget
void onRtUnitChanged();
void onXicWidgetClick(double rt, double intensity);
void onIsotopicDistributionClick();
void doGetNewRtRange(QCPRange new_range);
void doGetNewIntensityRange(QCPRange new_range);
private:
void drawObservedAreaBars(
......
......@@ -69,6 +69,39 @@
</attribute>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<property name="toolTip">
<string>Lock X axis through XICs</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../xtpcpp.qrc">
<normaloff>:/icons/resources/icons/apache/firefox/unlock_icon.svg</normaloff>:/icons/resources/icons/apache/firefox/unlock_icon.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="shortcut">
<string/>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
......@@ -88,7 +121,7 @@
<string>...</string>
</property>
<property name="icon">
<iconset theme="spreadsheet">
<iconset theme="x-office-spreadsheet">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="iconSize">
......@@ -252,6 +285,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>toolButton</sender>
<signal>clicked()</signal>
<receiver>XicWindow</receiver>
<slot>doChangeLockXaxisRule()</slot>
<hints>
<hint type="sourcelabel">
<x>358</x>
<y>45</y>
</hint>
<hint type="destinationlabel">
<x>407</x>
<y>660</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>xicPrecisionChanged(pappso::PrecisionPtr)</slot>
......@@ -259,6 +308,7 @@
<slot>doEditZivyParams()</slot>
<slot>doXicExtractionMethodChanged(pappso::XicExtractMethod)</slot>
<slot>doExportXicToCsv()</slot>
<slot>doChangeLockXaxisRule()</slot>
</slots>
<buttongroups>
<buttongroup name="rt_unit_buttongroup"/>
......
......@@ -213,3 +213,34 @@ XicWindow::doExportXicToCsv()
}
emit operateXicAreaToCsv(filename, xic_boxs);
}
void
XicWindow::doChangeLockXaxisRule()
{
if(m_lockXaxis)
{
ui->toolButton->setIcon(
QIcon(":/icons/resources/icons/apache/firefox/unlock_icon.svg"));
m_lockXaxis = false;
}
else
{
ui->toolButton->setIcon(
QIcon(":/icons/resources/icons/apache/firefox/lock_icon.svg"));
m_lockXaxis = true;
}
}
void
XicWindow::doFitAllAxis(QString axis_name, QCPRange new_range)
{
if(m_lockXaxis)
{
for(int i = 0; i < ui->verticalLayout->layout()->count(); i++)
{
XicBox *p_xic =
dynamic_cast<XicBox *>(ui->verticalLayout->itemAt(i)->widget());
p_xic->rescaleXicWidget(axis_name, new_range);
}
}
}
......@@ -36,6 +36,7 @@
#include "../../core/peptideevidence.h"
#include "xic_widgets/zivydialog.h"
#include <qcustomplot.h>
class ProjectWindow;
......@@ -75,6 +76,8 @@ class XicWindow : public QMainWindow
void doAcceptedZivyDialog();
void doXicExtractionMethodChanged(pappso::XicExtractMethod xic_method);
void doExportXicToCsv();
void doChangeLockXaxisRule();
void doFitAllAxis(QString axis_name, QCPRange new_range);
signals:
void reExtractXicNeeded();
......@@ -92,7 +95,7 @@ class XicWindow : public QMainWindow
private:
ProjectWindow *_project_window;
Ui::XicWindow *ui;
bool m_lockXaxis = false;
std::shared_ptr<pappso::TraceDetectionInterface> msp_detect_zivy;
......
......@@ -31,6 +31,7 @@
#include "xicareasheet.h"
XicAreaSheet::XicAreaSheet(CalcWriterInterface *p_writer,
QString project_name,
const std::vector<XicBox *> xic_boxs,
bool all_data)
{
......@@ -43,7 +44,7 @@ XicAreaSheet::XicAreaSheet(CalcWriterInterface *p_writer,
mp_writer->setCurrentOdsTableSettings(table_settings);
if(all_data)
{
mp_writer->writeSheet("xic_all_data");
mp_writer->writeSheet(QString("%1_xic_all_data").arg(project_name));
writeHeadersAllData();
for(XicBox *xic : mp_xicBoxList)
{
......@@ -52,7 +53,7 @@ XicAreaSheet::XicAreaSheet(CalcWriterInterface *p_writer,
}
else
{
mp_writer->writeSheet("xic_area");
mp_writer->writeSheet(QString("%1_xic_are").arg(project_name));
writeHeaders();
for(XicBox *xic : mp_xicBoxList)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please