*** frameplot-2.3.pl.orig Tue May 9 11:22:42 2000
--- frameplot-2.3.pl Tue May 9 12:03:51 2000
***************
*** 4,8 ****
$TITLE = 'FramePlot';
! $VERSION = '2.3';
$COPYRIGHT = '(c) 1996-1999, ISHIKAWA Jun';
$AUTHOR = 'jun@nih.go.jp';
--- 4,8 ----
$TITLE = 'FramePlot';
! $VERSION = '2.3GD';
$COPYRIGHT = '(c) 1996-1999, ISHIKAWA Jun';
$AUTHOR = 'jun@nih.go.jp';
***************
*** 23,28 ****
# perl version 5.001, 5.003 or later
#
! # fly version 1.6.0 or later
! #
#
# INSTALLATION
--- 23,28 ----
# perl version 5.001, 5.003 or later
#
! # GD.pm version 1.20 or later
! #
#
# INSTALLATION
***************
*** 33,38 ****
# 2. Specify following paths:
#
- # Where is your fly binary?
- $flyprog = "/usr/local/bin/fly";
# Where output image should go
$outpath = "/usr/local/apache/share/htdocs/frameplot";
--- 33,36 ----
***************
*** 45,53 ****
$LOGGING = 0; # 0 or 1
! $outfilename = "frame$$.gif";
$bgcolor = "#eeeeff";
$HelpDoc = "http://www.nih.go.jp/~jun/research/frameplot/help.html";
# Timeout: generate SIGALRM after 30 min.
--- 43,52 ----
$LOGGING = 0; # 0 or 1
! $outfilename = "frame$$.png";
$bgcolor = "#eeeeff";
$HelpDoc = "http://www.nih.go.jp/~jun/research/frameplot/help.html";
+ use GD;
# Timeout: generate SIGALRM after 30 min.
***************
*** 283,296 ****
my $lm = 20;
! open(FLY,"| $flyprog -q -o $outpath/$outfilename");
! print FLY "new\n";
! print FLY "size $imagesize{'width'},$imagesize{'height'}\n";
# color definition
! $red = "255,0,0";
! $green = "0,127,0";
! $blue = "0,0,255";
! $black = "0,0,0";
! $white = "255,255,255";
if ($FORM{'color'} =~ /^c/io) {
$BW = 0;
--- 282,293 ----
my $lm = 20;
! $im = new GD::Image($imagesize{'width'},$imagesize{'height'});
# color definition
! $red = $im->colorAllocate(255,0,0);
! $green = $im->colorAllocate(0,127,0);
! $blue = $im->colorAllocate(0,0,255);
! $black = $im->colorAllocate(0,0,0);
! $white = $im->colorAllocate(255,255,255);
if ($FORM{'color'} =~ /^c/io) {
$BW = 0;
***************
*** 304,333 ****
@linecolor = ("$black", "$black", "$black" );
@clinecolor = ("$black", "$black", "$black" );
! my $style0 = "$black,$black";
! my $style1 = "$black,$black,$black,$white,$white,$white";
! my $style2 = "$black,$white,$white";
! %linestyle = ( 0 => "$style0", 1 => "$style1", 2 => "$style2" );
! %clinestyle = ( 0 => "$style1", 1 => "$style0", 2 => "$style2" )
! if ($seqmod3 == 0);
! %clinestyle = ( 0 => "$style2", 1 => "$style1", 2 => "$style0" )
! if ($seqmod3 == 1);
! %clinestyle = ( 0 => "$style0", 1 => "$style2", 2 => "$style1" )
! if ($seqmod3 == 2);
! }
!
! print FLY "fill 1,1,$white\n";
! print FLY "string $black,$lm,5,medium,$TITLE $VERSION - $COPYRIGHT\n";
! print FLY "string $black,$lm,18,small,",
! "FEMS Microbiol. Lett. 174:251-253 (1999)\n";
! print FLY "string $black,$lm,31,medium,",
! "Target: $FORM{'label'} $seqlen bp; ",
! "$avgc% G+C (dashed line)\n";
! print FLY "string $black,$lm,44,medium,",
! "Window: $FORM{'window'}, ",
! "Step: $FORM{'step'}, ",
! "Start codon [>]: @codons \n";
! print FLY "string $black,$lm,57,medium,",
! "Minimum ORF: $FORM{'minorf'}, ",
! "Date: $timestamp\n";
# draw graph
--- 301,324 ----
@linecolor = ("$black", "$black", "$black" );
@clinecolor = ("$black", "$black", "$black" );
! my @style0 = ("$black","$black");
! my @style1 = ("$black","$black","$black","$white","$white","$white");
! my @style2 = ("$black","$white","$white");
! @linestyle = ([@style0], [@style1], [@style2]);
! @clinestyle = ([@style1], [@style0], [@style2]) if ($seqmod3 == 0);
! @clinestyle = ([@style2], [@style1], [@style0]) if ($seqmod3 == 1);
! @clinestyle = ([@style0], [@style2], [@style1]) if ($seqmod3 == 2);
! }
!
! $im->fill(1,1,$white);
! $im->string(gdMediumBoldFont,$lm,5,
! "$TITLE $VERSION - $COPYRIGHT",$black);
! $im->string(gdSmallFont,$lm,18,
! "FEMS Microbiol. Lett. 174:251-253 (1999)",$black);
! $im->string(gdMediumBoldFont,$lm,31,
! "Target: $FORM{'label'} $seqlen bp; $avgc% G+C (dashed line)",$black);
! $im->string(gdMediumBoldFont,$lm,44,
! "Window: $FORM{'window'}, Step: $FORM{'step'}, Start codon [>]: @codons",$black);
! $im->string(gdMediumBoldFont,$lm,57,
! "Minimum ORF: $FORM{'minorf'}, Date: $timestamp",$black);
# draw graph
***************
*** 336,340 ****
$x2 = $margin{'left'} + $graphsize{'width'};
$y2 = $margin{'top'} + $graphsize{'height'};
! print FLY "rect $x1,$y1,$x2,$y2,$black\n";
# X axis
for ($i = 100; $i < $seqlen; $i += 100) {
--- 327,331 ----
$x2 = $margin{'left'} + $graphsize{'width'};
$y2 = $margin{'top'} + $graphsize{'height'};
! $im->rectangle($x1,$y1,$x2,$y2,$black);
# X axis
for ($i = 100; $i < $seqlen; $i += 100) {
***************
*** 347,355 ****
}
$y2 = &ycoord(0);
! print FLY "line $x1,$y1,$x1,$y2,$black\n";
if (($i % 1000) == 0) {
$x = $x1 - 10;
$y = $margin{'top'} + $graphsize{'height'} + 5;
! print FLY "string $black,$x,$y,small,$i\n";
}
}
--- 338,346 ----
}
$y2 = &ycoord(0);
! $im->line($x1,$y1,$x1,$y2,$black);
if (($i % 1000) == 0) {
$x = $x1 - 10;
$y = $margin{'top'} + $graphsize{'height'} + 5;
! $im->string(gdSmallFont,$x,$y,$i,$black);
}
}
***************
*** 357,361 ****
$x = $margin{'left'} - 18 ;
$y = &ycoord(45);
! print FLY "stringup $black,$x,$y,small,G+C(%)\n";
for ($i = 10; $i < 100; $i += 10) {
$x1 = &xcoord(0);
--- 348,352 ----
$x = $margin{'left'} - 18 ;
$y = &ycoord(45);
! $im->stringUp(gdSmallFont,$x,$y,"G+C(%)",$black);
for ($i = 10; $i < 100; $i += 10) {
$x1 = &xcoord(0);
***************
*** 367,371 ****
$x2 = $x1 + 3;
}
! print FLY "line $x1,$y1,$x2,$y1,$black\n";
}
# draw average GC%
--- 358,362 ----
$x2 = $x1 + 3;
}
! $im->line($x1,$y1,$x2,$y1,$black);
}
# draw average GC%
***************
*** 373,380 ****
$x2 = &xcoord($seqlen);
$y1 = &ycoord($avgc);
! print FLY "dline $x1,$y1,$x2,$y1,$black\n";
# plot 3rd-letter GC%
for $frame (0 .. 2) {
! print FLY "setstyle $linestyle{$frame}\n" if ($BW);
for $i (0 .. ($#{$gc[$frame]} - 1)) {
$x1 = &xcoord((($i * 3) * $FORM{step}) + ($winlen / 2));
--- 364,371 ----
$x2 = &xcoord($seqlen);
$y1 = &ycoord($avgc);
! $im->dashedLine($x1,$y1,$x2,$y1,$black);
# plot 3rd-letter GC%
for $frame (0 .. 2) {
! $im->setStyle(@{$linestyle[$frame]}) if ($BW);
for $i (0 .. ($#{$gc[$frame]} - 1)) {
$x1 = &xcoord((($i * 3) * $FORM{step}) + ($winlen / 2));
***************
*** 382,386 ****
$x2 = &xcoord(((($i+1) * 3) * $FORM{step}) + ($winlen / 2));
$y2 = &ycoord($gc[$frame][$i+1]);
! print FLY "line $x1,$y1,$x2,$y2,@linecolor[$frame]\n";
}
print FLY "killstyle\n" if ($BW);
--- 373,382 ----
$x2 = &xcoord(((($i+1) * 3) * $FORM{step}) + ($winlen / 2));
$y2 = &ycoord($gc[$frame][$i+1]);
! if ($BW) {
! $im->line($x1,$y1+1,$x2,$y2+1,gdStyled);
! }
! else {
! $im->line($x1,$y1+1,$x2,$y2+1,$linecolor[$frame]);
! }
}
print FLY "killstyle\n" if ($BW);
***************
*** 394,398 ****
$y = ($margin{'top'} - 80) + $frame * 12;
$c = @linecolor[$frame];
! print FLY "string $c,$x,$y,small,",$frame+1,":\n";
# start codon
my $prevstop = 0;
--- 390,395 ----
$y = ($margin{'top'} - 80) + $frame * 12;
$c = @linecolor[$frame];
! $tmp = $frame+1;
! $im->string(gdSmallFont,$x,$y,"$tmp:",$c);
# start codon
my $prevstop = 0;
***************
*** 400,407 ****
$x = &xcoord($start) - 5;
$y = ($margin{'top'} - 80) + $frame * 12;
! print FLY "string $c,$x,$y,medium,>\n"
if $FORM{substr $seq, $start-1, 3};
# ORF
! print FLY "setstyle $linestyle{$frame}\n" if ($BW);
for $stop (@{$stop[$frame+1]}) {
if ($stop > $start) {
--- 397,404 ----
$x = &xcoord($start) - 5;
$y = ($margin{'top'} - 80) + $frame * 12;
! $im->string(gdMediumBoldFont,$x,$y,">",$c)
if $FORM{substr $seq, $start-1, 3};
# ORF
! $im->setStyle(@{$linestyle[$frame]}) if ($BW);
for $stop (@{$stop[$frame+1]}) {
if ($stop > $start) {
***************
*** 412,416 ****
$x2 = &xcoord($stop);
$y += 6;
! print FLY "line $x1,$y,$x2,$y,$c\n";
$prevstop = $stop;
}
--- 409,418 ----
$x2 = &xcoord($stop);
$y += 6;
! if ($BW) {
! $im->line($x1,$y,$x2,$y,gdStyled);
! }
! else {
! $im->line($x1,$y,$x2,$y,$c);
! }
$prevstop = $stop;
}
***************
*** 418,422 ****
}
}
- print FLY "killstyle\n" if ($BW);
}
# stop codon
--- 420,423 ----
***************
*** 424,428 ****
$x = &xcoord($stop) - 3;
$y = ($margin{'top'} - 80) + $frame * 12;
! print FLY "string $c,$x,$y,medium,|\n"
if substr($seq, $stop-1, 3) =~ /(TGA|TAG|TAA)/;
}
--- 425,429 ----
$x = &xcoord($stop) - 3;
$y = ($margin{'top'} - 80) + $frame * 12;
! $im->string(gdMediumBoldFont,$x,$y,"|",$c)
if substr($seq, $stop-1, 3) =~ /(TGA|TAG|TAA)/;
}
***************
*** 432,436 ****
$y = ($margin{'top'} - 40) + $frame * 12;
$c = @clinecolor[$frame];
! print FLY "string $c,$x,$y,small,",$frame+1,":\n";
# strat codon
my $showflag = 0;
--- 433,438 ----
$y = ($margin{'top'} - 40) + $frame * 12;
$c = @clinecolor[$frame];
! $tmp = $frame+1;
! $im->string(gdSmallFont,$x,$y,"$tmp:",$c);
# strat codon
my $showflag = 0;
***************
*** 443,450 ****
$x = &xcoord($start);
$y = ($margin{'top'} - 40) + $frame * 12;
! $showflag ? print FLY "string $c,$x,$y,medium,<\n"
: ($showflag = 1);
# ORF
! print FLY "setstyle $clinestyle{$frame}\n" if ($BW);
for $stop (@{$cstop[$frame+1]}) {
if ($stop < $start) {
--- 445,452 ----
$x = &xcoord($start);
$y = ($margin{'top'} - 40) + $frame * 12;
! $showflag ? $im->string(gdMediumBoldFont,$x,$y,"<",$c)
: ($showflag = 1);
# ORF
! $im->setStyle(@{$clinestyle[$frame]}) if ($BW);
for $stop (@{$cstop[$frame+1]}) {
if ($stop < $start) {
***************
*** 455,459 ****
$x2 = &xcoord($stop);
$y += 6;
! print FLY "line $x1,$y,$x2,$y,$c\n";
$prevstop = $stop;
}
--- 457,466 ----
$x2 = &xcoord($stop);
$y += 6;
! if ($BW) {
! $im->line($x1,$y,$x2,$y,gdStyled);
! }
! else {
! $im->line($x1,$y,$x2,$y,$c);
! }
$prevstop = $stop;
}
***************
*** 461,465 ****
}
}
- print FLY "killstyle\n" if ($BW);
}
# stop codon
--- 468,471 ----
***************
*** 467,477 ****
$x = &xcoord($stop) - 2;
$y = ($margin{'top'} - 40) + $frame * 12;
! print FLY "string $c,$x,$y,medium,|\n"
if substr($seq, $stop-3, 3) =~ /(TCA|CTA|TTA)/;
}
}
! print FLY "interlace\n";
! close(FLY);
$DEBUG and $DrawTime = time;
} # end of drawimage
--- 473,485 ----
$x = &xcoord($stop) - 2;
$y = ($margin{'top'} - 40) + $frame * 12;
! $im->string(gdMediumBoldFont,$x,$y,"|",$c)
if substr($seq, $stop-3, 3) =~ /(TCA|CTA|TTA)/;
}
}
! $im->interlaced('true');
! open(PNG,">$outpath/$outfilename");
! print PNG $im->png;
! close(PNG);
$DEBUG and $DrawTime = time;
} # end of drawimage
***************
*** 510,515 ****
Graph plotting done with
! Fly,
! by Martin Gleeson.