|
Last change
on this file was
2,
checked in by oldcode, 25 years ago
|
|
Initial revision
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
|
File size:
1.7 KB
|
| Line | |
|---|
| 1 | #include <stdio.h> |
|---|
| 2 | #include <math.h> |
|---|
| 3 | #include <stdlib.h> |
|---|
| 4 | #include <string.h> |
|---|
| 5 | #include "clustalw.h" |
|---|
| 6 | |
|---|
| 7 | /* |
|---|
| 8 | * Prototypes |
|---|
| 9 | */ |
|---|
| 10 | /* |
|---|
| 11 | * Global variables |
|---|
| 12 | */ |
|---|
| 13 | |
|---|
| 14 | extern sint max_aa,gap_pos1,gap_pos2; |
|---|
| 15 | |
|---|
| 16 | void calc_prf2(sint **profile, char **alignment, |
|---|
| 17 | sint *seq_weight,sint prf_length, sint first_seq, sint last_seq) |
|---|
| 18 | { |
|---|
| 19 | |
|---|
| 20 | sint sum1, sum2; |
|---|
| 21 | sint i, d; |
|---|
| 22 | sint r; |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | for (r=0; r<prf_length; r++) |
|---|
| 26 | { |
|---|
| 27 | /* |
|---|
| 28 | calculate sum2 = number of residues found in this column |
|---|
| 29 | */ |
|---|
| 30 | sum2 = 0; |
|---|
| 31 | for (i=first_seq; i<last_seq; i++) |
|---|
| 32 | { |
|---|
| 33 | sum2 += seq_weight[i]; |
|---|
| 34 | } |
|---|
| 35 | /* |
|---|
| 36 | only include matrix comparison scores for those residue types found in this |
|---|
| 37 | column |
|---|
| 38 | */ |
|---|
| 39 | if (sum2 == 0) |
|---|
| 40 | { |
|---|
| 41 | for (d=0; d<=max_aa; d++) |
|---|
| 42 | profile[r+1][d] = 0; |
|---|
| 43 | profile[r+1][gap_pos1] = 0; |
|---|
| 44 | profile[r+1][gap_pos2] = 0; |
|---|
| 45 | } |
|---|
| 46 | else |
|---|
| 47 | { |
|---|
| 48 | for (d=0; d<=max_aa; d++) |
|---|
| 49 | { |
|---|
| 50 | sum1 = 0; |
|---|
| 51 | for (i=first_seq; i<last_seq; i++) |
|---|
| 52 | { |
|---|
| 53 | if (d == alignment[i][r]) sum1 += seq_weight[i]; |
|---|
| 54 | } |
|---|
| 55 | profile[r+1][d] = (sint)(10 * (float)sum1 / (float)sum2); |
|---|
| 56 | } |
|---|
| 57 | sum1 = 0; |
|---|
| 58 | for (i=first_seq; i<last_seq; i++) |
|---|
| 59 | { |
|---|
| 60 | if (gap_pos1 == alignment[i][r]) sum1 += seq_weight[i]; |
|---|
| 61 | } |
|---|
| 62 | profile[r+1][gap_pos1] = (sint)(10 * (float)sum1 / (float)sum2); |
|---|
| 63 | sum1 = 0; |
|---|
| 64 | for (i=first_seq; i<last_seq; i++) |
|---|
| 65 | { |
|---|
| 66 | if (gap_pos2 == alignment[i][r]) sum1 += seq_weight[i]; |
|---|
| 67 | } |
|---|
| 68 | profile[r+1][gap_pos2] = (sint)(10 * (float)sum1 / (float)sum2); |
|---|
| 69 | } |
|---|
| 70 | } |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.