Debian Codegraph @

blib/lib/pwm_search.h

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 /*---------------------------------------------------------------
2 * INCLUDES
3 *---------------------------------------------------------------*/
4 #include <stdio.h>
5 #include <math.h>
6
7 /*---------------------------------------------------------------
8 * DECLARATIONS
9 *---------------------------------------------------------------*/
10 /*
11 extern double atof();
12 extern double log2();
13 extern double sqrt();
14 extern FILE *fopen();
15 */
16 void err_log(), err_show();
17
18 /*---------------------------------------------------------------
19 * DEFINES
20 *---------------------------------------------------------------*/
21 #define __DEBUG__ 0 /* put debug messages on */
22 #define FNAMELEN 1000 /* max allowed length of file name */
23 #define MAX_LINE 200
24 #define MAXCOUNTS 1000 /* max number of counts in count matrix */
25 #define MAXERR 100 /* max number of errors that err_log can handle */
26 #define MAXHITS 1000
27 #define SEQLEN 1000000 /* max sequence length allowed */
28 #define SEQNAMELEN MAX_LINE /* max allowed sequence name length */
29
30 /*---------------------------------------------------------------
31 * GLOBALS
32 *---------------------------------------------------------------*/
33 static char PANIC[] = "err_log function failure";
34
35 static char *__ERR__[MAXERR];
36
37 static int NUM_ERRS=0;
38
39 static char SQCOMP[] = /* calculate base on complementary strand */
40 { /* ASCII chars; IUPAC conventions */
41 /* Control characters unchanged */
42 '\000','\001','\002','\003','\004','\005','\006','\007',
43 '\010','\011','\012','\013','\014','\015','\016','\017',
44 '\020','\021','\022','\023','\024','\025','\026','\027',
45 '\030','\031','\032','\033','\034','\035','\036','\037',
46 /* Punctuation and digits unchanged */
47 '\040','\041','\042','\043','\044','\045','\046','\047',
48 '\050','\051','\052','\053','\054','\055','\056','\057',
49 '\060','\061','\062','\063','\064','\065','\066','\067',
50 '\070','\071','\072','\073','\074','\075','\076','\077',
51 /* Capitals go to capitals */
52 '\100', 'T', 'V', 'G', 'H', '?', '?', 'C', /* @,A-G */
53 'D', '?', '?', 'M', '?', 'K', 'N', '?', /* H-O */
54 '?', '?', 'Y', 'S', 'A', '?', 'B', 'W', /* P-W */
55 '?', 'R', '?','\133','\134','\135','\136','\137', /* X-Z,etc */
56 /* Lower case goes to lower case */
57 '\140', 't', 'v', 'g', 'h', '?', '?', 'c',
58 'd', '?', '?', 'm', '?', 'k', 'n', '?',
59 '?', '?', 'y', 's', 'a', '?', 'b', 'w',
60 '?', 'r', '?','\173','\174','\175','\176','\177'
61 };
62
63 static int TRANS[] = /* translate characters to numbers */
64 { /* A=0; C=1; G=2; T=3; other = 4 */
65 /* Control characters */
66 4,4,4,4,4,4,4,4,
67 4,4,4,4,4,4,4,4,
68 4,4,4,4,4,4,4,4,
69 4,4,4,4,4,4,4,4,
70 /* Punctuation and digits */
71 4,4,4,4,4,4,4,4,
72 4,4,4,4,4,4,4,4,
73 4,4,4,4,4,4,4,4,
74 4,4,4,4,4,4,4,4,
75 /* Capitals */
76 4,0,4,1,4,4,4,2, /* @,A-G */
77 4,4,4,4,4,4,4,4, /* H-O */
78 4,4,4,4,3,3,4,4, /* P-W */
79 4,4,4,4,4,4,4,4, /* X-Z,etc */
80 /* Lower case */
81 4,0,4,1,4,4,4,2, /* @,A-G */
82 4,4,4,4,4,4,4,4, /* H-O */
83 4,4,4,4,3,3,4,4, /* P-W */
84 4,4,4,4,4,4,4,4 /* X-Z,etc */
85 };
86
87
88 /*---------------------------------------------------------------
89 * STRUCTURE DEFINITIONS
90 *---------------------------------------------------------------*/
91 /* ARGUMENTS -- Structure to contain shared arguments */
92 struct arguments
93 {
94 char counts_file[FNAMELEN+1]; /* file name, count matrix */
95 char mask_file[FNAMELEN+1]; /* file name, masked seq output,
96 "" means none. */
97 char seq_file[FNAMELEN+1]; /* file name, sequences */
98 char name[FNAMELEN+1]; /* TF name */
99 char class[FNAMELEN+1]; /* TF structural class */
100 int print_all; /* print scores of all hits */
101 long best_base; /* base for best score on sequence */
102 int best_only; /* only show best score on each
103 sequence */
104 double best_score; /* best score on this sequence */
105 int best_strand; /* strand for best score on sequence */
106 double max_score; /* max score possible (implied
107 from pwm) */
108 double min_score; /* min score possible (implied
109 from pwm) */
110 double threshold; /* print stuff with log score >
111 max_possible - threshold */
112 int width; /* pattern width (implied from
113 number of counts) */
114 };
115
116 /* HIT - location and score of a site scoring above threshold */
117 struct HIT
118 {
119 long base; /* location */
120 int strand; /* 0 forward, 1 complement */
121 double score; /* score */
122 };
123
124
125
126
127
128
129