35 #ifndef OPENMS_ANALYSIS_OPENSWATH_OPENSWATHALGO_ALGO_STATSHELPERS_H 
   36 #define OPENMS_ANALYSIS_OPENSWATH_OPENSWATHALGO_ALGO_STATSHELPERS_H 
   41 #include <boost/bind.hpp> 
   46 #include <OpenMS/ANALYSIS/OPENSWATH/OPENSWATHALGO/OpenSwathAlgoConfig.h> 
   56   OPENSWATHALGO_DLLAPI 
void normalize(
const std::vector<double>& intensities, 
double normalization_factor, std::vector<double>& normalized_intensities);
 
   65     for (; beg != end; ++beg)
 
   74     std::unary_function<double, double>
 
   86   template <
typename Texp, 
typename Ttheo>
 
   87   double dotProd(Texp intExpBeg, Texp intExpEnd, Ttheo intTheo)
 
   89     std::vector<double> res(std::distance(intExpBeg, intExpEnd));
 
   90     std::transform(intExpBeg, intExpEnd, intTheo, res.begin(), std::multiplies<double>());
 
   91     double sum = std::accumulate(res.begin(), res.end(), 0.);
 
  102   OPENSWATHALGO_DLLAPI 
double dotprodScoring(std::vector<double> intExp, std::vector<double> theorint);
 
  107   template <
typename Texp, 
typename Ttheo>
 
  111     for (std::size_t i = 0; itExpBeg < itExpEnd; ++itExpBeg, ++itTheo, ++i)
 
  113       double x = *itExpBeg - *itTheo;
 
  127   OPENSWATHALGO_DLLAPI 
double manhattanScoring(std::vector<double> intExp, std::vector<double> theorint);
 
  133   template <
typename TInputIterator, 
typename TInputIteratorY>
 
  134   typename std::iterator_traits<TInputIterator>::value_type 
cor_pearson(
 
  140     typedef typename std::iterator_traits<TInputIterator>::value_type value_type;
 
  144     m1 = m2 = s1 = s2 = 0.0;
 
  146     ptrdiff_t n = std::distance(xBeg, xEnd);
 
  147     value_type nd = 
static_cast<value_type
>(n);
 
  148     for (; xBeg != xEnd; ++xBeg, ++yBeg)
 
  150       corr += *xBeg * *yBeg;
 
  161     if (s1 < 1.0e-12 || s2 < 1.0e-12)
 
  165       corr -= m1 * m2 * (
double)n;
 
  166       corr /= sqrt(s1 * s2);
 
  181       m_(0.0), q_(0.0), c_(0u)
 
  187       double const delta = sample - m_;
 
  189       q_ += delta * (sample - m_);
 
  194       return (c_ > 1u) ? (q_ / (c_ - 1)) : 0;
 
  199       return (c_ > 1u) ? (q_ / c_) : 0;
 
  204       return std::sqrt(sample_variance());
 
  209       return std::sqrt(standard_variance());
 
  224       return sample_variance();
 
  229       return sample_stddev();
 
  241 #endif // OPENMS_ANALYSIS_OPENSWATH_OPENSWATHALGO_ALGO_STATSHELPERS_H 
double manhattanDist(Texp itExpBeg, Texp itExpEnd, Ttheo itTheo)
compute manhattan distance between Exp and Theo 
Definition: StatsHelpers.h:108
OPENSWATHALGO_DLLAPI double manhattanScoring(std::vector< double > intExp, std::vector< double > theorint)
manhattan scoring 
static DoubleReal sum(IteratorType begin, IteratorType end)
Calculates the sum of a range of values. 
Definition: StatisticFunctions.h:56
double sample_variance() const 
Definition: StatsHelpers.h:192
OPENSWATHALGO_DLLAPI double dotprodScoring(std::vector< double > intExp, std::vector< double > theorint)
the dot product scoring 
void operator()(double sample)
Definition: StatsHelpers.h:185
double mean() const 
Definition: StatsHelpers.h:212
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 c_
Definition: StatsHelpers.h:177
double variance() const 
Definition: StatsHelpers.h:222
unsigned long count() const 
Definition: StatsHelpers.h:217
mean_and_stddev()
Definition: StatsHelpers.h:180
double q_
Definition: StatsHelpers.h:176
double sample_stddev() const 
Definition: StatsHelpers.h:202
Definition: StatsHelpers.h:73
double standard_stddev() const 
Definition: StatsHelpers.h:207
double stddev() const 
Definition: StatsHelpers.h:227
functor to compute the mean and stddev of sequence using the std::foreach algorithm ...
Definition: StatsHelpers.h:174
std::iterator_traits< TInputIterator >::value_type cor_pearson(TInputIterator xBeg, TInputIterator xEnd, TInputIteratorY yBeg)
compute prearson correlation of vector x and y 
Definition: StatsHelpers.h:134
double standard_variance() const 
Definition: StatsHelpers.h:197
double norm(T beg, T end)
compute the norm of the vector 
Definition: StatsHelpers.h:62
double dotProd(Texp intExpBeg, Texp intExpEnd, Ttheo intTheo)
compute dotprod of vecotrs 
Definition: StatsHelpers.h:87
double result_type
Definition: StatsHelpers.h:179
double operator()(double x)
Definition: StatsHelpers.h:76
double operator()() const 
Definition: StatsHelpers.h:232