Mercurial > repos > marcel > caddsuite_mac10_6
comparison CADDSuite-1.6/galaxyconfigs/countResidues.sh @ 10:eda78e0f5df6 draft default tip
Deleted selected files
author | marcel |
---|---|
date | Sun, 30 Nov 2014 03:46:08 -0500 |
parents | 488032d372e1 |
children |
comparison
equal
deleted
inserted
replaced
9:488032d372e1 | 10:eda78e0f5df6 |
---|---|
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 |