-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathass.c
More file actions
80 lines (66 loc) · 1.58 KB
/
ass.c
File metadata and controls
80 lines (66 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
#include<math.h>
int main()
{
FILE *f1;
char line[100], word[5],res_nm[12000][4],atom_nm[12000][4];
float pc=0,nc=0,hp=0,neutral=0,total=0;
int i, c1=0;
f1 = fopen("1asy.pdb","r");
while(fgets(line,100,f1)!=NULL)
{
for(i=0; i<4;i++) word[i] = line[i];
word[4]='\0';
if(strcmp(word,"ATOM")==0)
{
// atom name
for(i=0;i<3;i++)
{
atom_nm[c1][i] = line[i+13];
}
atom_nm[c1][3] = '\0';
printf("%s\n",atom_nm[c1]);
// resi
for(i=0;i<3;i++)
{
res_nm[c1][i] = line[i+17];
}
res_nm[c1][3] = '\0';
c1++;
}
}
for(i=0;i<c1;i++)
{
if(strcmp(atom_nm[i],"CA ")==0)
{
printf("%f\n",total);
if(strcmp(res_nm[i],"ARG")==0||strcmp(res_nm[i],"LYS")==0)
{
pc++;
}
if(strcmp(res_nm[i],"ASP")==0||strcmp(res_nm[i],"GLU")==0)
{
nc++;
}
if(strcmp(res_nm[i],"SER")==0||strcmp(res_nm[i],"THR")==0||strcmp(res_nm[i],"MET")==0||strcmp(res_nm[i],"HIS")==0||strcmp(res_nm[i],"GYS")==0||strcmp(res_nm[i],"ASN")==0||strcmp(res_nm[i],"GLN")==0||strcmp(res_nm[i],"TYR")==0)
{
neutral++;
}
if(strcmp(res_nm[i],"GLY")==0||strcmp(res_nm[i],"ALA")==0||strcmp(res_nm[i],"LLE")==0||strcmp(res_nm[i],"VAL")==0||strcmp(res_nm[i],"TRP")==0||strcmp(res_nm[i],"PHE")==0||strcmp(res_nm[i],"PRO")==0||strcmp(res_nm[i],"LEU")==0)
{
hp++;
}
total++;
}
}
fclose(f1);
//total = pc + nc + neutral + hp;
pc = pc/total;
nc = nc/total;
neutral = neutral/total;
hp = hp/total;
printf("total=%f positive=%f negative=%f neutral=%f hp=%f",total,pc, nc, neutral,hp);
}