3
use Bio::Graphics::Panel;
10
Bio::Graphics - Generate GD images of Bio::Seq objects
14
# This script generates a PNG picture of a 10K region containing a
15
# set of red features and a set of blue features. Call it like this:
16
# red_and_blue.pl > redblue.png
17
# you can now view the picture with your favorite image application
20
# This script parses a GenBank or EMBL file named on the command
21
# line and produces a PNG rendering of it. Call it like this:
22
# render.pl my_file.embl | display -
28
my $file = shift or die "provide a sequence file as the argument";
29
my $io = Bio::SeqIO->new(-file=>$file) or die "could not create Bio::SeqIO";
30
my $seq = $io->next_seq or die "could not find a sequence in the file";
32
my @features = $seq->all_SeqFeatures;
34
# sort features by their primary tags
36
for my $f (@features) {
37
my $tag = $f->primary_tag;
38
push @{$sorted_features{$tag}},$f;
41
my $wholeseq = Bio::SeqFeature::Generic->new(-start=>1,-end=>$seq->length);
43
my $panel = Bio::Graphics::Panel->new(
44
-length => $seq->length,
45
-key_style => 'between',
50
$panel->add_track($wholeseq,
56
$panel->add_track($wholeseq,
63
my @colors = qw(cyan orange blue purple green chartreuse magenta yellow aqua);
65
for my $tag (sort keys %sorted_features) {
66
my $features = $sorted_features{$tag};
67
$panel->add_track($features,
69
-bgcolor => $colors[$idx++ % @colors],
85
Please see L<Bio::Graphics::Panel> for the full interface.
89
L<Bio::Graphics::Panel>,
90
L<Bio::Graphics::Glyph>,
94
L<Bio::DB::GFF::Feature>,
102
User feedback is an integral part of the evolution of this and other
103
Bioperl modules. Send your comments and suggestions preferably to
104
the Bioperl mailing list. Your participation is much appreciated.
106
bioperl-l@bioperl.org - General discussion
107
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
109
=head2 Reporting Bugs
111
Report bugs to the Bioperl bug tracking system to help us keep track
112
of the bugs and their resolution. Bug reports can be submitted via the
115
http://bugzilla.open-bio.org/
119
Lincoln Stein E<lt>lstein@cshl.orgE<gt>.
121
Copyright (c) 2001 Cold Spring Harbor Laboratory
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.