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

#include <msrunreadconfig.h>

Public Member Functions

 MsRunReadConfig ()
 
 MsRunReadConfig (const MsRunReadConfig &other)
 
 ~MsRunReadConfig ()
 
MsRunReadConfigoperator= (const MsRunReadConfig &other)
 
void setRetentionTimeStartInSeconds (double retention_time_start_in_seconds)
 
double getRetentionTimeStartInSeconds () const
 
void setRetentionTimeEndInSeconds (double retention_time_end_in_seconds)
 
double getRetentionTimeEndInSeconds () const
 
void setMsLevels (std::vector< std::size_t > ms_levels)
 
const bool * getMsLevels () const
 
QString getMsLevelsAsString () const
 
void setNeedPeakList (bool need_peak_list)
 
bool needPeakList () const
 
void setParameterValue (MsRunReadConfigParameter parameter, const QVariant &value)
 
const QVariant getParameterValue (MsRunReadConfigParameter parameter) const
 
void reset ()
 
QString toString () const
 
bool acceptMsLevel (std::size_t ms_level) const
 
bool acceptRetentionTimeInSeconds (double retention_time_in_seconds) const
 

Private Attributes

double m_retentionTimeStartSeconds = -1
 
double m_retentionTimeEndSeconds = -1
 
bool m_isPeakListNeeded = true
 
bool m_msLevels [MAX_MS_LEVELS] = {false}
 
std::map< MsRunReadConfigParameter, QVariant > m_paramsMap
 map containing any parameter value
 

Detailed Description

Definition at line 71 of file msrunreadconfig.h.

Constructor & Destructor Documentation

◆ MsRunReadConfig() [1/2]

pappso::MsRunReadConfig::MsRunReadConfig ( )

Definition at line 28 of file msrunreadconfig.cpp.

29{
30 // Set these two levels to true by default.
31 m_msLevels[1] = true;
32 m_msLevels[2] = true;
33}
bool m_msLevels[MAX_MS_LEVELS]

References m_msLevels.

◆ MsRunReadConfig() [2/2]

pappso::MsRunReadConfig::MsRunReadConfig ( const MsRunReadConfig other)

Definition at line 35 of file msrunreadconfig.cpp.

36 : m_retentionTimeStartSeconds(other.m_retentionTimeStartSeconds),
37 m_retentionTimeEndSeconds(other.m_retentionTimeEndSeconds),
38 m_paramsMap(other.m_paramsMap)
39{
40 for(std::size_t index = 0; index < MAX_MS_LEVELS; ++index)
41 m_msLevels[index] = other.m_msLevels[index];
42}
std::map< MsRunReadConfigParameter, QVariant > m_paramsMap
map containing any parameter value
constexpr std::size_t MAX_MS_LEVELS

References m_msLevels, and pappso::MAX_MS_LEVELS.

◆ ~MsRunReadConfig()

pappso::MsRunReadConfig::~MsRunReadConfig ( )

Definition at line 44 of file msrunreadconfig.cpp.

45{
46}

Member Function Documentation

◆ acceptMsLevel()

bool pappso::MsRunReadConfig::acceptMsLevel ( std::size_t  ms_level) const

◆ acceptRetentionTimeInSeconds()

bool pappso::MsRunReadConfig::acceptRetentionTimeInSeconds ( double  retention_time_in_seconds) const

Definition at line 144 of file msrunreadconfig.cpp.

146{
147 // qDebug() << "Requested retention_time_in_seconds:"
148 // << retention_time_in_seconds;
149
150 // Whatever the member datum below, if it is equal to -1
151 // then that means that RT is not a selection criterion.
153 {
154 return true;
155 }
156
157 // We use inclusive RT ranges.
158 if(retention_time_in_seconds >= m_retentionTimeStartSeconds)
159 {
160 if(retention_time_in_seconds <= m_retentionTimeEndSeconds)
161 {
162 return true;
163 }
164 }
165
166 return false;
167}

References m_retentionTimeEndSeconds, and m_retentionTimeStartSeconds.

Referenced by pappso::TimsFramesMsRunReader::readSpectrumCollection2(), pappso::TimsMsRunReader::readSpectrumCollection2(), and pappso::PwizMsRunReader::readSpectrumCollectionWithMsrunReadConfig().

◆ getMsLevels()

const bool * pappso::MsRunReadConfig::getMsLevels ( void  ) const

Definition at line 114 of file msrunreadconfig.cpp.

115{
116 return m_msLevels;
117}

References m_msLevels.

◆ getMsLevelsAsString()

QString pappso::MsRunReadConfig::getMsLevelsAsString ( ) const

Definition at line 120 of file msrunreadconfig.cpp.

121{
122 QString text = "";
123
124 for(std::size_t index = 0; index < MAX_MS_LEVELS; ++index)
125 {
126 if(m_msLevels[index] == true)
127 text += QString("%1 ").arg(index);
128 }
129
130 return text;
131}

References m_msLevels, and pappso::MAX_MS_LEVELS.

◆ getParameterValue()

const QVariant pappso::MsRunReadConfig::getParameterValue ( pappso::MsRunReadConfigParameter  parameter) const

Definition at line 196 of file msrunreadconfig.cpp.

198{
199 auto it = m_paramsMap.find(parameter);
200 if(it == m_paramsMap.end())
201 {
202 return QVariant();
203 }
204 else
205 {
206 return it->second;
207 }
208}

References m_paramsMap.

Referenced by pappso::TimsFramesMsRunReader::readSpectrumCollection2(), pappso::TimsMsRunReader::readSpectrumCollection2(), and toString().

◆ getRetentionTimeEndInSeconds()

double pappso::MsRunReadConfig::getRetentionTimeEndInSeconds ( ) const

Definition at line 85 of file msrunreadconfig.cpp.

86{
88}

References m_retentionTimeEndSeconds.

◆ getRetentionTimeStartInSeconds()

double pappso::MsRunReadConfig::getRetentionTimeStartInSeconds ( ) const

Definition at line 72 of file msrunreadconfig.cpp.

73{
75}

References m_retentionTimeStartSeconds.

◆ needPeakList()

◆ operator=()

MsRunReadConfig & pappso::MsRunReadConfig::operator= ( const MsRunReadConfig other)

Definition at line 49 of file msrunreadconfig.cpp.

50{
51 if(&other == this)
52 return *this;
53
54 m_retentionTimeStartSeconds = other.m_retentionTimeStartSeconds;
55 m_retentionTimeEndSeconds = other.m_retentionTimeEndSeconds;
56 m_paramsMap = other.m_paramsMap;
57
58 for(std::size_t index = 0; index < MAX_MS_LEVELS; ++index)
59 m_msLevels[index] = other.m_msLevels[index];
60
61 return *this;
62}

References m_msLevels, m_paramsMap, m_retentionTimeEndSeconds, m_retentionTimeStartSeconds, and pappso::MAX_MS_LEVELS.

◆ reset()

void pappso::MsRunReadConfig::reset ( )

Definition at line 212 of file msrunreadconfig.cpp.

213{
216 m_isPeakListNeeded = true;
217
218 for(std::size_t index = 0; index < MAX_MS_LEVELS; ++index)
219 {
220 m_msLevels[index] = false;
221 }
222 // Set these two levels to true by default.
223 m_msLevels[1] = true;
224 m_msLevels[2] = true;
225
226 m_paramsMap.clear();
227}

References m_isPeakListNeeded, m_msLevels, m_paramsMap, m_retentionTimeEndSeconds, m_retentionTimeStartSeconds, and pappso::MAX_MS_LEVELS.

◆ setMsLevels()

void pappso::MsRunReadConfig::setMsLevels ( std::vector< std::size_t >  ms_levels)

Definition at line 91 of file msrunreadconfig.cpp.

92{
93 // First reset all the levels to false, this time, since we'll fill the array
94 // with explicit values.
95 for(std::size_t index = 0; index < MAX_MS_LEVELS; ++index)
96 m_msLevels[index] = false;
97
98 // And now actually fill with true values the proper array cells.
99 for(auto ms_level : ms_levels)
100 {
101 if(ms_level >= MAX_MS_LEVELS)
102 {
103 qDebug() << "The passed vector of MS levels holds a value that is "
104 "not correct:"
105 << ms_level << ": skipping it.";
106
107 continue;
108 }
109 m_msLevels[ms_level] = true;
110 }
111}

References m_msLevels, and pappso::MAX_MS_LEVELS.

Referenced by pappso::MsRunReader::getRetentionTimeLine().

◆ setNeedPeakList()

void pappso::MsRunReadConfig::setNeedPeakList ( bool  need_peak_list)

Definition at line 176 of file msrunreadconfig.cpp.

177{
178 m_isPeakListNeeded = need_peak_list;
179}

References m_isPeakListNeeded.

Referenced by pappso::MsRunReader::getRetentionTimeLine().

◆ setParameterValue()

void pappso::MsRunReadConfig::setParameterValue ( pappso::MsRunReadConfigParameter  parameter,
const QVariant &  value 
)

Definition at line 182 of file msrunreadconfig.cpp.

184{
185
186 auto ret = m_paramsMap.insert(
187 std::pair<MsRunReadConfigParameter, QVariant>(parameter, value));
188
189 if(ret.second == false)
190 {
191 ret.first->second = value;
192 }
193}

References m_paramsMap.

◆ setRetentionTimeEndInSeconds()

void pappso::MsRunReadConfig::setRetentionTimeEndInSeconds ( double  retention_time_end_in_seconds)

Definition at line 78 of file msrunreadconfig.cpp.

80{
81 m_retentionTimeEndSeconds = retention_time_end_in_seconds;
82}

References m_retentionTimeEndSeconds.

◆ setRetentionTimeStartInSeconds()

void pappso::MsRunReadConfig::setRetentionTimeStartInSeconds ( double  retention_time_start_in_seconds)

Definition at line 65 of file msrunreadconfig.cpp.

67{
68 m_retentionTimeStartSeconds = retention_time_start_in_seconds;
69}

References m_retentionTimeStartSeconds.

◆ toString()

QString pappso::MsRunReadConfig::toString ( ) const

Definition at line 230 of file msrunreadconfig.cpp.

231{
232 QString text = QString("MsRunReadConfig\n: RT start: %1, RT end: %2\n")
235
236 text += "MS level(s): ";
237
238 for(std::size_t index = 0; index < MAX_MS_LEVELS; ++index)
239 {
240 if(m_msLevels[index] == true)
241 text += QString("%1 ").arg(index);
242 }
243
244 text += " \n";
245
248 .isNull())
249 {
250 text +=
251 QString("Mobility index range: [%1-%2]\n")
254 .toUInt())
257 .toUInt());
258 }
259
262 .isNull())
263 {
264 text += QString("Mobility 1/K0 range: [%1-%2]\n")
268 .toDouble())
272 .toDouble());
273 }
274
277 .isNull())
278 {
279 text += QString("m/z range: [%1-%2]\n")
282 .toDouble())
285 .toDouble());
286 }
287
290 .isNull())
291 {
292 text +=
293 QString("m/z merge window %1\n")
296 .toUInt());
297 }
298
299 return text;
300}
const QVariant getParameterValue(MsRunReadConfigParameter parameter) const
MsRunReadConfigParameter

References getParameterValue(), m_msLevels, m_retentionTimeEndSeconds, m_retentionTimeStartSeconds, pappso::MAX_MS_LEVELS, pappso::TimsFramesMsRunReader_mobility_index_begin, pappso::TimsFramesMsRunReader_mobility_index_end, pappso::TimsFramesMsRunReader_mobility_one_over_k0_begin, pappso::TimsFramesMsRunReader_mobility_one_over_k0_end, pappso::TimsFramesMsRunReader_mz_begin, pappso::TimsFramesMsRunReader_mz_end, and pappso::TimsFramesMsRunReader_mz_index_merge_window.

Referenced by pappso::TimsFramesMsRunReader::readSpectrumCollection2(), and pappso::TimsMsRunReader::readSpectrumCollection2().

Member Data Documentation

◆ m_isPeakListNeeded

bool pappso::MsRunReadConfig::m_isPeakListNeeded = true
private

Definition at line 110 of file msrunreadconfig.h.

Referenced by needPeakList(), reset(), and setNeedPeakList().

◆ m_msLevels

bool pappso::MsRunReadConfig::m_msLevels[MAX_MS_LEVELS] = {false}
private

◆ m_paramsMap

std::map<MsRunReadConfigParameter, QVariant> pappso::MsRunReadConfig::m_paramsMap
private

map containing any parameter value

Definition at line 120 of file msrunreadconfig.h.

Referenced by getParameterValue(), operator=(), reset(), and setParameterValue().

◆ m_retentionTimeEndSeconds

double pappso::MsRunReadConfig::m_retentionTimeEndSeconds = -1
private

◆ m_retentionTimeStartSeconds

double pappso::MsRunReadConfig::m_retentionTimeStartSeconds = -1
private

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