Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/Graphics/Glyph/pinsertion.pm @ 0:1f6dce3d34e0
Uploaded
author | mahtabm |
---|---|
date | Thu, 11 Apr 2013 02:01:53 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1f6dce3d34e0 |
---|---|
1 package Bio::Graphics::Glyph::pinsertion; | |
2 # package to use for drawing P insertion as a triangle | |
3 # p insertion is a point (one base). | |
4 | |
5 use strict; | |
6 use GD; | |
7 use vars '@ISA'; | |
8 @ISA = 'Bio::Graphics::Glyph::generic'; | |
9 use Bio::Graphics::Glyph::generic; | |
10 | |
11 sub box { | |
12 my $self = shift; | |
13 my $half = $self->insertion_width/2; | |
14 return ($self->left-$half,$self->top,$self->right+$half,$self->bottom); | |
15 } | |
16 | |
17 sub insertion_width { | |
18 my $self = shift; | |
19 return $self->option('insertion_width') || 6; | |
20 } | |
21 | |
22 # override draw method | |
23 sub draw { | |
24 my $self = shift; | |
25 | |
26 my $gd = shift; | |
27 my ($left,$top) = @_; | |
28 my ($x1,$y1,$x2,$y2) = $self->calculate_boundaries(@_); | |
29 | |
30 my $height = $self->height; | |
31 | |
32 my $half = $self->insertion_width/2; | |
33 | |
34 my $fill = $self->bgcolor; | |
35 | |
36 my $poly = GD::Polygon->new; | |
37 | |
38 if ($self->feature->strand > 0) { #plus strand | |
39 $poly->addPt($x1 - $half, $y1); | |
40 $poly->addPt($x1 + ($half), $y1); | |
41 $poly->addPt($x1, $y2); #pointer down | |
42 } else { | |
43 $poly->addPt($x1, $y1); #pointer up | |
44 $poly->addPt($x1 - $half, $y2); | |
45 $poly->addPt($x1 + ($half), $y2); | |
46 } | |
47 $gd->filledPolygon($poly, $fill); | |
48 $gd->polygon($poly, $fill); | |
49 | |
50 # add a label if requested | |
51 $self->draw_label($gd,$left,$top) if $self->option('label'); | |
52 $self->draw_description($gd,$left,$top) if $self->option('description'); | |
53 } | |
54 | |
55 | |
56 1; | |
57 | |
58 =head1 NAME | |
59 | |
60 Bio::Graphics::Glyph::pinsertion - The "Drosophila P-element Insertion" glyph | |
61 | |
62 =head1 SYNOPSIS | |
63 | |
64 See L<Bio::Graphics::Panel> and L<Bio::Graphics::Glyph>. | |
65 | |
66 =head1 DESCRIPTION | |
67 | |
68 This glyph was designed to show P-element insertions in the Drosophila | |
69 genome, but in fact is suitable for any type of zero-width feature. | |
70 Also see the triangle glyph. | |
71 | |
72 =head2 OPTIONS | |
73 | |
74 In addition to the generic options, this glyph recognizes: | |
75 | |
76 Option Name Description Default | |
77 ----------- ----------- ------- | |
78 | |
79 -insertion_width Width of glyph in pixels 3 | |
80 | |
81 =head1 BUGS | |
82 | |
83 Please report them. | |
84 | |
85 =head1 SEE ALSO | |
86 | |
87 L<Bio::Graphics::Panel>, | |
88 L<Bio::Graphics::Glyph>, | |
89 L<Bio::Graphics::Glyph::arrow>, | |
90 L<Bio::Graphics::Glyph::cds>, | |
91 L<Bio::Graphics::Glyph::crossbox>, | |
92 L<Bio::Graphics::Glyph::diamond>, | |
93 L<Bio::Graphics::Glyph::dna>, | |
94 L<Bio::Graphics::Glyph::dot>, | |
95 L<Bio::Graphics::Glyph::ellipse>, | |
96 L<Bio::Graphics::Glyph::extending_arrow>, | |
97 L<Bio::Graphics::Glyph::generic>, | |
98 L<Bio::Graphics::Glyph::graded_segments>, | |
99 L<Bio::Graphics::Glyph::heterogeneous_segments>, | |
100 L<Bio::Graphics::Glyph::line>, | |
101 L<Bio::Graphics::Glyph::pinsertion>, | |
102 L<Bio::Graphics::Glyph::primers>, | |
103 L<Bio::Graphics::Glyph::rndrect>, | |
104 L<Bio::Graphics::Glyph::segments>, | |
105 L<Bio::Graphics::Glyph::ruler_arrow>, | |
106 L<Bio::Graphics::Glyph::toomany>, | |
107 L<Bio::Graphics::Glyph::transcript>, | |
108 L<Bio::Graphics::Glyph::transcript2>, | |
109 L<Bio::Graphics::Glyph::translation>, | |
110 L<Bio::Graphics::Glyph::triangle>, | |
111 L<Bio::DB::GFF>, | |
112 L<Bio::SeqI>, | |
113 L<Bio::SeqFeatureI>, | |
114 L<Bio::Das>, | |
115 L<GD> | |
116 | |
117 =head1 AUTHOR | |
118 | |
119 Allen Day E<lt>day@cshl.orgE<gt>, Shengqiang Shu E<lt>sshu@bdgp.lbl.govE<gt> | |
120 | |
121 Copyright (c) 2001 Cold Spring Harbor Laboratory, BDGP | |
122 | |
123 This library is free software; you can redistribute it and/or modify | |
124 it under the same terms as Perl itself. See DISCLAIMER.txt for | |
125 disclaimers of warranty. | |
126 | |
127 =cut |