2 #include <math.h> /** Defines HUGE_VAL. **/
11 void add_seq2(long pfreqs[AANUM][POSNUM],
13 long pfreqp[AANUM][AANUM][POSNUM][POSNUM],
14 long ptotalp[POSNUM][POSNUM],
16 char seq[MAXSEQLEN], int seqlen, int bias)
17 /* Temporarily add or remove the sequence under consideration from the
18 positive data? (bias=-1 removes, bias=1 adds) */
22 for (i = 0; i < seqlen; i++)
23 if (seq[i] < AANUM && reg[i]!='.') {
25 for (j = i+1; j <= i+POSNUM && j < seqlen && (reg[j] == (posj = (posi+j-i)%POSNUM)); j++)
27 pfreqp[seq[i]][seq[j]][posi][posj] += bias;
28 ptotalp[posi][posj] += bias;
30 pfreqs[seq[i]][posi] += bias;
31 ptotals[posi] += bias;
38 remove_all_input_seq_from_table(long pfreqs[AANUM][POSNUM],
39 long ptotals[POSNUM],long pfreqp[AANUM][AANUM][POSNUM][POSNUM],
40 long ptotalp[POSNUM][POSNUM], char *testfile_name, int bias)
43 char title[MAXLINE],code[MAXLINE];
44 char seq[MAXSEQLEN], reg[MAXSEQLEN];
49 sequence.title = title;
54 ftest = sopen(testfile_name,"r");
55 while (getseq2(ftest,&sequence)) {
56 for (i = 0; i < sequence.seqlen; i++)
57 if (seq[i] < AANUM && reg[i]!='.') {
59 for (j = i+1; j <= i+POSNUM && j < sequence.seqlen && (reg[j] == (posj = (posi+j-i)%POSNUM)); j++)
61 pfreqp[seq[i]][seq[j]][posi][posj] += bias;
62 ptotalp[posi][posj] += bias;
64 pfreqs[seq[i]][posi] += bias;
65 ptotals[posi] += bias;
77 int getpos (FILE *fl, Sequence *sequence)
78 /* Read in the next sequence from a .pos file */
81 char *code = sequence->code;
82 char *title = sequence->title;
83 char *seq = sequence->seq;
84 char *reg = sequence->reg;
88 while (c!='>' && c!=EOF)
101 /* Get the title info */
109 /* Get the sequence */
111 while (c!='*' && c!=EOF)
113 if (aanum(c)!=(char) -1)
114 seq[count++]=aanum(c);
117 sequence->seqlen=count;
119 /* Get the register info */
121 while (c!='*' && c!=EOF)
123 if (c>='a' && c<='z')
129 if (sequence->seqlen != count) {
130 fprintf(stderr, "erroneous .pos file!\n");