[Bioperl-l] Bio::Graphics::Panel can't locate object method 'start'...

Lincoln Stein lstein at cshl.org
Mon Mar 24 11:16:08 EST 2003


Hi,

You can't add sequences to tracks, just features!  Try something like this:

	my @features = $seq->get_SeqFeatures();
	$panel->add_track(\@features,
					....);

Lincoln

On Friday 14 March 2003 02:29 pm, Benjamin Berman wrote:
> This didn't fix the problem.  I have the most recent version of
> bioperl-live, and as I said, the problem is happening withing the
> add_track call, not the Panel->new call.
>
> thanks,
> ben.
>
> On Friday, March 14, 2003, at 11:06  AM, Lincoln Stein wrote:
> > You can either CVS update to the most recent version of bioperl, wait
> > for the
> > next release, which is coming in a week or so, or change this line:
> >
> >    my $panel = Bio::Panel->new(
> > 				     -start => 1,
> >   				      -end   => $seq->length,
> >  				      -key_style => 'between',
> >   				      -width     => 800,
> >   				      -pad_left  => 10,
> >  				      -pad_right => 10,
> >   				      );
> >
> > Lincoln
> >
> > On Thursday 13 March 2003 06:20 pm, Benjamin Berman wrote:
> >> Hey Lincoln,
> >>
> >> Sorry if you've already gone over this, but I looked through the
> >> bioperl-l mails and couldn't find an explanation.  I'm having problems
> >>
> >> running the example script listed in the "Panel" documentation:
> >>> 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::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,
> >>>  		 );
> >>
> >> Now I'm not having any problems with the call to Panel->new, as others
> >> have reported.  Instead, I am having a problem when $panel->add_track
> >> is called.  This creates a new Feature, using $seq as the segment; in
> >> Feature::new, Feature::add_segment($seq) is called.  The script dies
> >> within this call because it tries to call the function $seq->start.
> >>
> >>> Can't locate object method "start" via package "Bio::Seq::RichSeq" at
> >>> /root/cvs_benb/bioperl-live/Bio/Graphics/Feature.pm line 210, <DATA>
> >>> line 191.
> >>
> >> (line 210:   $self->{start}    = $self->{segments}[0]->start;)
> >>
> >>
> >> I printed out a stack trace of where it is when it dies...
> >>
> >>> Adding segment Bio::Seq::RichSeq=HASH(0x8693dd4) at
> >>> /root/cvs_benb/bioperl-live/Bio/Graphics/Feature.pm line 211
> >>>
> >>> Bio::Graphics::Feature::add_segment('Bio::Graphics::Feature=HASH(0x86
> >>> a3
> >>> 7b4)','Bio::Seq::RichSeq=HASH(0x8693dd4)') called at
> >>> /root/cvs_benb/bioperl-live/Bio/Graphics/Feature.pm line 175
> >>>
> >>> Bio::Graphics::Feature::new('Bio::Graphics::Feature','-
> >>> segments','ARRAY(0x86a3748)','-start',1,'-stop',1027,'-
> >>> type','track',...) called at
> >>> /root/cvs_benb/bioperl-live/Bio/Graphics/Panel.pm line 303
> >>>
> >>> Bio::Graphics::Panel::_add_track('Bio::Graphics::Panel=HASH(0x86a1d30
> >>> )'
> >>> ,0,'Bio::Seq::RichSeq=HASH(0x8693dd4)','-map','CODE(0x8691c4c)','-
> >>> stylesheet','undef','-options','HASH(0x82d8ef8)',...) called at
> >>> /root/cvs_benb/bioperl-live/Bio/Graphics/Panel.pm line 282
> >>>
> >>> Bio::Graphics::Panel::_do_add_track('Bio::Graphics::Panel=HASH(0x86a1
> >>> d3
> >>> 0)',0,'Bio::Seq::RichSeq=HASH(0x8693dd4)','-glyph','arrow','-
> >>> bump',0,'-double',1,...) called at
> >>> /root/cvs_benb/bioperl-live/Bio/Graphics/Panel.pm line 210
> >>>
> >>> Bio::Graphics::Panel::add_track('Bio::Graphics::Panel=HASH(0x86a1d30)
> >>> ',
> >>> 'Bio::Seq::RichSeq=HASH(0x8693dd4)','-glyph','arrow','-bump',0,'-
> >>> double',1,'-tick',...) called at ./bio_graphics_test.pl line 38
> >
> > --
> > =======================================================================
> > =
> > Lincoln D. Stein                           Cold Spring Harbor
> > Laboratory
> > lstein at cshl.org			                  Cold Spring Harbor, NY
> > =======================================================================
> > =

-- 
========================================================================
Lincoln D. Stein                           Cold Spring Harbor Laboratory
lstein at cshl.org			                  Cold Spring Harbor, NY
========================================================================




More information about the Bioperl-l mailing list