1
package Bio::Graphics::Glyph::primers;
2
#$Id: primers.pm,v 1.7.4.3 2006/10/02 23:10:20 sendu Exp $
3
# package to use for drawing something that looks like
7
use base qw(Bio::Graphics::Glyph::generic);
9
use constant HEIGHT => 8;
11
# override draw method
15
my ($x1,$y1,$x2,$y2) = $self->calculate_boundaries(@_);
16
my $height = $self->option('height') || $self->option('size') || HEIGHT;
18
my $fg = $self->fgcolor;
20
my $center = $y1 + $a2;
23
# just draw us as a solid line -- very simple
24
if ($x2-$x1 < $height*2) {
25
$gd->line($x1,$center,$x2,$center,$fg);
29
# otherwise draw two pairs of arrows
31
my $trunc_left = $x1 < $self->panel->left;
32
my $trunc_right = $x2 > $self->panel->right;
34
unless ($trunc_left) {
35
$gd->setThickness(2) if $height > 6;
36
$gd->line($x1,$center,$x1 + $height,$center,$fg);
37
$gd->line($x1 + $height,$center,$x1 + $height - $a2,$center-$a2,$fg);
38
$gd->line($x1 + $height,$center,$x1 + $height - $a2,$center+$a2,$fg);
42
unless ($trunc_right) {
43
$gd->setThickness(2) if $height > 6;
44
$gd->line($x2,$center,$x2 - $height,$center,$fg);
45
$gd->line($x2 - $height,$center,$x2 - $height + $a2,$center+$a2,$fg);
46
$gd->line($x2 - $height,$center,$x2 - $height + $a2,$center-$a2,$fg);
50
# connect the dots if requested
52
my $c = $self->color('connect_color') || $self->bgcolor;
53
$gd->line($x1 + ($trunc_left ? 0 : $height + 2),$center,
54
$x2 - ($trunc_right ? 0 : $height + 2),$center,
58
# add a label if requested
59
$self->draw_label($gd,@_) if $self->option('label');
60
$self->draw_description($gd,@_) if $self->option('description');
66
return $self->option('connect') if defined $self->option('connect');
76
Bio::Graphics::Glyph::primers - The "STS primers" glyph
80
See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>.
84
This glyph draws two arrows oriented towards each other and connected
85
by a line of a contrasting color. The length of the arrows is
86
immaterial, but the length of the glyph itself corresponds to the
87
length of the scaled feature.
91
In addition to the common options, the following glyph-specific
92
options are recognized:
94
Option Description Default
95
------ ----------- -------
97
-connect Whether to connect the true
98
two arrowheads by a line.
100
-connect_color The color to use for the bgcolor
110
L<Bio::Graphics::Panel>,
111
L<Bio::Graphics::Glyph>,
112
L<Bio::Graphics::Glyph::arrow>,
113
L<Bio::Graphics::Glyph::cds>,
114
L<Bio::Graphics::Glyph::crossbox>,
115
L<Bio::Graphics::Glyph::diamond>,
116
L<Bio::Graphics::Glyph::dna>,
117
L<Bio::Graphics::Glyph::dot>,
118
L<Bio::Graphics::Glyph::ellipse>,
119
L<Bio::Graphics::Glyph::extending_arrow>,
120
L<Bio::Graphics::Glyph::generic>,
121
L<Bio::Graphics::Glyph::graded_segments>,
122
L<Bio::Graphics::Glyph::heterogeneous_segments>,
123
L<Bio::Graphics::Glyph::line>,
124
L<Bio::Graphics::Glyph::pinsertion>,
125
L<Bio::Graphics::Glyph::primers>,
126
L<Bio::Graphics::Glyph::rndrect>,
127
L<Bio::Graphics::Glyph::segments>,
128
L<Bio::Graphics::Glyph::ruler_arrow>,
129
L<Bio::Graphics::Glyph::toomany>,
130
L<Bio::Graphics::Glyph::transcript>,
131
L<Bio::Graphics::Glyph::transcript2>,
132
L<Bio::Graphics::Glyph::translation>,
133
L<Bio::Graphics::Glyph::triangle>,
142
Allen Day E<lt>day@cshl.orgE<gt>.
144
Copyright (c) 2001 Cold Spring Harbor Laboratory
146
This library is free software; you can redistribute it and/or modify
147
it under the same terms as Perl itself. See DISCLAIMER.txt for
148
disclaimers of warranty.