8 last if /\(%Miss\) : Inferred clusters/;
11 my @color = ("#FF0000", "#00FF00", "#0000FF", "#00FFFF", "#FF00FF", "#FFFF00", "#800000", "#008000", "#000080", "#008080", "#800080", "#808000");
12 my @PO; # Probability of inferred clusters with original order
13 my @pg; # Probability of inferred clusters grouped by numerical order of the max probability
14 my $num_clust; # Number of clusters
15 my $num_indiv; # Number of individuals
21 my @b = split / /, $a[1];
22 $num_clust = @b unless $num_clust;
24 unshift @b, $num_indiv;
25 my $max_order = 1; # The numerical order of the max probability
26 foreach (1 .. $num_clust) {
27 if ($b[$_] > $b[$max_order]) {
31 push @
{$pg[$max_order]}, \
@b;
36 my @PQ; # Probability of inferred clusters sort by Q
37 foreach (1 .. $num_clust) {
39 push @PQ, sort {${$b}[$_] <=> ${$a}[$_]} @
{$pg[$_]};
42 open O
, ">", "$in.svg";
43 # SVG attribute definitions
44 my $w = 10 * $num_indiv + 20;
46 print O
"<?xml version=\"1.0\"?>\n";
47 print O
"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"$w\" height=\"$h\">\n";
48 print O
"<g transform=\"translate(10,10)\">\n\n";
51 foreach my $indiv (0 .. $num_indiv-1) {
56 foreach my $clust (1 .. $num_clust) {
57 my $hPO = 100*$PO[$indiv][$clust];
58 my $hPQ = 100*$PQ[$indiv][$clust];
59 print O
"<rect x=\"$xr\" y=\"$yrPO\" width=\"10\" height=\"$hPO\" fill=\"$color[$clust-1]\"/>\n";
60 print O
"<rect x=\"$xr\" y=\"$yrPQ\" width=\"10\" height=\"$hPQ\" fill=\"$color[$clust-1]\"/>\n";
64 my $numPO = sprintf("%03d", $PO[$indiv][0]);
65 my $numPQ = sprintf("%03d", $PQ[$indiv][0]);
66 print O
"<text x=\"$xt\" y=\"105\" font-family=\"Courier\" font-size=\"4\" fill=\"black\">$numPO</text>\n";
67 print O
"<text x=\"$xt\" y=\"220\" font-family=\"Courier\" font-size=\"4\" fill=\"black\">$numPQ</text>\n";
70 print O
"\n</g>\n</svg>\n";