3
# file: embl2picture.pl
4
# This is code example 5 in the Graphics-HOWTO
5
# Author: Lincoln Stein
8
use lib "$ENV{HOME}/projects/bioperl-live";
11
use Bio::SeqFeature::Generic;
13
my $file = shift or die "provide a sequence file as the argument";
14
my $io = Bio::SeqIO->new(-file=>$file) or die "couldn't create Bio::SeqIO";
15
my $seq = $io->next_seq or die "couldn't find a sequence in the file";
16
my $wholeseq = Bio::SeqFeature::Generic->new(-start=>1,-end=>$seq->length,
17
-display_name=>$seq->display_name);
19
my @features = $seq->all_SeqFeatures;
21
# sort features by their primary tags
23
for my $f (@features) {
24
my $tag = $f->primary_tag;
25
push @{$sorted_features{$tag}},$f;
28
my $panel = Bio::Graphics::Panel->new(
29
-length => $seq->length,
30
-key_style => 'between',
35
$panel->add_track($wholeseq,
41
$panel->add_track($wholeseq,
48
my @colors = qw(cyan orange blue purple green chartreuse magenta yellow aqua);
50
for my $tag (sort keys %sorted_features) {
51
my $features = $sorted_features{$tag};
52
$panel->add_track($features,
54
-bgcolor => $colors[$idx++ % @colors],