Commit f82cceeb authored by Olivier Langella's avatar Olivier Langella
Browse files

trying to use the real observed MSMS points to detect peaks for post matching and real or mean mode

parent 76575518
......@@ -23,6 +23,7 @@
#include "mapquanti.h"
#include "../quanti_items/quantiItemBase.h"
#include "../xic/xicfilterdetectmatch.h"
#include "../xic/xicfilterdetectmatchrealrt.h"
#include "../xic/xic_base.h"
#include "../xic/xictracebase.h"
#include "../consoleout.h"
......@@ -42,18 +43,20 @@ void MapQuanti::operator()(QuantiItemBase * p_currentSearchItem)
qDebug() << " MapQuanti::operator begin";
try {
pappso::pappso_double rt_target = -1;
std::vector<MsMsRtIntensity> rt_list;
PeptideRt * p_peptide_rt = p_currentSearchItem->getPeptideRtSp().get();
if (p_peptide_rt != nullptr) {
rt_target = p_peptide_rt->getRtTarget(_p_msrun, _matching_mode);
if (std::isnan(rt_target)) {
qDebug() << " MapQuanti::operator() isnan(rt_target) " << p_currentSearchItem->getQuantiItemId() << " " << rt_target;
throw mcqError(QObject::tr("Error in MapQuanti::operator() isnan(rt_target) %1")
.arg(p_currentSearchItem->getQuantiItemId()));
}
if (_matching_mode == McqMatchingMode::realxic_or_mean) {
switch (_matching_mode) {
case McqMatchingMode::realxic_or_mean:
if (p_peptide_rt->isObservedIn(_p_msrun)) {
if(_quantificator->isInMissedQuantiItem(_p_msrun, p_currentSearchItem)) {
}
......@@ -61,12 +64,19 @@ void MapQuanti::operator()(QuantiItemBase * p_currentSearchItem)
return;
}
}
break;
case McqMatchingMode::post_matching:
case McqMatchingMode::real_or_mean:
rt_list = p_currentSearchItem->getPeptide()->getPeptideRtSp()->getObservedRtList(_p_msrun);
break;
default:
break;
}
}
if (rt_target == -1) {
if (_matching_mode == McqMatchingMode::post_matching) {
//it's Ok, just detect and keep peaks
//it's Ok, just detect and keep peaks
} else if (_matching_mode == McqMatchingMode::no_matching) {
rt_target = p_currentSearchItem->getRt();
} else {
......@@ -84,11 +94,28 @@ void MapQuanti::operator()(QuantiItemBase * p_currentSearchItem)
}
else {
qDebug() << " MapQuanti::operator begin 3 rt_target=" << rt_target;
XicTraceBase * p_xic_trace = p_currentSearchItem->newXicTrace(_quantificator, _p_msrun, "target");
XicTraceBase * p_xic_trace = nullptr;
if (rt_list.size() > 0) {
//MSMS observed
//idea : add weighted mean retention time to the list ?
p_xic_trace = p_currentSearchItem->newXicTrace(_quantificator, _p_msrun, "MSMS");
XicFilterDetectMatchRealRt filter_detect_match_real_xic(p_xic_trace, _monitor, _p_xic_filter, _p_detection, _quantificator, _matching_mode);
XicFilterDetectMatch filter_detect_match(p_xic_trace, _monitor, _p_xic_filter, _p_detection, _matching_mode) ;
filter_detect_match.filterDetectQuantify(*(_p_xic.get()), rt_target, p_currentSearchItem, _p_msrun);
filter_detect_match_real_xic.filterDetectQuantify(_p_xic.get(), &rt_list, p_currentSearchItem, _p_msrun);
}
else {
//only take an rt reference to match peak
p_xic_trace = p_currentSearchItem->newXicTrace(_quantificator, _p_msrun, "target");
XicFilterDetectMatch filter_detect_match(p_xic_trace, _monitor, _p_xic_filter, _p_detection, _matching_mode) ;
filter_detect_match.filterDetectQuantify(*(_p_xic.get()), rt_target, p_currentSearchItem, _p_msrun);
}
if (p_xic_trace != nullptr) {
p_xic_trace->setAlignedRtTarget(_p_msrun->getAlignedRtByOriginalRt(rt_target));
......
......@@ -75,7 +75,7 @@ void MapQuantiRealXic::operator()(QuantiItemBase * p_currentSearchItem)
//qDebug() << " MapQuantiRealXic::operator rt_list_z.size()=" << rt_list_z.size();
// if (rt_list_z.size() > 0) {
// and it was observed with this charge
XicFilterDetectMatchRealRt filter_detect_match_real_xic(p_xic_trace, _monitor, _p_xic_filter, _p_detection, _quantificator);
XicFilterDetectMatchRealRt filter_detect_match_real_xic(p_xic_trace, _monitor, _p_xic_filter, _p_detection, _quantificator, _matching_mode);
McqXicNoConstSp _p_xic = _p_msrun->extractXic(_xic_type, _quantificator->getXicExtractionMethod()->getPappsoMassRange( p_currentSearchItem->getMz()));
if (_p_xic != nullptr) {
......
......@@ -23,7 +23,7 @@
#include "xicfilterdetectmatchrealrt.h"
#include "../quanti_items/quantiItemBase.h"
XicFilterDetectMatchRealRt::XicFilterDetectMatchRealRt(XicTraceBase * p_trace, MonitorSpeedInterface & monitor, const pappso::XicFilterInterface * p_xic_filter,const pappso::XicDetectionInterface * p_detection, Quantificator * p_quantificator)
XicFilterDetectMatchRealRt::XicFilterDetectMatchRealRt(XicTraceBase * p_trace, MonitorSpeedInterface & monitor, const pappso::XicFilterInterface * p_xic_filter,const pappso::XicDetectionInterface * p_detection, Quantificator * p_quantificator, McqMatchingMode matching_mode)
:_monitor(monitor)
{
qDebug() << "XicFilterDetectMatchRealRt::XicFilterDetectMatchRealRt " << this ;
......@@ -32,6 +32,7 @@ XicFilterDetectMatchRealRt::XicFilterDetectMatchRealRt(XicTraceBase * p_trace, M
_p_xic_filter = p_xic_filter;
_p_quantificator= p_quantificator;
_p_trace = p_trace;
_matching_mode = matching_mode;
}
XicFilterDetectMatchRealRt::~XicFilterDetectMatchRealRt()
......@@ -94,7 +95,15 @@ void XicFilterDetectMatchRealRt::filterDetectQuantify(const pappso::Xic * p_orig
//const pappso::XicPeak * p_peak = _peak_counter_map.begin()->first.get();
AlignedXicPeak aligned_peak(*(_peak_counter_map.begin()->first.get()), _p_current_msrun);
_monitor.writeMatchedPeak(_p_current_msrun, _p_current_search_item, &aligned_peak);
_p_current_search_item->getPeptide()->getPeptideRtSp()->addWeightedRealXicRt(aligned_peak, _peak_counter_map.begin()->second);
if (_matching_mode == McqMatchingMode::post_matching) {
//store aligned rt of this matched peak
_p_current_search_item->getPeptideRtSp().get()->postMatchingAlignedPeak(aligned_peak);
}
else {
_p_current_search_item->getPeptide()->getPeptideRtSp()->addWeightedRealXicRt(aligned_peak, _peak_counter_map.begin()->second);
}
if (_p_trace != nullptr) {
_p_trace->setMatchedPeak(*(_peak_counter_map.begin()->first.get()));
......@@ -117,7 +126,15 @@ void XicFilterDetectMatchRealRt::filterDetectQuantify(const pappso::Xic * p_orig
AlignedXicPeak aligned_peak(*(peak_sp.get()), _p_current_msrun);
_monitor.writeMatchedPeak(_p_current_msrun, _p_current_search_item, &aligned_peak);
_p_current_search_item->getPeptide()->getPeptideRtSp()->addWeightedRealXicRt(aligned_peak, 1);
if (_matching_mode == McqMatchingMode::post_matching) {
//store aligned rt of this matched peak
_p_current_search_item->getPeptideRtSp().get()->postMatchingAlignedPeak(aligned_peak);
}
else {
_p_current_search_item->getPeptide()->getPeptideRtSp()->addWeightedRealXicRt(aligned_peak, 1);
}
if (_p_trace != nullptr) {
_p_trace->setMatchedPeak(*(peak_sp.get()));
......@@ -151,7 +168,16 @@ void XicFilterDetectMatchRealRt::filterDetectQuantify(const pappso::Xic * p_orig
if(distance_point == 0) {
AlignedXicPeak aligned_peak(*(peak_sp.get()), _p_current_msrun);
_monitor.writeMatchedPeak(_p_current_msrun, _p_current_search_item, &aligned_peak);
_p_current_search_item->getPeptide()->getPeptideRtSp()->addWeightedRealXicRt(aligned_peak, 1);
if (_matching_mode == McqMatchingMode::post_matching) {
//store aligned rt of this matched peak
// warning : this could be risky
_p_current_search_item->getPeptideRtSp().get()->postMatchingAlignedPeak(aligned_peak);
}
else {
_p_current_search_item->getPeptide()->getPeptideRtSp()->addWeightedRealXicRt(aligned_peak, 1);
}
if (_p_trace != nullptr) {
......@@ -171,7 +197,7 @@ void XicFilterDetectMatchRealRt::filterDetectQuantify(const pappso::Xic * p_orig
if ((peptide_natural_sp == nullptr) || (peptide_natural_sp.get()->getIsotopeNumber() == 0) ) {
// _monitor.logMissedObservedRealXic(_p_current_search_item, p_origxic, p_real_rt,_p_log_peaks);
}
//it seems to be better to forget quanti items that was not matched here : leave it in comments
//_p_quantificator->addMissedQuantiItem(_p_current_msrun, _p_current_search_item);
}
......
......@@ -33,7 +33,7 @@
class XicFilterDetectMatchRealRt: public pappso::XicDetectionSinkInterface
{
public:
XicFilterDetectMatchRealRt(XicTraceBase * p_trace, MonitorSpeedInterface & monitor, const pappso::XicFilterInterface * p_xic_filter,const pappso::XicDetectionInterface * p_detection, Quantificator * p_quantificator);
XicFilterDetectMatchRealRt(XicTraceBase * p_trace, MonitorSpeedInterface & monitor, const pappso::XicFilterInterface * p_xic_filter,const pappso::XicDetectionInterface * p_detection, Quantificator * p_quantificator, McqMatchingMode matching_mode);
~XicFilterDetectMatchRealRt();
virtual void setXicPeak (pappso::XicPeak & xic_peak) override;
......@@ -53,6 +53,7 @@ private :
std::vector<pappso::XicPeakSp> * _p_log_peaks = nullptr;
XicTraceBase * _p_trace=nullptr;
McqMatchingMode _matching_mode;
//QMutex _mutex;
};
......
Supports Markdown
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