6 int GJindex(char *str,char c);
8 float mzcons(unsigned char *pos,int n)
10 /* calculate conservation value according to Zvelebil et al for a set
11 of amino acids and gaps stored in string pos of length n
13 Copyright: Geoffrey J. Barton (1992,1997)
15 email: geoff@ebi.ac.uk
16 Please see the README file for details of conditions for use of this program.
18 $Id: mzcons.c,v 1.2 1998/09/17 16:55:07 geoff Exp $
20 Revision 1.2 1998/09/17 16:55:07 geoff
21 Check consistency with archive
28 /* -- conmat contains a table like that shown in the JMB paper
29 order of amino acids is GAP,ARNDCQEGHILKMFPSTWYBZX
31 static char *acids = " ARNDCQEGHILKMFPSTWYBZX";
32 static int conmat[24][10] = {
33 {1,1,1,1,1,1,1,1,1,1},
34 {1,0,0,0,0,1,1,0,0,0},
35 {0,1,0,1,1,0,0,0,0,0},
36 {0,0,0,1,0,1,0,0,0,0},
37 {0,0,1,1,1,1,0,0,0,0},
38 {1,0,0,0,0,1,0,0,0,0},
39 {0,0,0,1,0,0,0,0,0,0},
40 {0,0,1,1,1,0,0,0,0,0},
41 {1,0,0,0,0,1,1,0,0,0},
42 {1,1,0,1,1,0,0,0,1,0},
43 {1,0,0,0,0,0,0,1,0,0},
44 {1,0,0,0,0,0,0,1,0,0},
45 {1,1,0,1,1,0,0,0,0,0},
46 {1,0,0,0,0,0,0,0,0,0},
47 {1,0,0,0,0,0,0,0,1,0},
48 {0,0,0,0,0,1,0,0,0,1},
49 {0,0,0,1,0,1,1,0,0,0},
50 {1,0,0,1,0,1,0,0,0,0},
51 {1,0,0,1,0,0,0,0,1,0},
52 {1,0,0,1,0,0,0,0,1,0},
53 {1,0,0,0,0,1,0,1,0,0},
54 {0,0,0,1,0,0,0,0,0,0},
55 {0,0,0,1,0,0,0,0,0,0},
59 int concnt,it,i,j,k,l,tcnt,ibseq;
64 /*found: outer loop over properties
65 set IT to the value of the first amino acid*/
66 it = conmat[GJindex(acids,pos[0])][j];
67 /*loop over remaining acids, if a difference occurs then
71 if(it != conmat[GJindex(acids,pos[k])][j]){
75 /*add tcnt to concnt*/
78 /* check for total identity at this position*/
87 /*calculate the conservation*/
90 }else if(concnt == 0){
95 /*not identity, but same properties*/
99 con = 0.9 - 0.1 * concnt;
105 int GJindex(char *str,char c)
109 if(t == NULL) return NULL;
110 return (int) (t - str);