annotate hapmap2mlmm/transpose.awk @ 5:ec22fcacb66c draft

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