3325 |
07 Oct 14 |
peter |
// $Id$ |
3325 |
07 Oct 14 |
peter |
2 |
|
3325 |
07 Oct 14 |
peter |
3 |
/* |
3325 |
07 Oct 14 |
peter |
Copyright (C) 2014 Peter Johansson |
3325 |
07 Oct 14 |
peter |
5 |
|
3325 |
07 Oct 14 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
3325 |
07 Oct 14 |
peter |
7 |
|
3325 |
07 Oct 14 |
peter |
The yat library is free software; you can redistribute it and/or |
3325 |
07 Oct 14 |
peter |
modify it under the terms of the GNU General Public License as |
3325 |
07 Oct 14 |
peter |
published by the Free Software Foundation; either version 3 of the |
3325 |
07 Oct 14 |
peter |
License, or (at your option) any later version. |
3325 |
07 Oct 14 |
peter |
12 |
|
3325 |
07 Oct 14 |
peter |
The yat library is distributed in the hope that it will be useful, |
3325 |
07 Oct 14 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
3325 |
07 Oct 14 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3325 |
07 Oct 14 |
peter |
General Public License for more details. |
3325 |
07 Oct 14 |
peter |
17 |
|
3325 |
07 Oct 14 |
peter |
You should have received a copy of the GNU General Public License |
3325 |
07 Oct 14 |
peter |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
3325 |
07 Oct 14 |
peter |
20 |
*/ |
3325 |
07 Oct 14 |
peter |
21 |
|
3325 |
07 Oct 14 |
peter |
22 |
#include <config.h> |
3325 |
07 Oct 14 |
peter |
23 |
|
3325 |
07 Oct 14 |
peter |
24 |
#include "phred.h" |
3325 |
07 Oct 14 |
peter |
25 |
|
3325 |
07 Oct 14 |
peter |
26 |
#include <cmath> |
3325 |
07 Oct 14 |
peter |
27 |
|
3325 |
07 Oct 14 |
peter |
28 |
namespace theplu { |
3325 |
07 Oct 14 |
peter |
29 |
namespace yat { |
3325 |
07 Oct 14 |
peter |
30 |
namespace omic { |
3325 |
07 Oct 14 |
peter |
31 |
|
3325 |
07 Oct 14 |
peter |
32 |
double phred(double p) |
3325 |
07 Oct 14 |
peter |
33 |
{ |
3325 |
07 Oct 14 |
peter |
34 |
return - 10 * std::log10(p); |
3325 |
07 Oct 14 |
peter |
35 |
} |
3325 |
07 Oct 14 |
peter |
36 |
|
3325 |
07 Oct 14 |
peter |
37 |
|
3325 |
07 Oct 14 |
peter |
38 |
double phred_inv(double x) |
3325 |
07 Oct 14 |
peter |
39 |
{ |
3325 |
07 Oct 14 |
peter |
40 |
return std::pow(10.0, -x/10.0); |
3325 |
07 Oct 14 |
peter |
41 |
} |
3325 |
07 Oct 14 |
peter |
42 |
|
3325 |
07 Oct 14 |
peter |
43 |
}}} |