[Bioperl-l] Error for Bio::Graphics in the HOWTO script for rendering EMBL features
Joshua Steele
jsteele at caltech.edu
Wed Jul 27 11:44:30 EDT 2011
Dear All,
I'm getting an error (warning) message when I try to run examples 5 and 6 in
the Graphics HOWTO.
Error: Can't locate object method "has_tag" via package
"Bio::Location::Simple" at
/opt/local/lib/perl5/site_perl/5.12.3/Bio/Graphics/Glyph.pm line 704, <GEN0>
line 323.
This error occurs whether I'm using a genbank file or whether I'm using the
suggested EMBL file ( http://www.bioperl.org/wiki/Factor7 ). The
Bio::Graphics package seems to work fine to render BLAST outputs, I was able
to get both the BLAST examples and a BLAST output to work.
I'm using (macports)Perl 5.12.3, Bioperl 1.0069, and Bio::Graphics 2.24 on
Mac OS 10.6.7.
If there is something obvious that I could do to fix it I'd be quite
grateful.
Cheers,
Josh
Here is the script as I tried to run it:
#!/opt/local/bin/perl
# file: embl2picture.pl
# This is code example 5 in the Graphics-HOWTO
# Author: Lincoln Stein
use strict;
use lib '$ENV{HOME}/src/bioperl-live';
use Bio::Graphics;
use Bio::SeqIO;
use Bio::SeqFeature::Generic;
my $file = shift or die "provide a sequence file as
the argument";
my $io = Bio::SeqIO->new(-file=>$file) or die "couldn't create Bio::SeqIO";
my $seq = $io->next_seq or die "couldn't find a sequence in
the file";
my $wholeseq = Bio::SeqFeature::Generic->new(
-start => 1,
-end => $seq->length,
-display_name =>
$seq->display_name
);
my $seqname = $seq->display_name;
my @features = $seq->get_SeqFeatures;
# partition features by their primary tags
my %sorted_features;
for my $f (@features) {
my $tag = $f->primary_tag;
push @{$sorted_features{$tag}},$f;
}
my $panel = Bio::Graphics::Panel->new(
-length => $seq->length,
-key_style => 'between',
-width => 10000,
-pad_left => 50,
-pad_right => 50,
);
$panel->add_track($wholeseq,
-glyph => 'arrow',
-bump => 0,
-double => 1,
-tick => 2);
$panel->add_track($wholeseq,
-glyph => 'generic',
-bgcolor => 'blue',
-label => 1,
);
# general case
my @colors = qw(cyan orange blue purple green chartreuse magenta yellow
aqua);
my $idx = 0;
for my $tag (sort keys %sorted_features) {
my $features = $sorted_features{$tag};
$panel->add_track($features,
-glyph => 'generic',
-bgcolor => $colors[$idx++ % @colors],
-fgcolor => 'black',
-font2color => 'red',
-key => "${tag}s",
-bump => +1,
-height => 8,
-label => 1,
-description => 1,
);
}
## print PNG
open OUT, ">$seqname.png";
print OUT $panel->png;
close OUT;
exit 0;
More information about the Bioperl-l
mailing list