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