|
OpenMS
2.6.0
|
Go to the documentation of this file.
37 #include <OpenMS/OPENSWATHALGO/OpenSwathAlgoConfig.h>
51 OPENSWATHALGO_DLLAPI
void normalize(
const std::vector<double>& intensities,
double normalization_factor, std::vector<double>& normalized_intensities);
60 for (; beg != end; ++beg)
69 std::unary_function<double, double>
81 template <
typename Texp,
typename Ttheo>
82 double dotProd(Texp intExpBeg, Texp intExpEnd, Ttheo intTheo)
84 std::vector<double> res(std::distance(intExpBeg, intExpEnd));
85 std::transform(intExpBeg, intExpEnd, intTheo, res.begin(), std::multiplies<double>());
86 double sum = std::accumulate(res.begin(), res.end(), 0.);
97 OPENSWATHALGO_DLLAPI
double dotprodScoring(std::vector<double> intExp, std::vector<double> theorint);
102 template <
typename Texp,
typename Ttheo>
106 for (std::size_t i = 0; itExpBeg < itExpEnd; ++itExpBeg, ++itTheo, ++i)
108 double x = *itExpBeg - *itTheo;
122 OPENSWATHALGO_DLLAPI
double manhattanScoring(std::vector<double> intExp, std::vector<double> theorint);
128 template <
typename TInputIterator,
typename TInputIteratorY>
129 typename std::iterator_traits<TInputIterator>::value_type
cor_pearson(
135 typedef typename std::iterator_traits<TInputIterator>::value_type value_type;
139 m1 = m2 = s1 = s2 = 0.0;
141 ptrdiff_t n = std::distance(xBeg, xEnd);
142 value_type nd = static_cast<value_type>(n);
143 for (; xBeg != xEnd; ++xBeg, ++yBeg)
145 corr += *xBeg * *yBeg;
156 if (s1 < 1.0e-12 || s2 < 1.0e-12)
160 corr -= m1 * m2 * (
double)n;
161 corr /= sqrt(s1 * s2);
176 m_(0.0), q_(0.0), c_(0u)
182 double const delta = sample - m_;
184 q_ += delta * (sample - m_);
189 return (c_ > 1u) ? (q_ / (c_ - 1)) : 0;
194 return (c_ > 1u) ? (q_ / c_) : 0;
199 return std::sqrt(sample_variance());
204 return std::sqrt(standard_variance());
219 return sample_variance();
224 return sample_stddev();
double standard_stddev() const
Definition: StatsHelpers.h:202
static double sum(IteratorType begin, IteratorType end)
Calculates the sum of a range of values.
Definition: StatisticFunctions.h:120
Definition: MRMScoring.h:49
Definition: StatsHelpers.h:68
std::iterator_traits< TInputIterator >::value_type cor_pearson(TInputIterator xBeg, TInputIterator xEnd, TInputIteratorY yBeg)
compute pearson correlation of vector x and y
Definition: StatsHelpers.h:129
double norm(T beg, T end)
compute the norm of the vector
Definition: StatsHelpers.h:57
OPENSWATHALGO_DLLAPI double dotprodScoring(std::vector< double > intExp, std::vector< double > theorint)
the dot product scoring
void operator()(double sample)
Definition: StatsHelpers.h:180
double operator()() const
Definition: StatsHelpers.h:227
double standard_variance() const
Definition: StatsHelpers.h:192
functor to compute the mean and stddev of sequence using the std::foreach algorithm
Definition: StatsHelpers.h:169
double q_
Definition: StatsHelpers.h:171
double sample_variance() const
Definition: StatsHelpers.h:187
unsigned long c_
Definition: StatsHelpers.h:172
double mean() const
Definition: StatsHelpers.h:207
double operator()(double x)
Definition: StatsHelpers.h:71
double result_type
Definition: StatsHelpers.h:174
double manhattanDist(Texp itExpBeg, Texp itExpEnd, Ttheo itTheo)
compute manhattan distance between Exp and Theo
Definition: StatsHelpers.h:103
double dotProd(Texp intExpBeg, Texp intExpEnd, Ttheo intTheo)
compute dotprod of vectors
Definition: StatsHelpers.h:82
OPENSWATHALGO_DLLAPI double manhattanScoring(std::vector< double > intExp, std::vector< double > theorint)
manhattan scoring
OPENSWATHALGO_DLLAPI void normalize(const std::vector< double > &intensities, double normalization_factor, std::vector< double > &normalized_intensities)
Normalize intensities in vector by normalization_factor.
unsigned long count() const
Definition: StatsHelpers.h:212
double stddev() const
Definition: StatsHelpers.h:222
double sample_stddev() const
Definition: StatsHelpers.h:197
mean_and_stddev()
Definition: StatsHelpers.h:175
double variance() const
Definition: StatsHelpers.h:217