Commit 2879d853 authored by Langella Olivier's avatar Langella Olivier
Browse files

check and fix second chance for thin peaks in xicfilterdetectmatch

parent 5e86a36a
......@@ -124,6 +124,7 @@ MapQuanti::operator()(QuantiItemBase *p_currentSearchItem)
_monitor,
_p_xic_filter.get(),
_p_detection.get(),
_quantificator,
_matching_mode);
filter_detect_match.filterDetectQuantify(
*(msrun_xic_sp.get()), rt_target, p_currentSearchItem, _p_msrun);
......
......@@ -19,9 +19,6 @@
* You should have received a copy of the GNU General Public License
* along with MassChroQ. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
*implementation
******************************************************************************/
#include "mapquantirealxic.h"
......
......@@ -19,9 +19,6 @@
* You should have received a copy of the GNU General Public License
* along with MassChroQ. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
*implementation
******************************************************************************/
#pragma once
......
/*******************************************************************************
* Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
*
* This file is part of the MassChroQ software.
*
* MassChroQ 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.
*
* MassChroQ 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 MassChroQ. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
*implementation
******************************************************************************/
#include "maprtrealxic.h"
#include "../quanti_items/quantiItemBase.h"
//#include "../xic/xic_base.h"
#include "../consoleout.h"
#include "../xic/xicfilterdetectrealrt.h"
#include "../xic/xictracebase.h"
MapRtRealXic::MapRtRealXic(Msrun *current_msrun,
McqXicType xic_type,
Quantificator *quantificator,
const pappso::XicFilterInterface *p_xic_filter,
const pappso::XicDetectionInterface *p_detection)
: _xic_type(xic_type)
{
_p_msrun = current_msrun;
_p_xic_filter = p_xic_filter;
_p_detection = p_detection;
_matching_mode = quantificator->getMatchingMode();
_quantificator = quantificator;
}
MapRtRealXic::MapRtRealXic(const MapRtRealXic &copy) : _xic_type(copy._xic_type)
{
_p_msrun = copy._p_msrun;
_p_xic_filter = copy._p_xic_filter;
_p_detection = copy._p_detection;
_matching_mode = copy._matching_mode;
_quantificator = copy._quantificator;
}
MapRtRealXic::~MapRtRealXic()
{
}
void
MapRtRealXic::operator()(QuantiItemRtDeterminator &rt_determinator)
{
try
{
XicFilterDetectRealRt filter_detect_real_rt_on_xic(_p_xic_filter,
_p_detection);
McqXicNoConstSp _p_xic = _p_msrun->extractXic(
_xic_type,
_quantificator->getXicExtractionMethod()->getPappsoMassRange(
rt_determinator.getMz()));
if(_p_xic != nullptr)
{
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
filter_detect_real_rt_on_xic.filterDetect(
_p_xic.get(), &rt_determinator, _p_msrun);
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
else
{
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
<< " _p_xic == nullptr";
}
}
catch(mcqError &errorException)
{
// QObject::tr("%1 CPUs used").arg(cpu_number)
// mcqerr() << "Oops! an error occurred in MassChroQ. Dont Panic :" <<
// endl; mcqerr() << error.qwhat() << endl;
qDebug() << " MapRtRealXic::operator " << errorException.qwhat();
// windaube_exit();
// return 1;
}
}
/*******************************************************************************
* Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
*
* This file is part of the MassChroQ software.
*
* MassChroQ 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.
*
* MassChroQ 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 MassChroQ. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
*implementation
******************************************************************************/
#ifndef MAPRTREALXIC_H
#define MAPRTREALXIC_H
#include "../quanti_items/quantiitemrtdeterminator.h"
#include "../quantificator.h"
#include <pappsomspp/xic/detection/xicdetectioninterface.h>
#include <pappsomspp/xic/filters/xicfilterinterface.h>
struct MapRtRealXic
{
Msrun *_p_msrun;
McqXicType _xic_type;
const pappso::XicFilterInterface *_p_xic_filter;
const pappso::XicDetectionInterface *_p_detection;
McqMatchingMode _matching_mode;
Quantificator *_quantificator;
MapRtRealXic(Msrun *current_msrun,
McqXicType xic_type,
Quantificator *quantificator,
const pappso::XicFilterInterface *p_xic_filter,
const pappso::XicDetectionInterface *p_detection);
MapRtRealXic(const MapRtRealXic &copy);
virtual ~MapRtRealXic();
void operator()(QuantiItemRtDeterminator &rt_determinator);
};
#endif // MAPRTREALXIC_H
/** @file src/lib/xic/xicfilterdetectmatch.cpp
*/
/*******************************************************************************
* Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
......@@ -32,20 +34,32 @@ XicFilterDetectMatch::XicFilterDetectMatch(
MonitorSpeedInterface &monitor,
const pappso::FilterInterface *p_xic_filter,
const pappso::TraceDetectionInterface *p_detection,
Quantificator *p_quantificator,
McqMatchingMode matching_mode)
: _monitor(monitor)
{
_p_detection = p_detection;
_p_xic_filter = p_xic_filter;
_p_trace = p_trace;
_matching_mode = matching_mode;
_p_detection = p_detection;
_p_xic_filter = p_xic_filter;
_p_trace = p_trace;
_matching_mode = matching_mode;
_thin_peak_rt_tolerance = 0;
mp_quantificator = p_quantificator;
if(_matching_mode == McqMatchingMode::post_matching)
{
_thin_peak_rt_tolerance = 0;
}
else
{
_thin_peak_rt_tolerance = 5;
if(mp_quantificator->getQuantificationMethod()->getSecondChance())
{
_thin_peak_rt_tolerance = 5;
}
else
{
// disable thin peak retention time tolerance, no second chance on
// thin peaks
_thin_peak_rt_tolerance = 0;
}
}
}
......@@ -57,7 +71,7 @@ void
XicFilterDetectMatch::setTracePeak(pappso::TracePeak &xic_peak)
{
// qDebug() << "XicFilterDetectMatch::setXicPeak begin" ;
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
qDebug();
if(_p_trace != nullptr)
{
_p_trace->addXicPeak(xic_peak);
......@@ -105,20 +119,24 @@ XicFilterDetectMatch::setTracePeak(pappso::TracePeak &xic_peak)
else
{
if(_matching_mode != McqMatchingMode::post_matching)
if(mp_quantificator->getQuantificationMethod()->getSecondChance())
{
if((xic_peak.getLeftBoundary().x - _rt_target) < 10)
if(_matching_mode != McqMatchingMode::post_matching)
{
unsigned int distance_point =
_p_current_xic->getMsPointDistance(
_rt_target, xic_peak.getLeftBoundary().x);
if(distance_point == 0)
if((xic_peak.getLeftBoundary().x - _rt_target) < 10)
{
AlignedXicPeak aligned_peak(xic_peak, _p_current_msrun);
_monitor.writeMatchedPeak(_p_current_msrun,
_p_current_search_item,
&aligned_peak);
_peak_detected = true;
unsigned int distance_point =
_p_current_xic->getMsPointDistance(
_rt_target, xic_peak.getLeftBoundary().x);
if(distance_point == 0)
{
AlignedXicPeak aligned_peak(xic_peak,
_p_current_msrun);
_monitor.writeMatchedPeak(_p_current_msrun,
_p_current_search_item,
&aligned_peak);
_peak_detected = true;
}
}
}
}
......@@ -143,14 +161,17 @@ XicFilterDetectMatch::setTracePeak(pappso::TracePeak &xic_peak)
}
else
{
if(std::abs(xic_peak.getMaxXicElement().y - _rt_target) <
_thin_peak_rt_tolerance)
if(mp_quantificator->getQuantificationMethod()->getSecondChance())
{
// if this peak is nearby, in a 5 second range
_p_log_peaks.push_back(xic_peak.makeTracePeakCstSPtr());
if(std::abs(xic_peak.getMaxXicElement().y - _rt_target) <
_thin_peak_rt_tolerance)
{
// if this peak is nearby, in a 5 second range
_p_log_peaks.push_back(xic_peak.makeTracePeakCstSPtr());
}
}
}
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
qDebug();
// qDebug() << "XicFilterDetectMatch::setXicPeak end" ;
}
......@@ -162,7 +183,7 @@ XicFilterDetectMatch::filterDetectQuantify(const pappso::Xic &xic,
{
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
qDebug();
_p_current_search_item = p_currentSearchItem;
_p_current_msrun = p_msrun;
_rt_target = rt_target;
......@@ -177,15 +198,13 @@ XicFilterDetectMatch::filterDetectQuantify(const pappso::Xic &xic,
}
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
<< _rt_target;
qDebug() << _rt_target;
_p_detection->detect(*_p_current_xic, *this);
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
<< " after detect";
qDebug() << " after detect";
if(_peak_detected == false)
{
if(_p_log_peaks.size() > 0)
{
{ // second chance
// take the nearest peak : this should be a small peak, that does not
// cover the RT target
const pappso::TracePeak *peak_i = _p_log_peaks.at(0).get();
......@@ -230,5 +249,5 @@ XicFilterDetectMatch::filterDetectQuantify(const pappso::Xic &xic,
}
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
qDebug();
}
/** @file src/lib/xic/xicfilterdetectmatch.h
*/
/*******************************************************************************
* Copyright (c) 2016 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
......@@ -17,9 +19,6 @@
* You should have received a copy of the GNU General Public License
* along with MassChroQ. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
*implementation
******************************************************************************/
#pragma once
......@@ -37,6 +36,7 @@ class XicFilterDetectMatch : public pappso::TraceDetectionSinkInterface
MonitorSpeedInterface &monitor,
const pappso::FilterInterface *p_xic_filter,
const pappso::TraceDetectionInterface *p_detection,
Quantificator *p_quantificator,
McqMatchingMode matching_mode);
~XicFilterDetectMatch();
......@@ -62,4 +62,5 @@ class XicFilterDetectMatch : public pappso::TraceDetectionSinkInterface
std::vector<pappso::TracePeakCstSPtr> _p_log_peaks;
pappso::pappso_double _thin_peak_rt_tolerance = 0;
Quantificator *mp_quantificator = nullptr;
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment