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

using zivy detection parameters

parent 373b2144
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@
#include "zivywidget.h"
#include "ui_zivy_widget.h"
#include <QDebug>
#include <QSettings>
void ZivyParams::setDetectionParameters(pappso::XicDetectionZivy * detect_zivy) const {
detect_zivy->setSmoothingHalfEdgeWindows(_smoothing_half_window);
......@@ -38,6 +39,23 @@ void ZivyParams::setDetectionParameters(pappso::XicDetectionZivy * detect_zivy)
detect_zivy->setDetectionThresholdOnMaxmin(_maxmin_threshold);
}
void ZivyParams::saveSettings() const {
QSettings settings;
settings.setValue("xic/zivy_maxmin_threshold", QString("%1").arg(_maxmin_threshold));
settings.setValue("xic/zivy_minmax_threshold", QString("%1").arg(_minmax_threshold));
settings.setValue("xic/zivy_maxmin_half_window", QString("%1").arg(_maxmin_half_window));
settings.setValue("xic/zivy_minmax_half_window", QString("%1").arg(_minmax_half_window));
settings.setValue("xic/zivy_smoothing", QString("%1").arg(_smoothing_half_window));
}
void ZivyParams::loadSettings() {
QSettings settings;
_maxmin_threshold = settings.value("xic/zivy_maxmin_threshold", QString("%1").arg(_maxmin_threshold)).toDouble();
_minmax_threshold = settings.value("xic/zivy_minmax_threshold", QString("%1").arg(_minmax_threshold)).toDouble();
_maxmin_half_window = settings.value("xic/zivy_maxmin_half_window", QString("%1").arg(_maxmin_half_window)).toInt();
_minmax_half_window = settings.value("xic/zivy_minmax_half_window", QString("%1").arg(_minmax_half_window)).toInt();
_smoothing_half_window = settings.value("xic/zivy_smoothing", QString("%1").arg(_smoothing_half_window)).toInt();
}
ZivyWidget::ZivyWidget(QWidget *parent):
QWidget(parent),
ui(new Ui::ZivyWidget)
......
......@@ -39,6 +39,8 @@ class ZivyWidget;
struct ZivyParams {
void setDetectionParameters(pappso::XicDetectionZivy * detect_zivy) const;
void saveSettings() const;
void loadSettings();
unsigned int _maxmin_half_window = 3;
unsigned int _minmax_half_window = 2;
......
......@@ -47,11 +47,7 @@ XicWindow::XicWindow(ProjectWindow *parent):
ZivyParams zivy_params;
zivy_params._maxmin_threshold = settings.value("xic/zivy_maxmin_threshold", "30000").toDouble();
zivy_params._minmax_threshold = settings.value("xic/zivy_minmax_threshold", "50000").toDouble();
zivy_params._maxmin_half_window = settings.value("xic/zivy_maxmin_half_window", "2").toInt();
zivy_params._minmax_half_window = settings.value("xic/zivy_minmax_half_window", "4").toInt();
zivy_params._smoothing_half_window = settings.value("xic/zivy_smoothing", "1").toInt();
zivy_params.loadSettings();
zivy_params.setDetectionParameters(&_detect_zivy);
......@@ -143,6 +139,7 @@ bool XicWindow::isRetentionTimeSeconds() const {
void XicWindow::doAcceptedZivyDialog() {
_p_zivy_dialog->getZivyParams().setDetectionParameters(&_detect_zivy);
_p_zivy_dialog->getZivyParams().saveSettings();
emit reExtractXicNeeded();
}
......@@ -35,7 +35,6 @@
#include <QStringList>
#include <QSettings>
struct McqObserved {
bool operator ==(const McqObserved &other) const {
return (msrun==other.msrun && scan==other.scan && charge==other.charge);
......@@ -80,12 +79,7 @@ MassChroQml::MassChroQml(const QString & out_filename)
_output_stream->setAutoFormatting(true);
_output_stream->writeStartDocument("1.0");
QSettings settings;
_detect_zivy.setSmoothingHalfEdgeWindows(settings.value("xic/zivy_smoothing", "1").toInt());
_detect_zivy.setMinMaxHalfEdgeWindows(settings.value("xic/zivy_minmax_half_window", "3").toInt());
_detect_zivy.setMaxMinHalfEdgeWindows(settings.value("xic/zivy_maxmin_half_window", "2").toInt());
_detect_zivy.setDetectionThresholdOnMinmax(settings.value("xic/zivy_minmax_threshold", "5000").toDouble());
_detect_zivy.setDetectionThresholdOnMaxmin(settings.value("xic/zivy_maxmin_threshold", "3000").toDouble());
_detect_zivy.loadSettings();
}
......@@ -219,11 +213,11 @@ void MassChroQml::writeQuantify() {
_output_stream->writeAttribute("mode","post_matching");
_output_stream->writeAttribute("ni_min_abundance","0.8");
if (_sp_project.get()->getLabelingMethodSp().get() != nullptr) {
QStringList isotope_label_ref;
for (const Label * p_label :_sp_project.get()->getLabelingMethodSp().get()->getLabelList()) {
isotope_label_ref << p_label->getXmlId();
}
_output_stream->writeAttribute("isotope_label_refs",isotope_label_ref.join(" "));
QStringList isotope_label_ref;
for (const Label * p_label :_sp_project.get()->getLabelingMethodSp().get()->getLabelList()) {
isotope_label_ref << p_label->getXmlId();
}
_output_stream->writeAttribute("isotope_label_refs",isotope_label_ref.join(" "));
}
_output_stream->writeEndElement();
......@@ -271,23 +265,23 @@ void MassChroQml::writeQuantificationMethods() {
_output_stream->writeStartElement("detection_zivy");
//<mean_filter_half_edge>1</mean_filter_half_edge>
_output_stream->writeStartElement("mean_filter_half_edge");
_output_stream->writeCharacters(QString("%1").arg(_detect_zivy.getSmoothingHalfEdgeWindows()));
_output_stream->writeCharacters(QString("%1").arg(_detect_zivy._smoothing_half_window));
_output_stream->writeEndElement();
//<minmax_half_edge>3</minmax_half_edge>
_output_stream->writeStartElement("minmax_half_edge");
_output_stream->writeCharacters(QString("%1").arg(_detect_zivy.getMinMaxHalfEdgeWindows()));
_output_stream->writeCharacters(QString("%1").arg(_detect_zivy._minmax_half_window));
_output_stream->writeEndElement();
//<maxmin_half_edge>2</maxmin_half_edge>
_output_stream->writeStartElement("maxmin_half_edge");
_output_stream->writeCharacters(QString("%1").arg(_detect_zivy.getMaxMinHalfEdgeWindows()));
_output_stream->writeCharacters(QString("%1").arg(_detect_zivy._maxmin_half_window));
_output_stream->writeEndElement();
//<detection_threshold_on_max>5000</detection_threshold_on_max>
_output_stream->writeStartElement("detection_threshold_on_max");
_output_stream->writeCharacters(QString("%1").arg(_detect_zivy.getDetectionThresholdOnMinmax()));
_output_stream->writeCharacters(QString("%1").arg(_detect_zivy._minmax_threshold));
_output_stream->writeEndElement();
//<detection_threshold_on_min>3000</detection_threshold_on_min>
_output_stream->writeStartElement("detection_threshold_on_min");
_output_stream->writeCharacters(QString("%1").arg(_detect_zivy.getDetectionThresholdOnMaxmin()));
_output_stream->writeCharacters(QString("%1").arg(_detect_zivy._maxmin_threshold));
_output_stream->writeEndElement();
//</detection_zivy>
_output_stream->writeEndElement();
......
......@@ -36,6 +36,7 @@
#include <pappsomspp/xic/detection/xicdetectionzivy.h>
#include "../core/project.h"
#include "../grouping/groupinggroup.h"
#include "../gui/xic_view/xic_widgets/zivywidget.h"
class MassChroQml
{
......@@ -62,7 +63,7 @@ private :
QXmlStreamWriter * _output_stream;
ProjectSp _sp_project;
IdentificationGroup * _p_identification_group;
pappso::XicDetectionZivy _detect_zivy;
ZivyParams _detect_zivy;
};
#endif // MASSCHROQML_H
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