annotate admixture/.svn/text-base/transpose.awk.svn-base @ 24:21d878747ac6 draft default tip

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