annotate PLIDflow/scripts/includeAtom3.sh @ 2:afd5b5ffc38f draft

Uploaded
author bitlab
date Tue, 14 Jan 2020 07:52:48 -0500
parents 6fcfa4756040
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
2 if [ $# != 2 ]; then
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
3 echo "***ERROR*** Use: $0 <TABLE> <PQR>"
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
4 exit -1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
5 fi
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
6
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
7
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
8 PQR=$2
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
9 TABLE=$1
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
10
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
11 grep -v "REMARK" $PQR > $PQR.temp
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
12
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
13 #awk '
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
14 #{
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
15 # if(length($5 > 1)) print $5
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
16 #} ' $PQR.temp
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
17
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
18
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
19
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
20
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
21 awk '
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
22
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
23
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
24 FNR==NR{
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
25 equivalence[$1] = $2
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
26 next
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
27 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
28
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
29 FNR!=NR{
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
30 if(substr($3,1,1) == "H"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
31
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
32 if(length($3) > 1){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
33
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
34
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
35 print $0, "H"
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
36 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
37 }else{
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
38
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
39 print $0, equivalence[$3];
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
40
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
41
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
42
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
43 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
44
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
45 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
46 ' $TABLE $PQR.temp | sed 's/ \+/ /g' > $PQR.temp.bad
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
47
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
48 awk '
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
49 {
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
50 x=$10;
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
51 y=$11;
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
52 z=$12;
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
53 $10="";
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
54 $11="";
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
55 $12="";
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
56 if(substr($0,1,3) != "TER" && substr($0,1,3) != "END")
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
57 printf("%s %.2f %.2f %s\n", $0, x, y, z)
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
58 else
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
59 print $0
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
60 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
61 ' $PQR.temp.bad > $PQR.temp.format
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
62
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
63
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
64 awk '
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
65
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
66 NR==1{ x1=0; x2=0; x3=0; x4=0; x5=0; x6=0; x7=0; x8=0; x9=0; x10=0; x11=0; x12=0; x13=0; }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
67
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
68 FNR==NR{
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
69 if($1 == "ATOM" || $1 == "HETATM"){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
70 if(length($1) > x1) x1 = length($1);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
71 if(length($2) > x2) x2 = length($2);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
72 if(length($3) > x3) x3 = length($3);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
73 if(length($4) > x4) x4 = length($4);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
74 if(length($5) > x5) x5 = length($5);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
75 if(length($6) > x6) x6 = length($6);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
76 if(length($7) > x7) x7 = length($7);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
77 if(length($8) > x8) x8 = length($8);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
78 if(length($9) > x9) x9 = length($9);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
79 if(length($10) > x10) x10 = length($10);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
80 if(length($11) > x11) x11 = length($11);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
81 if(length($12) > x12) x12 = length($12);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
82 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
83
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
84 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
85
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
86
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
87 FNR!=NR{
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
88
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
89
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
90 #total=length($1)+3+x1+2+x3+1+x4+1+x5+6+x7+1+x8+1+x9+1+x10+1+x11+2+x11;
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
91 total=0;
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
92
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
93 printf("%s", $1); total+=length($1);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
94 if($1=="ATOM") for(i=0; i<7-length($2); i++) { printf(" "); total+=1; }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
95 if($1=="HETATM") for(i=0; i<5-length($2); i++) { printf(" "); total+=1; }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
96 printf("%s", $2); total+=length($2);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
97 for(i=0; i<2; i++){ printf(" "); total+=1}
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
98 printf("%s", $3); total+=length($3);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
99 for(i=0; i<4-length($3); i++){ printf(" "); total+=1;}
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
100 printf("%s", $4); total+=length($4);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
101 for(i=0; i<1+x4-length($4); i++){ printf(" ");total+=1;}
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
102 printf("%s", $5); total+=length($5);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
103 for(i=0; i<3-length($5); i++){ printf(" ");total+=1;}
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
104 printf("%s", $6); total+=length($6);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
105 for(i=0; i<(13-length($7)-length($6)); i++){ printf(" "); total+=1;}
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
106 printf("%s", $7); total+=length($7);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
107 for(i=0; i<8-length($8); i++){ printf(" ");total+=1;}
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
108 printf("%s", $8); total+=length($8);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
109 for(i=0; i<8-length($9); i++){ printf(" ");total+=1;}
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
110 printf("%s", $9); total+=length($9);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
111 for(i=0; i<6-length($10); i++){ printf(" ");total+=1;}
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
112 printf("%s", $10); total+=length($10);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
113 for(i=0; i<5-length($11); i++){ printf(" ");total+=1;}
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
114 printf("%s", $11); total+=length($11);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
115 for(i=0; i<79-total; i++) printf(" ");
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
116 printf("%s", $12); total+=length($12);
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
117 if(length($12) < x12){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
118 for(i=0; i<x12-length($12); i++){
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
119 #printf(" ");
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
120 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
121 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
122 printf("\n");
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
123
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
124
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
125
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
126
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
127 }
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
128
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
129 ' $PQR.temp.format $PQR.temp.format
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
130
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
131
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
132
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
133
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
134 rm $PQR.temp
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
135 rm $PQR.temp.bad
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
136 rm $PQR.temp.format
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
137
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
138
6fcfa4756040 Uploaded
bitlab
parents:
diff changeset
139