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