sc_to_e.c

来自「序列对齐 Compare a protein sequence to a pr」· C语言 代码 · 共 60 行

C
60
字号
/* copyright (c) 1996, 1997, 1998, 1999 William R. Pearson and the   U. of Virginia *//* $Name: fa35_03_06 $ - $Id: sc_to_e.c,v 1.2 2006/04/12 18:00:02 wrp Exp $ *//* sc_to_e  uses statistical parameters from search and	    score, length, and database size to calculate E()*/#include <stdio.h>#include <stdlib.h>#include <math.h>double mean_var, mu, rho;main(argc, argv)     int argc; char **argv;{  char line[128];  int score, length, db_size;  double z_val, s_to_zv(), zv_to_E();  if (argc == 4) {    sscanf(argv[1],"%lf",&rho);    sscanf(argv[2],"%lf",&mu);    sscanf(argv[3],"%lf",&mean_var);  }  else {    fprintf(stderr," enter rho mu mean_var: ");    fgets(line,sizeof(line),stdin);    sscanf(line,"%lf %lf %lf",&rho, &mu, &mean_var);  }  while (1) {    fprintf(stderr," enter score length db_size: ");    if (fgets(line,sizeof(line),stdin)==NULL) exit(0);    if (line[0]=='\n') exit(0);    sscanf(line,"%d %d %d",&score, &length, &db_size);    if (db_size < 1) db_size = 50000;    z_val = s_to_zv(score, length);    printf(" s: %d (%d) E(%d): %4.2g\n",score,length,db_size,zv_to_E(z_val,db_size));  }}double s_to_zv(int score, int length){  return ((double)score - rho * log((double)length) - mu)/sqrt(mean_var);}double zv_to_E(double zv, int db_size){  double e;  e = exp(-1.282554983 * zv - .577216);  return (double)db_size * (e > .01 ? 1.0 - exp(-e) : e);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?