annotate hapmap2mlmm/transpose.awk @ 13:734a3572c1d6 draft

Uploaded
author dereeper
date Tue, 08 Jan 2019 08:45:34 -0500
parents c6640c49fd01
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
1 BEGIN {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
2 max_x =0;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
3 max_y =0;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
4 }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
5
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
6 {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
7 max_y++;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
8 for( i=1; i<=NF; i++ )
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
9 {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
10 if (i>max_x) max_x=i;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
11 A[i,max_y] = $i;
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
12 }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
13 }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
14
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
15 END {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
16 for ( x=1; x<=max_x; x++ )
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
17 {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
18 for ( y=1; y<=max_y; y++ )
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
19 {
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
20 if ( (x,y) in A ) printf "%s",A[x,y];
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
21 if ( y!=max_y ) printf " ";
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
22 }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
23 printf "\n";
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
24 }
420b57c3c185 Uploaded
dereeper
parents:
diff changeset
25 }