Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_quant_stats.hpp
1/*
2##############################################################################
3# file: ms_quant_stats.hpp #
4# 'msparser' toolkit #
5# Statistics routines and distributions for peptide and protein quantitation #
6##############################################################################
7# COPYRIGHT NOTICE #
8# Copyright 1998-2012 Matrix Science Limited All Rights Reserved. #
9# #
10##############################################################################
11# $Author: villek@matrixscience.com $ #
12# $Date: 2018-07-30 16:23:53 +0100 $ #
13# $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
14# $NoKeywords:: $ #
15##############################################################################
16*/
17
18#ifndef MS_QUANT_STATS_HPP
19#define MS_QUANT_STATS_HPP
20
21
22#include <deque>
23#include <string>
24#include <vector>
25
26namespace matrix_science {
27
34
43 class MS_MASCOTRESFILE_API ms_quant_stats
44 {
45 public:
46#ifndef SWIG
48 static void detectOutliers(const std::vector<double> &sample, std::string outlierMethod, unsigned int * const numLow, unsigned int * const numHigh);
49
51 static void detectOutliers(const std::vector<double> &sample, std::string outlierMethod, double sigLevel, unsigned int * const numLow, unsigned int * const numHigh);
52
54 static void testRosners(const std::vector<double> &sample, unsigned int maxOutliers, double sigLevel, unsigned int * const numLow, unsigned int * const numHigh);
55#else // SWIG Multiple return values
56 static void detectOutliers(const std::vector<double> &sample, std::string outlierMethod, unsigned int * const OUTPUT, unsigned int * const OUTPUT);
57 static void detectOutliers(const std::vector<double> &sample, std::string outlierMethod, double sigLevel, unsigned int * const OUTPUT, unsigned int * const OUTPUT);
58 static void testRosners(const std::vector<double> &sample, unsigned int maxOutliers, double sigLevel, unsigned int * const OUTPUT, unsigned int * const OUTPUT);
59#endif
60
62 static int testDixonsN9(unsigned long sampleSize, double min, double x2, double xn_1, double max, double sigLevel);
63
65 static int testGrubbsN2(unsigned long sampleSize, double min, double mean, double max, double stdev, double sigLevel);
66#ifndef SWIG
68 static bool testShapiroWilkW(const std::vector<double> &sample, double * const W, double * const pValue);
69#else // SWIG Multiple return values
70 static bool testShapiroWilkW(const std::vector<double> &sample, double * const OUTPUT, double * const OUTPUT);
71#endif
73 static double binomialCoefficient(unsigned int n, unsigned int k);
74
76 static double sum(const std::vector<double> &data);
77
79 static double sumsq(const std::vector<double> &data);
80
82 static std::vector<double> meanCentre(const std::vector<double> &data, double mean);
83
85 static std::vector<double> logTransform(const std::vector<double> &data);
86
88 static std::vector<double> expTransform(const std::vector<double> &logData);
89
91 static double sortedMedian(const std::vector<double> &data);
92
94 static double sortedMedian(const std::deque<double> &data);
95
97 static double unsortedMedian(const std::vector<double> &data);
98
100 static double arithmeticMean(const std::vector<double> &data);
101
103 static double weightedArithmeticMean(const std::vector<double> &data, const std::vector<double> &weights);
104
106 static double geometricMean(const std::vector<double> &data);
107
109 static double weightedGeometricMean(const std::vector<double> &data, const std::vector<double> &weights);
110
112 static double arithmeticStandardDeviation(const std::vector<double> &data, double arithmeticMean);
113
115 static double arithmeticStandardErrorOfMean(double arithmeticStdev, unsigned long sampleSize);
116
118 static double geometricStandardDeviation(const std::vector<double> &data, double geometricMean);
119
121 static double arithmeticStandardErrorOfMedian(double arithmeticStdev, unsigned long sampleSize);
122
124 static double weightedArithmeticStandardDeviation(const std::vector<double> &data, const std::vector<double> &weights, double weightedMean);
125
127 static double weightedArithmeticStandardError(const std::vector<double> &weights, double weightedStdev, unsigned long sampleSize);
128
130 static double weightedGeometricStandardDeviation(const std::vector<double> &data, const std::vector<double> &weights, double weightedMean);
131
133 static double normalCumulativeProbability(double x0);
134
136 static double normalCriticalValue(double p);
137
139 static double studentsCriticalValue(unsigned int df, double sigLevel);
140
142 static double chisqUpperCriticalValue(unsigned int df, double sigLevel);
143
145 static double chisqLowerCriticalValue(unsigned int df, double sigLevel);
146
148 static double snedecorsCriticalValue(unsigned int df1, unsigned int df2, double sigLevel);
149
151 static double calculateNormalMeanPvalue(double populationMean, double mean, double stdev, unsigned long sampleSize);
152
154 static double calculateNormalMedianPvalue(double populationMedian, double median, double stdev, unsigned long sampleSize);
155
157 static double calculateNormalWeightedPvalue(double populationMean, double weightedMean, const std::vector<double> &weights, double weightedStdev, unsigned long sampleSize);
158
160 static double medianStandardErrorCorrection(unsigned long sampleSize);
161
163 static double poissonDensity(double lambda, unsigned int k);
164
165 private:
166 // No instances.
169
170 // No copying.
171 ms_quant_stats(const ms_quant_stats& src);
172 ms_quant_stats& operator=(const ms_quant_stats& right);
173 }; // end of quantitation_group
175} // matrix_science namespace
176
177#endif // MS_QUANT_STATS_HPP
178
179/*------------------------------- End of File -------------------------------*/
Mathematical and statistical routines for peptide and protein quantitation.
Definition: ms_quant_stats.hpp:44