(v1_error_>=1e100||v2_error_>=1e100)
61 returnsqrt(v1_error_*v1_error_+v2_error_*v2_error_);
70 if(v1_error_>=1e100||v2_error_>=1e100)
75 doublea1=(v1_+v1_error_)*(v2_+v2_error_);
76 doublea2=(v1_-v1_error_)*(v2_+v2_error_);
77 doublea3=(v1_+v1_error_)*(v2_-v2_error_);
78 doublea4=(v1_-v1_error_)*(v2_-v2_error_);
91 if(v1_error_>=1e100||v1_<0)
109 if(v1_error_>=1e100||v2_error_>=1e100)
120 if(v1_==0&&v1_error_==0)
128 if(((v2_+v2_error_)*v2_<=0))
130 doublea3=(v1_+v1_error_)/(v2_-v2_error_);
131 doublea4=(v1_-v1_error_)/(v2_-v2_error_);
135 if(((v2_-v2_error_)*v2_<=0))
137 doublea1=(v1_+v1_error_)/(v2_+v2_error_);
138 doublea2=(v1_-v1_error_)/(v2_+v2_error_);
143 doublea1=(v1_+v1_error_)/(v2_+v2_error_);
144 doublea2=(v1_-v1_error_)/(v2_+v2_error_);
145 doublea3=(v1_+v1_error_)/(v2_-v2_error_);
146 doublea4=(v1_-v1_error_)/(v2_-v2_error_);
163 return-(y_+y_*y_/2.0+y_*y_*y_/6.0+y_*y_*y_*y_/24.0);
172 double pi=3.1415926535897932384626433832795;
186 doublex=x_/sqrt(2.0);
187 return1-0.5*exp(-x*x)/(x*sqrt(
pi))*(1-1.0/(2*x*2*x));
192 doublex=x_/sqrt(2.0);
193 return0.5*exp(-x*x)/(-x*sqrt(
pi))*(1-1.0/(2*x*2*x));
197 doubleconst_val=1/sqrt(2.0*
pi);
203 doubleh=x_/(double)
N;
209 for(
i=0;
i<=
N;
i++)
212 double tmp=exp(-0.5*y*y);
213 if(
i==0||
i==
N)
225 return0.5+const_val*(res);
244 returnp_[x_n]+(p_[x_n+1]-p_[x_n])*(x_-(h_*x_n+a_))/h_;
255 return-val_-val_*val_/2.0-val_*val_*val_/3.0;
278 bool&area_is_1_flag_)
282 doublelambda_=par_.
lambda;
285 doublek_error_=par_.
K_error;
287 doubleai_hat_=par_.
a_I;
291 doublealphai_hat_=par_.
alpha_I;
296 doubleaj_hat_=par_.
a_J;
300 doublealphaj_hat_=par_.
alpha_J;
305 doublesigma_hat_=par_.
sigma;
311 boolwhere_it_is_works_flag=
false;
312 boolnegative_flag=
false;
333 doubleconst_val=1/sqrt(2.0*3.1415926535897932384626433832795);
334 double eps=0.000001;
338 doublem_li_y_error = 0.0;
346 if(where_it_is_works_flag)
348 if(ai_hat_*y_+bi_hat_<0)
350negative_flag=
true;
357 doublevi_y_error = 0.0;
360 boolflag_Mii=
true;
362 if(flag_Mii||blast_)
364vi_y_error=
error_of_the_sum(y_*alphai_hat_,
fabs(y_)*alphai_hat_error_,betai_hat_,betai_hat_error_);
366 if(where_it_is_works_flag)
368 if(alphai_hat_*y_+betai_hat_<0)
370negative_flag=
true;
376 doublesqrt_vi_y=sqrt(vi_y);
381 if(sqrt_vi_y==0.0||blast_)
389m_F=m_li_y/sqrt_vi_y;
394 doubleP_m_F_error=const_val*exp(-0.5*m_F*m_F)*m_F_error;
396 doubleE_m_F=-const_val*exp(-0.5*m_F*m_F);
397 doubleE_m_F_error=
fabs(-E_m_F*m_F)*m_F_error;
400 doublem_li_y_P_m_F=m_li_y*P_m_F;
402 doublesqrt_vi_y_E_m_F_error=
error_of_the_product(sqrt_vi_y,sqrt_vi_y_error,E_m_F,E_m_F_error);
403 doublesqrt_vi_y_E_m_F=sqrt_vi_y*E_m_F;
405 doublep1_error=
error_of_the_sum(m_li_y_P_m_F,m_li_y_P_m_F_error,sqrt_vi_y_E_m_F,sqrt_vi_y_E_m_F_error);
406 doublep1=m_li_y_P_m_F-sqrt_vi_y_E_m_F;
409 doublen_lj_y_error = 0.0;
420 if(where_it_is_works_flag)
422 if(aj_hat_*y_+bj_hat_<0)
424negative_flag=
true;
430 doublevj_y_error = 0.0;
433 boolflag_Mjj=
true;
435 if(flag_Mjj||blast_)
437vj_y_error=
error_of_the_sum(y_*alphaj_hat_,
fabs(y_)*alphaj_hat_error_,betaj_hat_,betaj_hat_error_);
440 if(where_it_is_works_flag)
442 if(alphaj_hat_*y_+betaj_hat_<0)
444negative_flag=
true;
453 doublesqrt_vj_y=sqrt(vj_y);
458 if(sqrt_vj_y==0.0||blast_)
466n_F=n_lj_y/sqrt_vj_y;
470 doubleP_n_F_error=const_val*exp(-0.5*n_F*n_F)*n_F_error;
472 doubleE_n_F=-const_val*exp(-0.5*n_F*n_F);
473 doubleE_n_F_error=
fabs(-E_n_F*n_F)*n_F_error;
476 doublen_lj_y_P_n_F=n_lj_y*P_n_F;
478 doublesqrt_vj_y_E_n_F_error=
error_of_the_product(sqrt_vj_y,sqrt_vj_y_error,E_n_F,E_n_F_error);
479 doublesqrt_vj_y_E_n_F=sqrt_vj_y*E_n_F;
481 doublep2_error=
error_of_the_sum(n_lj_y_P_n_F,n_lj_y_P_n_F_error,sqrt_vj_y_E_n_F,sqrt_vj_y_E_n_F_error);
482 doublep2=n_lj_y_P_n_F-sqrt_vj_y_E_n_F;
487 doublec_y_error = 0.0;
490 boolflag_Mij=
true;
492 if(flag_Mij||blast_)
494c_y_error=
error_of_the_sum(sigma_hat_*y_,sigma_hat_error_*y_,tau_hat_,tau_hat_error_);
497 if(where_it_is_works_flag)
499 if(sigma_hat_*y_+tau_hat_<0)
501negative_flag=
true;
508 doubleP_m_F_P_n_F=P_m_F*P_n_F;
510 doublec_y_P_m_F_P_n_F_error=
error_of_the_product(c_y,c_y_error,P_m_F_P_n_F,P_m_F_P_n_F_error);
511 doublec_y_P_m_F_P_n_F=c_y*P_m_F_P_n_F;
519 doublearea_error=
error_of_the_sum(p1_p2,p1_p2_error,c_y_P_m_F_P_n_F,c_y_P_m_F_P_n_F_error);
520 doublearea=p1_p2+c_y_P_m_F_P_n_F;
533area_is_1_flag_=
true;
542 if(negative_flag&&where_it_is_works_flag)
549 doubleexp_lambda_y_error=
fabs(lambda_error_*y_*exp(-lambda_*y_));
550 doubleexp_lambda_y=exp(-lambda_*y_);
553 doublearea_k=area*k_;
555 doublearea_k_exp_lambda_y_error=
error_of_the_product(area_k,area_k_error,exp_lambda_y,exp_lambda_y_error);
556 doublearea_k_exp_lambda_y=-area_k*exp_lambda_y;
558P_error_=exp(area_k_exp_lambda_y)*area_k_exp_lambda_y_error;
590 bool&area_is_1_flag_)
595 doublelambda_=par_.
lambda;
598 doubleai_hat_=par_.
a_I;
600 doublealphai_hat_=par_.
alpha_I;
603 doubleaj_hat_=par_.
a_J;
605 doublealphaj_hat_=par_.
alpha_J;
608 doublesigma_hat_=par_.
sigma;
612 boolwhere_it_is_works_flag=
false;
613 boolnegative_flag=
false;
628 doubleconst_val=1/sqrt(2.0*3.1415926535897932384626433832795);
629 double eps=0.000001;
639 if(where_it_is_works_flag)
641 if(ai_hat_*y_+bi_hat_<0)
643negative_flag=
true;
651 boolflag_Mii=
true;
653 if(flag_Mii||blast_)
656 if(where_it_is_works_flag)
658 if(alphai_hat_*y_+betai_hat_<0)
660negative_flag=
true;
665 doublesqrt_vi_y=sqrt(vi_y);
669 if(sqrt_vi_y==0.0||blast_)
675m_F=m_li_y/sqrt_vi_y;
681 doubleE_m_F=-const_val*exp(-0.5*m_F*m_F);
683 doublem_li_y_P_m_F=m_li_y*P_m_F;
685 doublesqrt_vi_y_E_m_F=sqrt_vi_y*E_m_F;
687 doublep1=m_li_y_P_m_F-sqrt_vi_y_E_m_F;
699 if(where_it_is_works_flag)
701 if(aj_hat_*y_+bj_hat_<0)
703negative_flag=
true;
711 boolflag_Mjj=
true;
713 if(flag_Mjj||blast_)
717 if(where_it_is_works_flag)
719 if(alphaj_hat_*y_+betaj_hat_<0)
721negative_flag=
true;
729 doublesqrt_vj_y=sqrt(vj_y);
733 if(sqrt_vj_y==0.0||blast_)
739n_F=n_lj_y/sqrt_vj_y;
744 doubleE_n_F=-const_val*exp(-0.5*n_F*n_F);
746 doublen_lj_y_P_n_F=n_lj_y*P_n_F;
748 doublesqrt_vj_y_E_n_F=sqrt_vj_y*E_n_F;
750 doublep2=n_lj_y_P_n_F-sqrt_vj_y_E_n_F;
757 boolflag_Mij=
true;
759 if(flag_Mij||blast_)
763 if(where_it_is_works_flag)
765 if(sigma_hat_*y_+tau_hat_<0)
767negative_flag=
true;
773 doubleP_m_F_P_n_F=P_m_F*P_n_F;
775 doublec_y_P_m_F_P_n_F=c_y*P_m_F_P_n_F;
782 doublearea=p1_p2+c_y_P_m_F_P_n_F;
795area_is_1_flag_=
true;
804 if(negative_flag&&where_it_is_works_flag)
811 doubleexp_lambda_y=exp(-lambda_*y_);
813 doublearea_k=area*k_;
815 doublearea_k_exp_lambda_y=-area_k*exp_lambda_y;
842 bool&area_is_1_flag_)
847 throw error(
"Unexpected error in get_P_error_using_splitting_method\n",1);
854vector<double> P_values(dim);
857 for(
i=0;
i<dim;
i++)
872par_tmp.
a=0.5*(par_tmp.
a_I+par_tmp.
a_J);
902par_tmp.
G=par_.
G;
904 doubleP_tmp,P_tmp_error,area_tmp;
945 for(
i=0;
i<dim;
i++)
947 double tmp=P_values[
i]/P_;
951P_error_/=(double)dim;
963 boolee_error_flag=
false;
964 erroree_error(
"",0);
984ee_error_flag=
true;
990ee_error_flag=
true;
991ee_error=
error(
"Internal error in the program\n",1);
1017vector<double> &P_values,
1018vector<double> &P_values_errors)
1022 throw error(
"Error - Score2<Score1\n",2);
1025 if(Seq1Len<=0||Seq2Len<=0)
1027 throw error(
"Error - Seq1Len<=0||Seq2Len<=0\n",2);
1036P_values.resize(ymax_-ymin_+1);
1037P_values_errors.resize(ymax_-ymin_+1);
1042 for(y=ymin_;y<=ymax_;y++)
1048 boolarea_is_1_flag=
false;
1075 doubleP_tmp,area_tmp;
1100P_error=P_error/P_tmp*
P;
1103P_values_errors[y-ymin_]=P_error;
1107P_values_errors[y-ymin_]=-DBL_MAX;
1133P_values_errors[y-ymin_]=P_error;
1138P_values[y-ymin_]=
P;
static double round(const double &x_)
static T Tmax(T i_, T j_)
static T Tmin(T i_, T j_)
static double sqrt_for_errors(double x_)
static double ln_one_minus_val(double val_)
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_)
static double normal_probability(double x_, double eps_)
static double error_of_the_product(double v1_, double v1_error_, double v2_, double v2_error_)
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_)
static double error_of_the_sqrt(double v1_, double v1_error_)
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_)
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)
int32_t Int4
4-byte (32-bit) signed integer
#define NORMAL_DISTR_ARRAY_DIM
double * GetNormalDistrArrayForPvaluesCalculation(void)
const bool read_Sbs_par_flag
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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4