3
use lib '.','../..','./blib/lib','../../blib/lib','../..';
5
use Bio::Graphics::Panel;
6
use Bio::Graphics::Feature;
8
chomp (my $PKG = shift);
9
$PKG or die "\nUsage: lots_of_glyphs IMAGE_CLASS
10
\t- where IMAGE_CLASS is one of GD or GD::SVG
11
\t- GD generate png output; GD::SVG generates SVG.\n";
13
my $ftr = 'Bio::Graphics::Feature';
15
my $segment = $ftr->new(-start=>-100,-end=>1400,-name=>'ZK154',-type=>'clone');
16
my $zk154_1 = $ftr->new(-start=>-50,-end=>800,-name=>'ZK154.1',-type=>'gene');
17
my $zk154_2 = $ftr->new(-segments=>[[200,300],[380,800]],-name=>'ZK154.2',-type=>'gene');
18
my $zk154_3 = $ftr->new(-start=>900,-end=>1200,-name=>'ZK154.3',-type=>'gene');
20
my $zed_27 = $ftr->new(-segments=>[[550,600],[800,950],[1200,1300]],
22
-subtype=>'exon',-type=>'transcript');
23
my $abc3 = $ftr->new(-segments=>[[100,200],[350,400],[500,550]],
26
-subtype=>'exon',-type=>'transcript');
27
my $xyz4 = $ftr->new(-segments=>[[40,80],[100,120],[200,280],[300,320]],
29
-subtype=>'predicted',-type=>'alignment');
31
my $m3 = $ftr->new(-segments=>[[20,40],[30,60],[90,270],[290,300]],
33
-subtype=>'predicted',-type=>'alignment');
35
my $bigone = $ftr->new(-segments=>[[-200,-120],[90,270],[290,300]],
37
-subtype=>'predicted',-type=>'alignment');
39
my $fred_12 = $ftr->new(-segments=>[$xyz4,$zed_27],
43
my $confirmed_exon1 = $ftr->new(-start=>1,-stop=>20,
46
-name => 'confirmed1',
48
my $predicted_exon1 = $ftr->new(-start=>30,-stop=>50,
51
-source=>'predicted');
52
my $predicted_exon2 = $ftr->new(-start=>60,-stop=>100,
54
-type=>'exon',-source=>'predicted');
56
my $confirmed_exon3 = $ftr->new(-start=>150,-stop=>190,
57
-type=>'exon',-source=>'confirmed',
59
my $partial_gene = $ftr->new(-segments=>[$confirmed_exon1,$predicted_exon1,$predicted_exon2,$confirmed_exon3],
60
-name => 'partial gene',
61
-type => 'transcript',
62
-source => '(from a big annotation pipeline)'
64
my @segments = $partial_gene->segments;
71
my $panel = Bio::Graphics::Panel->new(
72
-gridcolor => 'lightcyan',
81
-key_style => 'between',
84
my @colors = $panel->color_names();
86
my $t = $panel->add_track(
87
transcript2 => [$abc3,$zed_27],
91
# -tkcolor => $colors[rand @colors],
93
$t->configure(-bump=>1);
94
$panel->add_track($segment,
96
-label => sub {scalar localtime},
97
# -labelfont => 'gdMediumBoldFont',
101
-arrowstyle=>'regular',
106
$panel->add_track(generic => [$segment,$abc3,$zk154_1,[$zk154_2,$xyz4]],
107
-label => sub { $_[-1]->level == 0 } ,
108
-bgcolor => sub { shift->primary_tag eq 'predicted' ? 'green' : 'blue'},
109
-connector => sub { my $primary_tag = shift->primary_tag;
110
$primary_tag eq 'transcript' ? 'hat'
111
: $primary_tag eq 'alignment' ? 'solid'
113
-connector_color => 'black',
116
# -tkcolor => $colors[rand @colors],
120
my $track = $panel->add_track('transcript2'=> [$bigone],
122
-connector => 'solid',
127
-relative_coords => 1,
130
-key => 'Dynamically Added');
131
#$track->add_feature($bigone,$zed_27,$abc3);
132
#$track->add_group($predicted_exon1,$predicted_exon2,$confirmed_exon3);
133
$track->add_group($bigone,$zed_27,$zk154_2,$bigone);
136
my @boxes = $panel->boxes;
137
my $red = $panel->translate_color('red');
138
for my $box (@boxes) {
139
my ($feature,@points) = @$box;
141
my $type = ($PKG eq 'GD') ? 'png' : 'svg';