⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 color_ann.h

📁 mfold
💻 H
字号:
/* This file was originally copied May 5, 1998 from ssacolor.h in directory   /usr/people/zuker/development/annotate/Src on snark   from a file written by Jason Ginchereau *//* Currently maintained by Darrin Stewart *//* This file is used by plt22gif.c plt22ps.c, color_table.c *//*    color_ann.h */#include <stdio.h>#include <math.h>/* For non logarithmic formulas */#define NUM_COLORS 40/* keep NUM_COLORS<=100 *//* edit the line below to change where the web page points to *//* for documentation on color annotation *//* when a html color table is generated by plt22gif or plt22ps,                  it points here */const char *http_color_doc = "http://www.bioinfo.rpi.edu/~zukerm/rna/form1-doc.html#ANN";int color_table[NUM_COLORS+1] ={                                          /* log probabilities: */    0xff0000,     /* red */                /* > .999 */    0xff1f00,    0xff3f00,    0xff5f00,    0xff7f00,    0xff9f00,    0xffbf00,    0xffdf00,                              /* > .99  */    0xffff00,     /* yellow */    0xdfff00,    0xbfff00,    0x9fff00,    0x7fff00,    0x5fff00,    0x3fff00,                              /* > .9   */    0x1fff00,    0x00ff00,     /* green */    0x00ff3f,    0x00ff7f,    0x00ffbf,    0x00ffff,     /* cyan */               /* ~ .5   */    0x00bfff,    0x007fff,    0x003fff,    0x0000ff,     /* blue  */    0x1f00ff,                              /* < .1   */    0x3f00ff,    0x5f00ff,    0x7f00ff,    0x9f00ff,    0xbf00ff,    0xdf00ff,     /* dark magenta */    0xaf00cf,                              /* < .01  */    0x7f009f,    0x5f007f,    0x3f005f,    0x1f003f,    0x09001f,    0x040009,    0x000000,     /* black */              /* < .001 */        0x000000      /* must repeat black for position NUM_COLORS*1.00 */};/* for background and text colors */#define MAIN_COLORS 9int main_color_table[MAIN_COLORS]=           {0xff0000, /* not used */           0xffffff, /* background */           0x000000, /* text */           0xff0000,/* red dots,line between bp when no annotation */           0x4030A6, /* blue dots, line for bp when no annot.  */           0x323250, /* gray for labels of gif only */           0x000000, /* for black letters on dots, */           0xffffff, /* for white letters on dots, */           0x000050}; /*for copyright*/	   char main_color_table_let[MAIN_COLORS]=" ktrbgwlc";#define COLOR_BACKGROUND -1#define COLOR_TEXT -2#define COLOR_RED_DOT -3#define COLOR_BLUE_DOT -4#define COLOR_GRAY_LABEL -5#define COLOR_WHITE_LETTER -7#define COLOR_BLACK_LETTER -6#define COLOR_COPYRIGHT -8#define WHITE_BLACK_SWITCH 23/* set previous at 23, for dot/char annotation option of plt22gif *//* colors less than WHITE_BLACK_SWITCH for dots will have black letters *//* rest will have white letters *//* Redefine NUM_COLORS for log scale */#define LOG_NUM_COLORS 8/* It is assumed that LOG_NUM_COLORS is <= than NUM_COLORS */int log_color_table[LOG_NUM_COLORS+1] ={                                          /* log probabilities: */    0xff0000,     /* red  .999 and up */                /* > .999 */    0xff7f00,    /* orange .99 and up */    0xffff00,     /* yellow  .9 and up*/    0x00ff00,     /* green .9 to .65  */    0x22ffff,     /* cyan .65 to .35 */    0x6060ff,     /* blue .35 to .1  */                  /* > .99  */    0x9f00ff,     /* Magenta .1 to .01 */    0x000000,     /* black .01 to 0 */    0x000000      /* must repeat black for position NUM_COLORS*1.00 */};#define LOG_WHITE_BLACK_SWITCH 5/*********************************************************************** * Function getcolor() accepts 'x', a float within the range between * 0 and 1, and returns an integer RGB color value. * If 'inverse' is true, the color scheme is inversed. * If 'logarithmic' is true, the color value is adjusted to a * logarithmic scale. */int get_color(double x, boolean inverse, boolean logarithmic){      if(inverse)       {x = 1 - x;            }/*    if(logarithmic)    {        x = (x * 2) - 1;        for(; logarithmic; logarithmic--) x = ((x < 0)? -1 : 1) * x * x;        x = (x + 1) / 2;    }*/    /* 7.04 causes the extreme colors to occur past .999 or .001 */    if(logarithmic)    { if(x<.001)       return 0;      else if(x<.01)             return 1;      else if(x<.1)            return 2;       else if(x<.35)            return 3;      else if(x<.65)            return 4;      else if(x<.9)            return 5;      else if(x<.99)            return 6;      else            return 7;      /* end of new method, method below no longer used */       /* start of general formula */    /* You might change NUM_COLORS to LOG_NUM_COLORS */      /* return 0 when x is within epsalon of 0 */      /* the -.0001 below ensures this */      /* return 1 when x is within epsalon of 1 */      /* return NUM_COLORS/2 when x=.5 */      /* Use log scales when x > .5 or x < .5 */     /* epsalon=.001;  when x < epsalon, return 0       if(x>=1)  keep numbers in bounds         x=.99999;      else if(x<.00001)             x=.00001;      result=NUM_COLORS/2;      constant1=((NUM_COLORS/2-1))/log10(2*epsalon)-.0001;      if(x<.5)         result=result - constant1*log10(2*x);      else         result=result + constant1*log10(2-2*x);       if(result < 0)  keep results in bounds            result = 0;      if(result > NUM_COLORS)            result = NUM_COLORS;       end of new method       return((int)floor(result));*/    }    return((int)(x * NUM_COLORS));}

⌨️ 快捷键说明

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