Bio-Palantir
view release on metacpan or search on metacpan
bin/draw_bgc_maps.pl view on Meta::CPAN
$img->moveTo( ($x1 + $x2)/2 - (15 * length $domain->{$ARGV_label}),
($y_start + $y_end)/2 + 12.5 +
$domain->{y_cluster} + $domain->{y_overlap} )
;
$img->font($font);
$img->fontsize(30);
$img->string($domain->{$ARGV_label});
}
# draw legend
my %legend_for = (
'substrate-selection' => { x_start => 0 + $left_margin,
y_start => 150 + $y_cluster, color => 'deepskyblue' },
'carrier-protein' => { x_start => 525 + $left_margin,
y_start => 150 + $y_cluster, color => 'mediumseagreen' },
'condensation' => { x_start => 0 + $left_margin,
y_start => 300 + $y_cluster, color => 'orangered' },
'termination' => { x_start => 525 + $left_margin,
y_start => 300 + $y_cluster, color => 'peru' },
'tailoring/other' => { x_start => 0 + $left_margin,
y_start => 450 + $y_cluster, color => 'navajowhite' },
);
for my $legend (keys %legend_for) {
$img->bgcolor( $legend_for{$legend}{color} );
$img->fgcolor('black');
my $x1 = $legend_for{$legend}{x_start};
my $y1 = $legend_for{$legend}{y_start};
my $x2 = $x1 + 125;
my $y2 = $y1 + 75;
$img->rectangle($x1, $y1, $x2, $y2); # (top_left_x, top_left_y, bottom_right_x, bottom_right_y)
$img->moveTo( $x2 + 15, ($y1 + $y2)/2 + 12.5);
$img->font($font);
$img->fontsize(30);
$img->string($legend);
}
# convert into png data
my $output = $ARGV_outdir . $ARGV_prefix . 'Cluster' . $cluster_rank . '_'
. $cluster_type . '.png';
open my $out, '>', $output;
binmode $out;
print $out $img->png;
return;
( run in 1.301 second using v1.01-cache-2.11-cpan-49f99fa48dc )