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 (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
 
XicExtractMethod m_xicExtractMethod = 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.

◆ ~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 =
53 std::distance(it_xic_coord_list_begin, it_xic_coord_list_end);
54 if(xic_total_number == 0)
55 return;
56
57 std::vector<XicCoordTims *> xic_coord_tims_list;
58 xic_coord_tims_list.reserve(xic_total_number);
59
60 for(auto it = it_xic_coord_list_begin; it != it_xic_coord_list_end; it++)
61 {
62 XicCoordTims *p_xic_coord_tims = dynamic_cast<XicCoordTims *>(it->get());
63 if(p_xic_coord_tims == nullptr)
64 {
65 }
66 else
67 {
68 xic_coord_tims_list.push_back(p_xic_coord_tims);
69 }
70 }
71
72 std::sort(xic_coord_tims_list.begin(),
73 xic_coord_tims_list.end(),
74 [](const XicCoordTims *pa, const XicCoordTims *pb) {
75 return pa->rtTarget < pb->rtTarget;
76 });
77
78
79 std::vector<std::size_t> tims_frameid_list =
81 xic_coord_tims_list[0]->rtTarget - m_retentionTimeAroundTarget,
82 xic_coord_tims_list.back()->rtTarget + m_retentionTimeAroundTarget);
83
84 monitor.setStatus(QObject::tr("extracting %1 XICs on %2 Tims frames")
85 .arg(xic_total_number)
86 .arg(tims_frameid_list.size()));
87 monitor.setTotalSteps(tims_frameid_list.size());
88
89 qDebug() << " tims_frameid_list.size()=" << tims_frameid_list.size();
90 qDebug() << " rt begin=" << xic_coord_tims_list[0]->rtTarget;
91 qDebug() << " rt end=" << xic_coord_tims_list.back()->rtTarget;
92 for(std::size_t frame_id : tims_frameid_list)
93 {
94 std::vector<XicCoordTims *>::iterator itXicListbegin =
95 xic_coord_tims_list.begin();
96 std::vector<XicCoordTims *>::iterator itXicListend =
97 xic_coord_tims_list.end();
98 qDebug();
99 TimsFrameCstSPtr frame_sptr =
101 qDebug();
102 double rtframe = frame_sptr.get()->getTime();
103 qDebug();
104
105 double rtbeginframe = rtframe - m_retentionTimeAroundTarget;
106 double rtendframe = rtframe + m_retentionTimeAroundTarget;
107
108 if(rtbeginframe < 0)
109 rtbeginframe = 0;
110
111 qDebug() << rtbeginframe;
112 while((itXicListbegin != itXicListend) &&
113 ((*itXicListbegin)->rtTarget < rtbeginframe))
114 {
115 itXicListbegin++;
116 }
117 qDebug();
118 itXicListend = itXicListbegin;
119 while((itXicListend != xic_coord_tims_list.end()) &&
120 ((*itXicListend)->rtTarget < rtendframe))
121 {
122 itXicListend++;
123 }
124 frame_sptr.get()->extractTimsXicListInRtRange(
125 itXicListbegin, itXicListend, m_xicExtractMethod);
126
127 qDebug() << "" << frame_sptr.get()->getId();
128 monitor.count();
129 if(monitor.shouldIstop())
130 {
132 QObject::tr("Xic extraction process interrupted"));
133 }
134 }
135 qDebug();
136}
TimsFrameCstSPtr getTimsFrameCstSPtrCached(std::size_t timsId)
get a Tims frame with his database ID but look in the cache first
std::vector< std::size_t > getTimsMS1FrameIdRange(double rt_begin, double rt_end) const
Definition timsdata.cpp:492
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:42
coordinates of the XIC to extract and the resulting XIC after extraction

References pappso::UiMonitorInterface::count(), pappso::UiMonitorInterface::setStatus(), pappso::UiMonitorInterface::setTotalSteps(), and pappso::UiMonitorInterface::shouldIstop().


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