8 static const char Law_and_Order[] =
"_ACGUTXKI";
9 static int BP_pair[NBASES][NBASES]=
11 {{ 0, 0, 0, 0, 0, 0, 0, 0},
12 { 0, 0, 0, 0, 5, 0, 0, 5},
13 { 0, 0, 0, 1, 0, 0, 0, 0},
14 { 0, 0, 2, 0, 3, 0, 0, 0},
15 { 0, 6, 0, 4, 0, 0, 0, 6},
16 { 0, 0, 0, 0, 0, 0, 2, 0},
17 { 0, 0, 0, 0, 0, 1, 0, 0},
18 { 0, 6, 0, 0, 5, 0, 0, 0}};
25 static int rtype[8] = {0, 2, 1, 4, 3, 6, 5, 7};
28 #pragma omp threadprivate(Law_and_Order, BP_pair, alias, pair, rtype)
32 #define ENCODE(c) encode_char(c)
34 static int encode_char(
char c) {
37 if (energy_set>0) code = (int) (c-
'A')+1;
40 pos = strchr(Law_and_Order, c);
41 if (pos==NULL) code=0;
42 else code = (int) (pos-Law_and_Order);
52 extern void nrerror(
const char message[]);
53 static void make_pair_matrix(
void)
58 for (i=0; i<5; i++) alias[i] = (
short) i;
62 for (i=0; i<NBASES; i++) {
63 for (j=0; j<NBASES; j++)
64 pair[i][j] = BP_pair[i][j];
66 if (noGU) pair[3][4] = pair[4][3] =0;
67 if (nonstandards!=NULL) {
68 for (i=0; i<(int)strlen(nonstandards); i+=2)
69 pair[encode_char(nonstandards[i])]
70 [encode_char(nonstandards[i+1])]=7;
72 for (i=0; i<NBASES; i++) {
73 for (j=0; j<NBASES; j++)
74 rtype[pair[i][j]] = pair[j][i];
92 else if (energy_set==2) {
103 else if (energy_set==3) {
104 for (i=1; i<MAXALPHA-2; ) {
110 for (i=1; i<MAXALPHA-2; i++) {
120 else nrerror(
"What energy_set are YOU using??");
123 rtype[pair[i][j]] = pair[j][i];
128 static short *encode_sequence(
const char *sequence,
short how){
129 unsigned int i,l = (
unsigned int)strlen(sequence);
130 short *S = (
short *)
space(
sizeof(
short)*(l+2));
134 case 0:
for(i=1; i<=l; i++)
135 S[i]= (
short) encode_char(toupper(sequence[i-1]));
140 case 1:
for(i=1; i<=l; i++)
141 S[i] = alias[(
short) encode_char(toupper(sequence[i-1]))];