Bio::Graphics::Glyph::splice_site - The "splice_site" glyph


Bio-Graphics documentation Contained in the Bio-Graphics distribution.

Index


Code Index:

NAME

Top

Bio::Graphics::Glyph::splice_site - The "splice_site" glyph

SYNOPSIS

Top

  See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>.

DESCRIPTION

Top

This glyph was designed to show an inverted "L" representing splice donors and acceptors. The vertical part of the L points downwards and is positioned in the center of the range (even if the range is quite large).

In addition to the usual glyph options, this glyph recognizes:

   Option            Value              Description
   ------            -----              -----------

   direction         "left" or "right"  direction the short part of the L
                                        points

   height_fraction   0.0 - 1.0          fractional height of the glyph,
                                        usually a callback that uses the
                                        feature's score to determine its
                                        height

BUGS

Top

Please report them.

SEE ALSO

Top

Bio::Graphics::Panel, Bio::Graphics::Glyph, Bio::Graphics::Glyph::arrow, Bio::Graphics::Glyph::cds, Bio::Graphics::Glyph::crossbox, Bio::Graphics::Glyph::diamond, Bio::Graphics::Glyph::dna, Bio::Graphics::Glyph::dot, Bio::Graphics::Glyph::ellipse, Bio::Graphics::Glyph::extending_arrow, Bio::Graphics::Glyph::generic, Bio::Graphics::Glyph::graded_segments, Bio::Graphics::Glyph::heterogeneous_segments, Bio::Graphics::Glyph::line, Bio::Graphics::Glyph::pinsertion, Bio::Graphics::Glyph::primers, Bio::Graphics::Glyph::rndrect, Bio::Graphics::Glyph::chromosome, Bio::Graphics::Glyph::segments, Bio::Graphics::Glyph::ruler_arrow, Bio::Graphics::Glyph::toomany, Bio::Graphics::Glyph::transcript, Bio::Graphics::Glyph::transcript2, Bio::Graphics::Glyph::translation, Bio::Graphics::Glyph::triangle, Bio::DB::GFF, Bio::SeqI, Bio::SeqFeatureI, Bio::Das, GD

AUTHOR

Top

Xiaokang Pan <pan@cshl.org>

Copyright (c) 2001 BDGP

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.


Bio-Graphics documentation Contained in the Bio-Graphics distribution.

package Bio::Graphics::Glyph::splice_site;

use strict;
use base qw(Bio::Graphics::Glyph::generic);

use constant PWIDTH => 3;

sub draw_component {
  my $self = shift;
  my $gd = shift;
  my ($left,$top) = @_;
  my($x1,$y1,$x2,$y2) = $self->bounds(@_); 

  my $center = int(0.5+($x1+$x2)/2);
  my $direction = $self->option('direction');
  
  my $height    = $y2 - $y1;
  my $fraction  = $self->option('height_fraction') || 1.0;
  my $bottom    = $y2;
  $top          = $y2 - $fraction * $height;
  
  # draw the base
  my $fgcolor = $self->fgcolor;
  $gd->line($center,$bottom,$center,$top,$fgcolor);

  if ($direction eq 'right') {
    $gd->line($center,$top,$center + PWIDTH,$top,$fgcolor);
  } elsif ($direction eq 'left') {
    $gd->line($center,$top,$center - PWIDTH,$top,$fgcolor);
  }
    
}

1;