| Bio-Graphics documentation | Contained in the Bio-Graphics distribution. |
Bio::Graphics::Glyph::pinsertion - The "Drosophila P-element Insertion" glyph
See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>.
This glyph was designed to show P-element insertions in the Drosophila genome, but in fact is suitable for any type of zero-width feature. Also see the triangle glyph.
In addition to the generic options, this glyph recognizes:
Option Name Description Default ----------- ----------- ------- -insertion_width Width of glyph in pixels 3
Please report them.
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::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
Allen Day <day@cshl.org>, Shengqiang Shu <sshu@bdgp.lbl.gov>
Copyright (c) 2001 Cold Spring Harbor Laboratory, 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::pinsertion; # package to use for drawing P insertion as a triangle # p insertion is a point (one base). use strict; use GD; use base qw(Bio::Graphics::Glyph::generic); sub box { my $self = shift; my $half = $self->insertion_width/2; return ($self->left-$half,$self->top,$self->right+$half,$self->bottom); } sub insertion_width { my $self = shift; return $self->option('insertion_width') || 6; } # override draw method sub draw { my $self = shift; my $gd = shift; my ($left,$top) = @_; my ($x1,$y1,$x2,$y2) = $self->calculate_boundaries(@_); my $height = $self->height; my $half = $self->insertion_width/2; my $fill = $self->bgcolor; my $border = $self->fgcolor; my $poly_pkg = $self->polygon_package; my $poly = $poly_pkg->new(); if ($self->feature->strand > 0) { #plus strand $poly->addPt($x1 - $half, $y1); $poly->addPt($x1 + ($half), $y1); $poly->addPt($x1, $y2); #pointer down } else { $poly->addPt($x1, $y1); #pointer up $poly->addPt($x1 - $half, $y2); $poly->addPt($x1 + ($half), $y2); } $gd->filledPolygon($poly,$fill); $gd->polygon($poly,$border); # add a label if requested $self->draw_label($gd,$left,$top) if $self->option('label'); $self->draw_description($gd,$left,$top) if $self->option('description'); } 1;