Mercurial > repos > marpiech > norwich_tools
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/rdock/data/pmf/smoothed/m2pmf.awk Mon Aug 29 03:38:13 2016 -0400 @@ -0,0 +1,41 @@ +#!/bin/awk -f +BEGIN{ + true = 1; + false = !true; + hashmarkcount = 0; + iscomment = true; # true for the first lines + i=0; + j=0; +}{ + if("#" == $1) { + hashmarkcount++; + iscomment = true; + } else + iscomment = false; + if(hashmarkcount < 6 && !iscomment ){ #get the first vector (x) + x[i]=$1; + i++; + } + else if ( !iscomment ){ # so we are at y + y[j]=$1; + j++; + } + +}END{ + # first padding at the beginning + for (j=0.2;j<x[0];j+=0.2) { + printf("%6.3f %6.4f\n", j,3.0); + } + # note i sould be equal to y + # we are considering 'i' number of data ( + # ys without x values will be discarded, xs without y will + # get y value 0 + # we are treating 'i' as the length of the vectors + for (j=0;j<i;j++) { + printf("%6.3f %6.4f\n", x[j],y[j]); + } + # zero padding at the end + for(j=x[j-1]+0.2;j<=12.0;j+=0.2) { + printf("%6.3f %6.4f\n", j,0.0); + } +}