/* This program counts the number of aromatic and aliphatic residues at a */ /* given position in an alignment. The percentages are given as averages */ /* in a variable window. This program is different than chkALAR2_1 in */ /* that data is also gathered for each alignment position. 8/28/94 st */ #include #include main(ac,av) int ac; char *av[]; { FILE *ALIGN,*ALARout,*AAFout; char code[6],seqarray[30][1000],str[200]; int ansarrleng,begin,c,e,end,i,length,numlines,numseq,pos,posn,rleng,row,start,stop, wsize,x,y,z; float Acnt,Rcnt,Ncnt,Dcnt,Gcnt,Ccnt,Qcnt,Ecnt,Hcnt,Icnt,Lcnt,Kcnt,Mcnt,Fcnt,Pcnt,Scnt, Tcnt,Wcnt,Ycnt,Vcnt; float ALcount,aafreq[29][1000],ARcount,Other,scorearray1[3][1000],scorearray2[3][1000] ,sum; wsize=atoi(av[1]); if(ac!=5 && wsize%2==0) { printf("chkA gathers statistical data on all the positions in an alignment.\n"); printf("Usage: chkA ws rf wf1 wf2.\n"); printf(" ws = window size-must be odd\n"); printf(" rf = alignment in NEWAT format\n"); printf(" wf1= save file for aliphatic and aromatic frequencies\n"); printf(" wf2= save file frequency of amino acid appearance\n"); printf(" MAX length = 1000 MAX SEQ=30\n"); exit (1); } if((ALIGN=fopen(av[2],"r"))==NULL) { printf("File %s does not exist.\n", av[2]); exit (1); } ALARout=fopen(av[3],"w"); AAFout=fopen(av[4],"w"); /* Determine 2-D scorearray1 size */ numlines=0; fgets(str,sizeof str,ALIGN); while (strstr(str,"*")==NULL) { fgets(str,sizeof str,ALIGN); numlines++; } length=(numlines)*30; /* Read aligned sequences into the array seqarray */ rewind(ALIGN); row=0; numseq=0; for(;;) { c=fgetc(ALIGN); if(c==EOF) { fclose(ALIGN); break; } else { ungetc(c,ALIGN); fgets(str,sizeof str,ALIGN); if(str[0]=='T') { numseq++; y=0; for(i=0;i