| 1 | package Bio::Graphics::Glyph::splice_site; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use base qw(Bio::Graphics::Glyph::generic); | ||
| 5 | |||
| 6 | use constant PWIDTH => 3; | ||
| 7 | |||
| 8 | sub draw_component { | ||
| 9 | my $self = shift; | ||
| 10 | my $gd = shift; | ||
| 11 | my ($left,$top) = @_; | ||
| 12 | my($x1,$y1,$x2,$y2) = $self->bounds(@_); | ||
| 13 | |||
| 14 | my $center = int(0.5+($x1+$x2)/2); | ||
| 15 | my $direction = $self->option('direction'); | ||
| 16 | |||
| 17 | my $height = $y2 - $y1; | ||
| 18 | my $fraction = $self->option('height_fraction') || 1.0; | ||
| 19 | my $bottom = $y2; | ||
| 20 | $top = $y2 - $fraction * $height; | ||
| 21 | |||
| 22 | # draw the base | ||
| 23 | my $fgcolor = $self->fgcolor; | ||
| 24 | $gd->line($center,$bottom,$center,$top,$fgcolor); | ||
| 25 | |||
| 26 | if ($direction eq 'right') { | ||
| 27 | $gd->line($center,$top,$center + PWIDTH,$top,$fgcolor); | ||
| 28 | } elsif ($direction eq 'left') { | ||
| 29 | $gd->line($center,$top,$center - PWIDTH,$top,$fgcolor); | ||
| 30 | } | ||
| 31 | |||
| 32 | } | ||
| 33 | |||
| 34 | 1; | ||
| 35 | |||
| 36 | |||
| 37 | =head1 NAME | ||
| 38 | |||
| 39 | Bio::Graphics::Glyph::splice_site - The "splice_site" glyph | ||
| 40 | |||
| 41 | =head1 SYNOPSIS | ||
| 42 | |||
| 43 | See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>. | ||
| 44 | |||
| 45 | =head1 DESCRIPTION | ||
| 46 | |||
| 47 | This glyph was designed to show an inverted "L" representing splice | ||
| 48 | donors and acceptors. The vertical part of the L points downwards and | ||
| 49 | is positioned in the center of the range (even if the range is quite | ||
| 50 | large). | ||
| 51 | |||
| 52 | In addition to the usual glyph options, this glyph recognizes: | ||
| 53 | |||
| 54 | Option Value Description | ||
| 55 | ------ ----- ----------- | ||
| 56 | |||
| 57 | direction "left" or "right" direction the short part of the L | ||
| 58 | points | ||
| 59 | |||
| 60 | height_fraction 0.0 - 1.0 fractional height of the glyph, | ||
| 61 | usually a callback that uses the | ||
| 62 | feature's score to determine its | ||
| 63 | height | ||
| 64 | |||
| 65 | =head1 BUGS | ||
| 66 | |||
| 67 | Please report them. | ||
| 68 | |||
| 69 | =head1 SEE ALSO | ||
| 70 | |||
| 71 | |||
| 72 | L<Bio::Graphics::Panel>, | ||
| 73 | L<Bio::Graphics::Glyph>, | ||
| 74 | L<Bio::Graphics::Glyph::arrow>, | ||
| 75 | L<Bio::Graphics::Glyph::cds>, | ||
| 76 | L<Bio::Graphics::Glyph::crossbox>, | ||
| 77 | L<Bio::Graphics::Glyph::diamond>, | ||
| 78 | L<Bio::Graphics::Glyph::dna>, | ||
| 79 | L<Bio::Graphics::Glyph::dot>, | ||
| 80 | L<Bio::Graphics::Glyph::ellipse>, | ||
| 81 | L<Bio::Graphics::Glyph::extending_arrow>, | ||
| 82 | L<Bio::Graphics::Glyph::generic>, | ||
| 83 | L<Bio::Graphics::Glyph::graded_segments>, | ||
| 84 | L<Bio::Graphics::Glyph::heterogeneous_segments>, | ||
| 85 | L<Bio::Graphics::Glyph::line>, | ||
| 86 | L<Bio::Graphics::Glyph::pinsertion>, | ||
| 87 | L<Bio::Graphics::Glyph::primers>, | ||
| 88 | L<Bio::Graphics::Glyph::rndrect>, | ||
| 89 | L<Bio::Graphics::Glyph::chromosome>, | ||
| 90 | L<Bio::Graphics::Glyph::segments>, | ||
| 91 | L<Bio::Graphics::Glyph::ruler_arrow>, | ||
| 92 | L<Bio::Graphics::Glyph::toomany>, | ||
| 93 | L<Bio::Graphics::Glyph::transcript>, | ||
| 94 | L<Bio::Graphics::Glyph::transcript2>, | ||
| 95 | L<Bio::Graphics::Glyph::translation>, | ||
| 96 | L<Bio::Graphics::Glyph::triangle>, | ||
| 97 | L<Bio::DB::GFF>, | ||
| 98 | L<Bio::SeqI>, | ||
| 99 | L<Bio::SeqFeatureI>, | ||
| 100 | L<Bio::Das>, | ||
| 101 | L<GD> | ||
| 102 | |||
| 103 | =head1 AUTHOR | ||
| 104 | |||
| 105 | Xiaokang Pan E<lt>pan@cshl.orgE<gt> | ||
| 106 | |||
| 107 | Copyright (c) 2001 BDGP | ||
| 108 | |||
| 109 | This library is free software; you can redistribute it and/or modify | ||
| 110 | it under the same terms as Perl itself. See DISCLAIMER.txt for | ||
| 111 | disclaimers of warranty. | ||
| 112 | |||
| 113 | =cut |