Mercurial > repos > dereeper > sniplay
diff hapmap2mlmm/transpose.awk @ 9:98c37a5d67f4 draft
Uploaded
author | dereeper |
---|---|
date | Wed, 07 Feb 2018 22:08:47 -0500 |
parents | 420b57c3c185 |
children | c6640c49fd01 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hapmap2mlmm/transpose.awk Wed Feb 07 22:08:47 2018 -0500 @@ -0,0 +1,27 @@ +#!/usr/bin/gawk -f + +BEGIN { + max_x =0; + max_y =0; +} + +{ + max_y++; + for( i=1; i<=NF; i++ ) + { + if (i>max_x) max_x=i; + A[i,max_y] = $i; + } +} + +END { + for ( x=1; x<=max_x; x++ ) + { + for ( y=1; y<=max_y; y++ ) + { + if ( (x,y) in A ) printf "%s",A[x,y]; + if ( y!=max_y ) printf " "; + } + printf "\n"; + } +}