[Bioperl-l] Graphics/Panel problem
Jason Stajich
jason at cgt.duhs.duke.edu
Fri May 9 18:53:00 EDT 2003
http://bioperl.org/pipermail/bioperl-l/2003-January/010973.html
The HOWTO is updated on how to do this.
http://www.bioperl.org/HOWTOs/html/Graphics-HOWTO.html
You need to create a feature rather than adding the sequence directly.
On Fri, 9 May 2003, Thomas Keller wrote:
> Greetings,
> I'm just following the example in doc.bioperl.org for
> Bio::Graphics::Panel, called render.pl in the Synopsis.
> but I get the following error:
> % render.pl AE014076.genbank
> Can't locate object method "start" via package "Bio::Seq::RichSeq" at
> /Library/Perl/Bio/Graphics/Panel.pm line 45, <DATA> line 141.
>
> I'm stumped. I'd greatly appreciate your help bioperlers.
> Thanks,
> Tom K
> ## here's the script ##
> #! /usr/bin/perl
> ## render.pl from
> http://doc.bioperl.org/releases/bioperl-1.2/Graphics/Panel.html
>
> use strict;
> use Bio::Graphics;
> use Bio::SeqIO;
> 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 @features = $seq->all_SeqFeatures;
> # sort 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(
> -segment => $seq,
> -key_style => 'between',
> -width => 800,
> -pad_left => 10,
> -pad_right => 10,
> );
> $panel->add_track($seq,
> -glyph => 'arrow',
> -bump => 0,
> -double=>1,
> -tick => 2);
> $panel->add_track($seq,
> -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 $panel->png;
> exit 0;
> __END__
> Tom Keller, Ph.D.
> http://www.ohsu.edu/core
> kellert at ohsu.edu
> 503-494-2442
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at bioperl.org
> http://pw600a.bioperl.org/mailman/listinfo/bioperl-l
>
--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu
More information about the Bioperl-l
mailing list