libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::TimsDirectXicExtractor Class Reference

#include <timsdirectxicextractor.h>

Inheritance diagram for pappso::TimsDirectXicExtractor:
pappso::TimsXicExtractorInterface pappso::MsRunXicExtractorInterface

Public Member Functions

 TimsDirectXicExtractor (MsRunReaderSPtr &msrun_reader)
 
virtual ~TimsDirectXicExtractor ()
 
- Public Member Functions inherited from pappso::TimsXicExtractorInterface
 TimsXicExtractorInterface (MsRunReaderSPtr &msrun_reader)
 
virtual ~TimsXicExtractorInterface ()
 
- Public Member Functions inherited from pappso::MsRunXicExtractorInterface
void setXicExtractMethod (Enums::XicExtractMethod method)
 set the XIC extraction method
 
void setRetentionTimeAroundTarget (double range_in_seconds)
 set the retention time range in seconds around the target rt
 
virtual void extractXicCoordSPtrList (UiMonitorInterface &monitor, std::vector< XicCoordSPtr > &xic_coord_list) final
 extract a list of XIC given a list of xic coordinates to extract
 
virtual void extractXicCoordSPtrListParallelized (UiMonitorInterface &monitor, std::vector< XicCoordSPtr > &xic_coord_list) final
 multithreaded XIC extraction
 
const MsRunIdCstSPtrgetMsRunId () const
 
const MsRunReaderSPtrgetMsRunReaderSPtr () const
 get the msrunreader currently used for XIC extraction
 
void setPostExtractionTraceFilterCstSPtr (pappso::FilterInterfaceCstSPtr &filter)
 filter interface to apply just after XIC extration on each trace
 

Protected Member Functions

void protectedExtractXicCoordSPtrList (UiMonitorInterface &monitor, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_begin, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_end) override
 
- Protected Member Functions inherited from pappso::MsRunXicExtractorInterface
 MsRunXicExtractorInterface (MsRunReaderSPtr &msrun_reader)
 constructor is private, use the MsRunXicExtractorFactory
 
 MsRunXicExtractorInterface (const MsRunXicExtractorInterface &other)
 
virtual ~MsRunXicExtractorInterface ()
 
virtual void postExtractionProcess (UiMonitorInterface &monitor, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_begin, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_end)
 possible post extraction process, eventually trace filters
 

Additional Inherited Members

- Protected Attributes inherited from pappso::TimsXicExtractorInterface
TimsDatamp_timsData
 
- Protected Attributes inherited from pappso::MsRunXicExtractorInterface
MsRunReaderSPtr msp_msrun_reader
 
Enums::XicExtractMethod m_xicExtractMethod = Enums::XicExtractMethod::max
 
double m_retentionTimeAroundTarget = std::numeric_limits<double>::max()
 
pappso::FilterInterfaceCstSPtr mcsp_postExtractionTraceFilter = nullptr
 

Detailed Description

Todo
write docs

Definition at line 36 of file timsdirectxicextractor.h.

Constructor & Destructor Documentation

◆ TimsDirectXicExtractor()

TimsDirectXicExtractor::TimsDirectXicExtractor ( MsRunReaderSPtr & msrun_reader)

Default constructor

Definition at line 35 of file timsdirectxicextractor.cpp.

36 : pappso::TimsXicExtractorInterface(msrun_reader)
37{
38}

References pappso::TimsXicExtractorInterface::TimsXicExtractorInterface().

◆ ~TimsDirectXicExtractor()

TimsDirectXicExtractor::~TimsDirectXicExtractor ( )
virtual

Destructor

Definition at line 40 of file timsdirectxicextractor.cpp.

41{
42}

Member Function Documentation

◆ protectedExtractXicCoordSPtrList()

void pappso::TimsDirectXicExtractor::protectedExtractXicCoordSPtrList ( UiMonitorInterface & monitor,
std::vector< XicCoordSPtr >::iterator it_xic_coord_list_begin,
std::vector< XicCoordSPtr >::iterator it_xic_coord_list_end )
overrideprotectedvirtual

Implements pappso::MsRunXicExtractorInterface.

Definition at line 46 of file timsdirectxicextractor.cpp.

50{
51 qDebug();
52 std::size_t xic_total_number = std::distance(it_xic_coord_list_begin, it_xic_coord_list_end);
53 if(xic_total_number == 0)
54 return;
55
56 std::vector<XicCoordTims *> xic_coord_tims_list;
57 xic_coord_tims_list.reserve(xic_total_number);
58
59 for(auto it = it_xic_coord_list_begin; it != it_xic_coord_list_end; it++)
60 {
61 XicCoordTims *p_xic_coord_tims = dynamic_cast<XicCoordTims *>(it->get());
62 if(p_xic_coord_tims == nullptr)
63 {
64 }
65 else
66 {
67 xic_coord_tims_list.push_back(p_xic_coord_tims);
68 }
69 }
70
71 std::sort(
72 xic_coord_tims_list.begin(),
73 xic_coord_tims_list.end(),
74 [](const XicCoordTims *pa, const XicCoordTims *pb) { return pa->rtTarget < pb->rtTarget; });
75 std::vector<std::size_t> tims_frameid_list;
76 try
77 {
78 tims_frameid_list = mp_timsData->getTimsMS1FrameIdsInRtRange(
79 xic_coord_tims_list[0]->rtTarget - m_retentionTimeAroundTarget,
80 xic_coord_tims_list.back()->rtTarget + m_retentionTimeAroundTarget);
81 }
82 catch(pappso::PappsoException &error)
83 {
84 throw pappso::PappsoException(QObject::tr("ERROR in %1 %2 %3:\n%4")
85 .arg(__FUNCTION__)
86 .arg(xic_coord_tims_list[0]->rtTarget)
87 .arg(xic_coord_tims_list.back()->rtTarget)
88 .arg(error.qwhat()));
89 }
90 monitor.setStatus(QObject::tr("extracting %1 XICs on %2 Tims frames")
91 .arg(xic_total_number)
92 .arg(tims_frameid_list.size()));
93 monitor.setTotalSteps(tims_frameid_list.size());
94
95 qDebug() << " tims_frameid_list.size()=" << tims_frameid_list.size();
96 qDebug() << " rt begin=" << xic_coord_tims_list[0]->rtTarget;
97 qDebug() << " rt end=" << xic_coord_tims_list.back()->rtTarget;
98 for(std::size_t frame_id : tims_frameid_list)
99 {
100 std::vector<XicCoordTims *>::iterator itXicListbegin = xic_coord_tims_list.begin();
101 std::vector<XicCoordTims *>::iterator itXicListend = xic_coord_tims_list.end();
102 qDebug();
103 TimsFrameCstSPtr frame_sptr = mp_timsData->getTimsFrameCstSPtrCached(frame_id);
104 qDebug();
105 double rtframe = frame_sptr.get()->getRtInSeconds();
106 qDebug();
107
108 double rtbeginframe = rtframe - m_retentionTimeAroundTarget;
109 double rtendframe = rtframe + m_retentionTimeAroundTarget;
110
111 if(rtbeginframe < 0)
112 rtbeginframe = 0;
113
114 qDebug() << rtbeginframe;
115 while((itXicListbegin != itXicListend) && ((*itXicListbegin)->rtTarget < rtbeginframe))
116 {
117 itXicListbegin++;
118 }
119 qDebug();
120 itXicListend = itXicListbegin;
121 while((itXicListend != xic_coord_tims_list.end()) && ((*itXicListend)->rtTarget < rtendframe))
122 {
123 itXicListend++;
124 }
125 frame_sptr.get()->extractTimsXicListInRtRange(
126 itXicListbegin, itXicListend, m_xicExtractMethod);
127
128 qDebug() << "" << frame_sptr.get()->getId();
129 monitor.count();
130 if(monitor.shouldIstop())
131 {
132 throw pappso::ExceptionInterrupted(QObject::tr("Xic extraction process interrupted"));
133 }
134 }
135 qDebug();
136}
virtual const QString & qwhat() const
double getRtInSeconds() const
std::size_t getId() const
void extractTimsXicListInRtRange(std::vector< XicCoordTims * >::iterator &itXicListbegin, std::vector< XicCoordTims * >::iterator &itXicListend, Enums::XicExtractMethod method) const
virtual void setStatus(const QString &status)=0
current status of the process
virtual void setTotalSteps(std::size_t total_number_of_steps)
use it if the number of steps is known in an algorithm the total number of steps is usefull to report...
virtual bool shouldIstop()=0
should the procces be stopped ? If true, then cancel process Use this function at strategic point of ...
virtual void count()=0
count steps report when a step is computed in an algorithm
std::shared_ptr< const TimsFrame > TimsFrameCstSPtr
Definition timsframe.h:44

References pappso::UiMonitorInterface::count(), pappso::TimsFrame::extractTimsXicListInRtRange(), pappso::TimsFrameBase::getId(), pappso::TimsFrameBase::getRtInSeconds(), pappso::MsRunXicExtractorInterface::m_retentionTimeAroundTarget, pappso::MsRunXicExtractorInterface::m_xicExtractMethod, pappso::TimsXicExtractorInterface::mp_timsData, pappso::PappsoException::qwhat(), pappso::UiMonitorInterface::setStatus(), pappso::UiMonitorInterface::setTotalSteps(), and pappso::UiMonitorInterface::shouldIstop().


The documentation for this class was generated from the following files: