annotate tools/rdock/data/pmf/smoothed/m2pmf.awk @ 3:b02d74d22d05 draft default tip

planemo upload
author marpiech
date Mon, 29 Aug 2016 08:23:52 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
1 #!/bin/awk -f
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
2 BEGIN{
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
3 true = 1;
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
4 false = !true;
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
5 hashmarkcount = 0;
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
6 iscomment = true; # true for the first lines
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
7 i=0;
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
8 j=0;
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
9 }{
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
10 if("#" == $1) {
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
11 hashmarkcount++;
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
12 iscomment = true;
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
13 } else
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
14 iscomment = false;
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
15 if(hashmarkcount < 6 && !iscomment ){ #get the first vector (x)
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
16 x[i]=$1;
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
17 i++;
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
18 }
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
19 else if ( !iscomment ){ # so we are at y
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
20 y[j]=$1;
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
21 j++;
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
22 }
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
23
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
24 }END{
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
25 # first padding at the beginning
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
26 for (j=0.2;j<x[0];j+=0.2) {
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
27 printf("%6.3f %6.4f\n", j,3.0);
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
28 }
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
29 # note i sould be equal to y
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
30 # we are considering 'i' number of data (
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
31 # ys without x values will be discarded, xs without y will
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
32 # get y value 0
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
33 # we are treating 'i' as the length of the vectors
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
34 for (j=0;j<i;j++) {
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
35 printf("%6.3f %6.4f\n", x[j],y[j]);
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
36 }
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
37 # zero padding at the end
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
38 for(j=x[j-1]+0.2;j<=12.0;j+=0.2) {
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
39 printf("%6.3f %6.4f\n", j,0.0);
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
40 }
b02d74d22d05 planemo upload
marpiech
parents:
diff changeset
41 }