42 #include "../../exception/exceptionnotrecognized.h"
52 double mean,
double std_dev,
double threshold)
61 const QString ¶meters)
98 const QString ¶meters)
101 if(parameters.startsWith(QString(
"%1|").arg(
name())))
103 QStringList params = parameters.split(
"|").back().split(
";");
113 "Building of FilterLowIntensitySignalRemoval from string %1 failed")
127 std::size_t trace_size = trace.size();
130 qDebug() <<
"The original trace has less than 3 points. Returning it "
131 "without modification.";
135 qDebug() <<
"The original trace has" << trace_size <<
"data points";
137 std::size_t index = 0;
142 qDebug() <<
"First trace point: "
143 <<
"(" << trace[
m_prev.first].x <<
"," <<
m_prev.second <<
");";
149 bool was_ascending_to_apex =
false;
151 ClusterSPtr cluster_sp = std::make_shared<Cluster>();
160 while(index < trace_size)
165 qDebug() <<
"Current trace point: "
166 <<
"(" << trace[
m_cur.first].x <<
"," <<
m_cur.second <<
");";
173 qDebug().noquote() <<
"We are ascending to an apex.\n";
174 was_ascending_to_apex =
true;
179 qDebug().noquote() <<
"Descending a peak. ";
188 if(!was_ascending_to_apex)
194 <<
"But, we were not ascending to an apex, so do nothing.\n";
201 <<
"And, we were ascending to an apex, so "
202 "m_curApeex becomes m_prev: ("
228 if(!cluster_sp->size())
229 qFatal(
"Cannot be that the cluster has no apex.");
234 <<
"There was a previous apex already, BUT "
235 "outside of cluster range. "
236 "Pushing the cooking cluster that has size:"
237 << cluster_sp->size();
240 cluster_sp = std::make_shared<Cluster>();
242 qDebug() <<
"Created a brand new cluster.";
250 cluster_sp->push_back(
251 std::make_shared<IndexIntensity>(
m_curApex));
254 <<
"Since the current apex is above the threshold, "
255 "we PUSH it to the newly created cluster: ("
261 qDebug() <<
"Set prev apex to be cur apex.";
266 <<
"Since the current apex is below the threshold, "
267 "we DO NOT push it to the newly created "
277 qDebug() <<
"Since the previous apex went to the "
278 "closed cluster, and cur apex has too "
279 "small an intensity, we reset prev apex "
280 "to std::pair(0, nan).";
294 cluster_sp->push_back(
295 std::make_shared<IndexIntensity>(
m_curApex));
298 <<
"There was an apex already inside of cluster "
300 "AND, since the current apex was above the "
301 "threshold, we indeed push it to cluster.\n";
303 qDebug().noquote() <<
"Current apex PUSHED: "
309 qDebug() <<
"We set prev apex to be cur apex.";
314 <<
"There was an apex already inside of cluster "
316 "BUT, since the current apex was below the "
317 "threshold, we do not push it to cluster.\n";
319 qDebug().noquote() <<
"Current apex NOT pushed: "
332 if(cluster_sp->size() != 0)
334 "At this point, the cluster should be new and "
337 cluster_sp->push_back(
338 std::make_shared<IndexIntensity>(
m_curApex));
341 <<
"No previous apex was found. Since current apex' "
342 "intensity is above threshold, we push it back to "
349 qDebug().noquote() <<
"And thus we store the current "
350 "apex as previous apex.\n";
355 <<
"No previous apex was found. Since current apex' "
356 "intensity is below threshold, we do nothing.\n";
365 was_ascending_to_apex =
false;
374 <<
"Preparing next round, with m_prev = m_cur and ++index.\n";
384 if(cluster_sp->size())
410 if(trace.size() <= 2)
412 qDebug() <<
"The original trace has less than 3 points. Returning it "
413 "without modification.";
417 qDebug() <<
"The original trace had" << trace.size() <<
"data points";
421 qDebug() <<
"Number of isotopic clusters: " << isotopic_cluster_count;
427 qDebug() <<
"iterating in new cluster.";
429 for(
auto &&apex_p : *apices_p)
432 DataPoint(trace[apex_p->first].x, apex_p->second);
434 qDebug() <<
"Current cluster data point:" << data_point.
toString();
436 final_trace.push_back(data_point);
440 trace = std::move(final_trace);
457 return QString(
"%1|%2").arg(
name()).arg(QString::number(
m_threshold,
'f', 2));
464 return "FilterLowIntensitySignalRemoval";
excetion to use when an item type is not recognized
Redefines the floor intensity of the Trace.
std::size_t detectIsotopicClusters(const Trace &trace)
Trace & nonConstFilter(Trace &data_points)
std::shared_ptr< std::vector< ApexSPtr > > ClusterSPtr
QString name() const override
FilterLowIntensitySignalRemoval(double mean, double std_dev, double threshold)
std::pair< std::size_t, double > IndexIntensity
std::vector< ClusterSPtr > m_isotopicClusters
double getThreshold() const
Trace & filter(Trace &data_points) const override
constexpr static double INTRA_CLUSTER_INTER_PEAK_DISTANCE
FilterLowIntensitySignalRemoval & operator=(const FilterLowIntensitySignalRemoval &other)
virtual ~FilterLowIntensitySignalRemoval()
void buildFilterFromString(const QString &strBuildParams) override
build this filter using a string
QString toString() const override
Return a string with the textual representation of the configuration data.
IndexIntensity m_prevApex
A simple container of DataPoint instances.
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...