NCBI C++ ToolKit
sls_pvalues.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: sls_pvalues.hpp 45488 2010-04-21 13:14:53Z boratyng $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's offical duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================*/
25 
26 /*****************************************************************************
27 
28 File name: sls_pvalues.hpp
29 
30 Author: Sergey Sheetlin
31 
32 Contents: P-values calculation routines
33 
34 ******************************************************************************/
35 
36 #ifndef ALGO_BLAST_GUMBEL_PARAMS__INCLUDED_SLS_PVALUES
37 #define ALGO_BLAST_GUMBEL_PARAMS__INCLUDED_SLS_PVALUES
38 
39 /*****************************************************************************
40 
41 ********************** P-VALUES CALCULATION ROUTINES *************************
42 
43 *****************************************************************************/
44 
45 #include <corelib/ncbistl.hpp>
46 #include <corelib/ncbitype.h>
47 #include <corelib/ncbi_limits.h>
48 
49 #include <vector>
50 #include <string>
51 
53 
54 
56 BEGIN_SCOPE(blast)
57 
58 BEGIN_SCOPE(Sls)
59 
61  {
62  double lambda;
63  double lambda_error;
64 
65  double C;
66  double C_error;
67 
68 
69  double K;
70  double K_error;
71 
72  double a_I;
73  double a_I_error;
74 
75  double a_J;
76  double a_J_error;
77 
78  double sigma;
79  double sigma_error;
80 
81  double alpha_I;
82  double alpha_I_error;
83 
84  double alpha_J;
85  double alpha_J_error;
86 
87  double a;
88  double a_error;
89 
90  double alpha;
91  double alpha_error;
92 
93  double gapless_a;
95 
96  double gapless_alpha;
98 
100 
101  std::vector<double > m_LambdaSbs;
102  std::vector<double > m_KSbs;
103  std::vector<double > m_CSbs;
104 
105  std::vector<double > m_SigmaSbs;
106 
107  std::vector<double > m_AlphaISbs;
108  std::vector<double > m_AlphaJSbs;
109 
110  std::vector<double > m_AISbs;
111  std::vector<double > m_AJSbs;
112 
113 
114  };
115 
116 
117 
118  class pvalues{
119 
120  public:
121 
122 
123  pvalues();
124 
125  ~pvalues();
126 
127  private:
128 
129  struct error//struct to handle exceptions
130  {
132  error(std::string st_,Int4 error_code_){st=st_;error_code=error_code_;};
134  //if==1: Unexpected error
135  //if==2: Invalid input parameters
136  //if=41: Memory allocation error
137  };
138 
139 
140  static double error_of_the_sum(//v1_+v2_
141  double v1_,
142  double v1_error_,
143  double v2_,
144  double v2_error_);
145 
146  static double error_of_the_product(//v1_*v2_
147  double v1_,
148  double v1_error_,
149  double v2_,
150  double v2_error_);
151 
152  static double error_of_the_sqrt(//sqrt(v1_)
153  double v1_,
154  double v1_error_);
155 
156  static double error_of_the_ratio(//v1_/v2_
157  double v1_,
158  double v1_error_,
159  double v2_,
160  double v2_error_);
161 
162  static double one_minus_exp_function(
163  double y_);
164 
165  static double ln_one_minus_val(
166  double val_);
167 
168 
169  static double normal_probability(
170  double x_,
171  double eps_);
172 
173  static double normal_probability(
174  double a_,
175  double b_,
176  double h_,
177  Int4 N_,
178  double *p_,
179  double x_,
180  double eps_);
181 
182  static void get_appr_tail_prob_with_cov(
183  set_of_parameters &par_,
184  bool blast_,
185  double y_,
186  Int4 m_,
187  Int4 n_,
188 
189  double &P_,
190  double &P_error_,
191 
192  double &area_,
193 
194  double a_normal_,
195  double b_normal_,
196  double h_normal_,
197  Int4 N_normal_,
198  double *p_normal_,
199 
200  bool &area_is_1_flag_);
201 
202 
204  set_of_parameters &par_,
205  bool blast_,
206  double y_,
207  Int4 m_,
208  Int4 n_,
209 
210  double &P_,
211  double &P_error_,
212 
213  double &area_,
214 
215  double a_normal_,
216  double b_normal_,
217  double h_normal_,
218  Int4 N_normal_,
219  double *p_normal_,
220 
221  bool &area_is_1_flag_);
222 
224  set_of_parameters &par_,
225  bool blast_,
226  double y_,
227  Int4 m_,
228  Int4 n_,
229 
230  double &P_,
231  double &P_error_,
232 
233  double &area_,
234 
235  double a_normal_,
236  double b_normal_,
237  double h_normal_,
238  Int4 N_normal_,
239  double *p_normal_,
240 
241  bool &area_is_1_flag_);
242 
243 
244  public:
245  void calculate_P_values(
246  Int4 Score1,
247  Int4 Score2,
248  Int4 Seq1Len,
249  Int4 Seq2Len,
250  set_of_parameters &ParametersSet,
251  std::vector<double> &P_values,
252  std::vector<double> &P_values_errors);
253 
254 
255 
256 
257 
258 
259  private:
260 
261 
262  bool blast;
263  double eps;
264  double a_normal;
265  double b_normal;
267  double h_normal;
268  double *p_normal;
269 
270 
271  };
272 END_SCOPE(Sls)
273 
274 END_SCOPE(blast)
276 
277 #endif //! ALGO_BLAST_GUMBEL_PARAMS__INCLUDED_SLS_PVALUES
278 
static double ln_one_minus_val(double val_)
double * p_normal
static double one_minus_exp_function(double y_)
static void get_appr_tail_prob_with_cov(set_of_parameters &par_, bool blast_, double y_, Int4 m_, Int4 n_, double &P_, double &P_error_, double &area_, double a_normal_, double b_normal_, double h_normal_, Int4 N_normal_, double *p_normal_, bool &area_is_1_flag_)
static double error_of_the_ratio(double v1_, double v1_error_, double v2_, double v2_error_)
bool blast
static double normal_probability(double x_, double eps_)
static double error_of_the_product(double v1_, double v1_error_, double v2_, double v2_error_)
Definition: sls_pvalues.cpp:64
double b_normal
static void get_P_error_using_splitting_method(set_of_parameters &par_, bool blast_, double y_, Int4 m_, Int4 n_, double &P_, double &P_error_, double &area_, double a_normal_, double b_normal_, double h_normal_, Int4 N_normal_, double *p_normal_, bool &area_is_1_flag_)
static double error_of_the_sum(double v1_, double v1_error_, double v2_, double v2_error_)
Definition: sls_pvalues.cpp:50
double eps
static double error_of_the_sqrt(double v1_, double v1_error_)
Definition: sls_pvalues.cpp:87
double h_normal
Int4 N_normal
static void get_appr_tail_prob_with_cov_without_errors(set_of_parameters &par_, bool blast_, double y_, Int4 m_, Int4 n_, double &P_, double &P_error_, double &area_, double a_normal_, double b_normal_, double h_normal_, Int4 N_normal_, double *p_normal_, bool &area_is_1_flag_)
double a_normal
void calculate_P_values(Int4 Score1, Int4 Score2, Int4 Seq1Len, Int4 Seq2Len, set_of_parameters &ParametersSet, std::vector< double > &P_values, std::vector< double > &P_values_errors)
string
Definition: cgiapp.hpp:687
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
The NCBI C++/STL use hints.
Defines Limits for the types used in NCBI C/C++ toolkit.
std::string st
error(std::string st_, Int4 error_code_)
std::vector< double > m_KSbs
std::vector< double > m_SigmaSbs
std::vector< double > m_AlphaJSbs
std::vector< double > m_CSbs
std::vector< double > m_AlphaISbs
std::vector< double > m_AJSbs
std::vector< double > m_LambdaSbs
std::vector< double > m_AISbs
double gapless_alpha_error
Definition: sls_pvalues.hpp:97
Modified on Thu Feb 22 17:06:54 2024 by modify_doxy.py rev. 669887