0
|
1 #!/bin/bash
|
|
2
|
|
3 IFS=$'\n';
|
|
4 residue_list=""
|
|
5 hetsys_list=""
|
|
6 hoh_list=""
|
|
7
|
|
8 for line in $(cat $1); do
|
|
9 if [ "${line:0:4}" = "ATOM" ];then
|
|
10 residue_list+="${line:23:6}\n"
|
|
11 else
|
|
12 if [ "${line:0:6}" = "HETATM" ];then
|
|
13 s2=`echo $line | grep HOH`
|
|
14 if [ "$s2" != "" ];then
|
|
15 hoh_list+="${line:21:8}\n"
|
|
16 else
|
|
17 s3=`echo $line | grep WAT`
|
|
18 if [ "$s3" != "" ];then
|
|
19 hoh_list+="${line:21:8}\n"
|
|
20 else
|
|
21 hetsys_list+="${line:21:8}\n"
|
|
22 fi
|
|
23 fi
|
|
24 fi
|
|
25 fi
|
|
26 done
|
|
27
|
|
28 IFS=$' ';
|
|
29 let num_res=`echo -e "\n"$residue_list | uniq | wc -l`
|
|
30 let num_hoh=`echo -e "\n"$hoh_list | uniq | wc -l`
|
|
31 let num_hetsys=`echo -e "\n"$hetsys_list | uniq | wc -l`
|
|
32
|
|
33 # empty line at begin and end of lists -> substract 2
|
|
34 let num_res-=2
|
|
35 let num_hoh-=2
|
|
36 let num_hetsys-=2
|
|
37 if [ $num_res -lt 0 ]; then
|
|
38 let num_res=0
|
|
39 fi
|
|
40 if [ $num_hoh -lt 0 ]; then
|
|
41 let num_hoh=0
|
|
42 fi
|
|
43 if [ $num_hetsys -lt 0 ]; then
|
|
44 let num_hetsys=0
|
|
45 fi
|
|
46
|
|
47 echo -n "$num_res "
|
|
48 if [ $num_res -eq 1 ]; then
|
|
49 echo "residue"
|
|
50 else
|
|
51 echo "residues"
|
|
52 fi
|
|
53 echo -n "$num_hoh water "
|
|
54 if [ $num_hoh -eq 1 ]; then
|
|
55 echo "molecule"
|
|
56 else
|
|
57 echo "molecules"
|
|
58 fi
|
|
59 echo -n "$num_hetsys "
|
|
60 if [ $num_hetsys -eq 1 ]; then
|
|
61 echo "heterosystem"
|
|
62 else
|
|
63 echo "heterosystems"
|
|
64 fi
|