-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbench.awk
executable file
·29 lines (29 loc) · 1.21 KB
/
bench.awk
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
#!/usr/bin/awk -f
BEGIN{OFS="\t";
print "NAME","SCOP","FAM","SFAM","FOLD","FP","FAMCNT","SFAMCNT","FOLDCNT";
}
FNR==NR{
id2fam[$1]=$2;
famCnt[$2]++;
gsub(/\.[0-9]+$/,"",$2);
id2sfam[$1]=$2;
sfamCnt[$2]++;
gsub(/\.[0-9]+$/,"",$2);
id2fold[$1]=$2;
foldCnt[$2]++;
next }
foundFp[$1] < 5 && id2fold[$1] != id2fold[$2] {foundFp[$1]++; next}
foundFp[$1] < 5 && id2fam[$1] == id2fam[$2] { foundFam[$1]++; next }
foundFp[$1] < 5 && id2fam[$1] != id2fam[$2] && id2sfam[$1] == id2sfam[$2] { foundSFam[$1]++; next }
foundFp[$1] < 5 && id2fam[$1] != id2fam[$2] && id2sfam[$1] != id2sfam[$2] && id2fold[$1] == id2fold[$2] { foundFold[$1]++; next }
END{
for(i in id2fam){
if(id2fam[i] != "" && sfamCnt[id2sfam[i]] - famCnt[id2fam[i]] > 0 && foldCnt[id2fold[i]] - sfamCnt[id2sfam[i]] > 0){
famVal=foundFam[i]/famCnt[id2fam[i]];
sfamVal=foundSFam[i]/(sfamCnt[id2sfam[i]] - famCnt[id2fam[i]]);
foldVal=foundFold[i]/(foldCnt[id2fold[i]] - sfamCnt[id2sfam[i]]);
fpCnt = (foundFp[i] == "") ? 0 : foundFp[i];
print i,id2fam[i],famVal,sfamVal,foldVal,fpCnt,famCnt[id2fam[i]],sfamCnt[id2sfam[i]],foldCnt[id2fold[i]];
}
}
}