libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::MsRunXicExtractorInterface Class Referenceabstract

#include <msrunxicextractorinterface.h>

Inheritance diagram for pappso::MsRunXicExtractorInterface:
pappso::MsRunXicExtractor pappso::TimsXicExtractorInterface pappso::MsRunXicExtractorDisk pappso::TimsDirectXicExtractor pappso::MsRunXicExtractorDiskBuffer

Public Member Functions

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

 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
virtual void protectedExtractXicCoordSPtrList (UiMonitorInterface &monitor, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_begin, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_end)=0

Protected Attributes

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

Definition at line 44 of file msrunxicextractorinterface.h.

Constructor & Destructor Documentation

◆ MsRunXicExtractorInterface() [1/2]

pappso::MsRunXicExtractorInterface::MsRunXicExtractorInterface ( MsRunReaderSPtr & msrun_reader)
protected

◆ MsRunXicExtractorInterface() [2/2]

pappso::MsRunXicExtractorInterface::MsRunXicExtractorInterface ( const MsRunXicExtractorInterface & other)
protected

Definition at line 46 of file msrunxicextractorinterface.cpp.

47 : msp_msrun_reader(other.msp_msrun_reader)
48{
49 m_xicExtractMethod = other.m_xicExtractMethod;
50}

References MsRunXicExtractorInterface(), m_xicExtractMethod, and msp_msrun_reader.

◆ ~MsRunXicExtractorInterface()

pappso::MsRunXicExtractorInterface::~MsRunXicExtractorInterface ( )
protectedvirtual

Definition at line 52 of file msrunxicextractorinterface.cpp.

53{
54}

Member Function Documentation

◆ extractXicCoordSPtrList()

void pappso::MsRunXicExtractorInterface::extractXicCoordSPtrList ( UiMonitorInterface & monitor,
std::vector< XicCoordSPtr > & xic_coord_list )
finalvirtual

extract a list of XIC given a list of xic coordinates to extract

XicCoord is a vessel containing the xic to fill and coordinates of this XIC in the MS run

Parameters
monitorprocess monitoring
xic_coord_listlist of xic coordinates to extract. The order of xic coordinates may change.

Definition at line 172 of file msrunxicextractorinterface.cpp.

174{
175 qDebug() << xic_coord_list.size();
176 monitor.setStatus(QObject::tr("extracting %1 XICs").arg(xic_coord_list.size()));
177 monitor.setTotalSteps(xic_coord_list.size());
178 protectedExtractXicCoordSPtrList(monitor, xic_coord_list.begin(), xic_coord_list.end());
179 monitor.setTotalSteps(0);
180 postExtractionProcess(monitor, xic_coord_list.begin(), xic_coord_list.end());
181}
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
virtual void protectedExtractXicCoordSPtrList(UiMonitorInterface &monitor, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_begin, std::vector< XicCoordSPtr >::iterator it_xic_coord_list_end)=0

References postExtractionProcess(), protectedExtractXicCoordSPtrList(), pappso::UiMonitorInterface::setStatus(), and pappso::UiMonitorInterface::setTotalSteps().

Referenced by extractXicCoordSPtrListParallelized().

◆ extractXicCoordSPtrListParallelized()

void pappso::MsRunXicExtractorInterface::extractXicCoordSPtrListParallelized ( UiMonitorInterface & monitor,
std::vector< XicCoordSPtr > & xic_coord_list )
finalvirtual

multithreaded XIC extraction

divide xic_coord_list and run extractXicCoordSPtrList separated threads

Parameters
monitorprocess monitoring
xic_coord_listlist of xic coordinates to extract. The order of xic coordinates may change.

Definition at line 89 of file msrunxicextractorinterface.cpp.

91{
92 qDebug();
93 // get the number of available threads :
94 int number_of_threads = QThreadPool::globalInstance()->maxThreadCount();
95
96 if(number_of_threads == 1)
97 {
98 extractXicCoordSPtrList(monitor, xic_coord_list);
99 }
100 else
101 {
102 monitor.setStatus(
103 QObject::tr("parallelized extraction of %1 XICs").arg(xic_coord_list.size()));
104
105 std::size_t chunck_size = xic_coord_list.size() / number_of_threads;
106 chunck_size += 1;
107 if(chunck_size < 1000)
108 chunck_size = 1000;
109
110 struct parallelExtractChunck
111 {
112 std::vector<XicCoordSPtr>::iterator it_xic_coord_begin;
113 std::vector<XicCoordSPtr>::iterator it_xic_coord_end;
114 };
115
116 std::vector<parallelExtractChunck> chunck_list;
117 qDebug();
118 for(auto it = xic_coord_list.begin(); it != xic_coord_list.end();)
119 {
120 qDebug() << "chunck_size=" << chunck_size;
121 parallelExtractChunck chunck;
122 chunck.it_xic_coord_begin = it;
123 for(std::size_t i = 0; i < chunck_size && it != xic_coord_list.end(); i++)
124 {
125 it++;
126 }
127 chunck.it_xic_coord_end = it;
128 chunck_list.push_back(chunck);
129 }
130 qDebug();
131 auto self = this;
132
133 qDebug();
134 std::function<std::size_t(const parallelExtractChunck &)> extractChunck =
135 [self](const parallelExtractChunck &extract_chunck) {
136 qDebug();
137 UiMonitorVoid monitor;
138 self->protectedExtractXicCoordSPtrList(
139 monitor, extract_chunck.it_xic_coord_begin, extract_chunck.it_xic_coord_end);
140 self->postExtractionProcess(
141 monitor, extract_chunck.it_xic_coord_begin, extract_chunck.it_xic_coord_end);
142 qDebug();
143 return 1;
144 };
145 qDebug();
146 monitor.setTotalSteps(chunck_list.size());
147 UiMonitorInterface *monitorRef = &monitor;
148 std::function<void(std::size_t &result, const std::size_t &value)> monitorExtract2 =
149 [monitorRef](std::size_t &result [[maybe_unused]],
150 const std::size_t &value [[maybe_unused]]) { monitorRef->count(); };
151 qDebug();
152
153 QFuture<std::size_t> res =
154 QtConcurrent::mappedReduced<std::size_t>(chunck_list.begin(),
155 chunck_list.end(),
156 extractChunck,
157 monitorExtract2,
158 QtConcurrent::UnorderedReduce);
159 qDebug();
160
161 /*
162 QFuture<std::size_t> res =
163 QtConcurrent::mapped(chunck_list.begin(), chunck_list.end(),
164 extractChunck);
165 */
166 res.waitForFinished();
167 monitor.setTotalSteps(0);
168 }
169}
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

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

◆ getMsRunId()

const MsRunIdCstSPtr & pappso::MsRunXicExtractorInterface::getMsRunId ( ) const

Definition at line 69 of file msrunxicextractorinterface.cpp.

70{
71 return msp_msrun_reader.get()->getMsRunId();
72}

References msp_msrun_reader.

◆ getMsRunReaderSPtr()

const MsRunReaderSPtr & pappso::MsRunXicExtractorInterface::getMsRunReaderSPtr ( ) const

get the msrunreader currently used for XIC extraction

Definition at line 75 of file msrunxicextractorinterface.cpp.

76{
77 return msp_msrun_reader;
78}

References msp_msrun_reader.

◆ postExtractionProcess()

void pappso::MsRunXicExtractorInterface::postExtractionProcess ( UiMonitorInterface & monitor,
std::vector< XicCoordSPtr >::iterator it_xic_coord_list_begin,
std::vector< XicCoordSPtr >::iterator it_xic_coord_list_end )
protectedvirtual

possible post extraction process, eventually trace filters

Definition at line 184 of file msrunxicextractorinterface.cpp.

188{
189
190 if(mcsp_postExtractionTraceFilter != nullptr)
191 {
192 monitor.setStatus(QObject::tr("filtering %1 XICs")
193 .arg(std::distance(it_xic_coord_list_begin, it_xic_coord_list_end)));
194 for(auto it = it_xic_coord_list_begin; it != it_xic_coord_list_end; it++)
195 {
196 mcsp_postExtractionTraceFilter.get()->filter(*(it->get()->xicSptr.get()));
197 }
198 }
199}
pappso::FilterInterfaceCstSPtr mcsp_postExtractionTraceFilter

References mcsp_postExtractionTraceFilter, and pappso::UiMonitorInterface::setStatus().

Referenced by extractXicCoordSPtrList().

◆ protectedExtractXicCoordSPtrList()

virtual void pappso::MsRunXicExtractorInterface::protectedExtractXicCoordSPtrList ( UiMonitorInterface & monitor,
std::vector< XicCoordSPtr >::iterator it_xic_coord_list_begin,
std::vector< XicCoordSPtr >::iterator it_xic_coord_list_end )
protectedpure virtual

◆ setPostExtractionTraceFilterCstSPtr()

void pappso::MsRunXicExtractorInterface::setPostExtractionTraceFilterCstSPtr ( pappso::FilterInterfaceCstSPtr & filter)

filter interface to apply just after XIC extration on each trace

Definition at line 81 of file msrunxicextractorinterface.cpp.

83{
85}
@ filter
concerning filters (psm, peptide, protein validation)

References pappso::filter, and mcsp_postExtractionTraceFilter.

◆ setRetentionTimeAroundTarget()

void pappso::MsRunXicExtractorInterface::setRetentionTimeAroundTarget ( double range_in_seconds)

set the retention time range in seconds around the target rt

only the interesting part of the xic will be extracted, form the rt target

  • range_in_seconds to rt target + range in seconds by default, all the LC run time is extracted
Parameters
range_in_secondsrange in seconds

Definition at line 63 of file msrunxicextractorinterface.cpp.

References m_retentionTimeAroundTarget.

◆ setXicExtractMethod()

void pappso::MsRunXicExtractorInterface::setXicExtractMethod ( Enums::XicExtractMethod method)

set the XIC extraction method

Definition at line 57 of file msrunxicextractorinterface.cpp.

58{
59 m_xicExtractMethod = method;
60}

References m_xicExtractMethod.

Member Data Documentation

◆ m_retentionTimeAroundTarget

double pappso::MsRunXicExtractorInterface::m_retentionTimeAroundTarget = std::numeric_limits<double>::max()
protected

◆ m_xicExtractMethod

◆ mcsp_postExtractionTraceFilter

pappso::FilterInterfaceCstSPtr pappso::MsRunXicExtractorInterface::mcsp_postExtractionTraceFilter = nullptr
protected

◆ msp_msrun_reader


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