[Bioperl-l] Graphics:Panel /SeqFeature::Generic

Lincoln Stein lstein at cshl.edu
Tue Dec 2 16:56:43 EST 2003


Hi Dan,

You need to check that the tag value exists with has_tag() before trying to 
fetch it.  If you create an key at the bottom, then a synthetic feature will 
be created and passed to your callback.  It's probably raising the exception.

Lincoln


On Monday 24 November 2003 07:53 am, Daniel Lang wrote:
> Hi again,
> I tested it also on the command line using an additional tag called
> 'sig' but the problem is the same:
> ------------- EXCEPTION  -------------
> MSG: asking for tag value that does not exist sig
> STACK Bio::SeqFeature::Generic::get_tag_values
> /usr/lib/perl5/site_perl/5.6.1/Bio/SeqFeature/Generic.pm:504
> STACK main::__ANON__ ./htmlresult1.pl:105
> STACK (eval)
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Glyph/Factory.pm:394
> STACK Bio::Graphics::Glyph::Factory::option
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Glyph/Factory.pm:394
> STACK Bio::Graphics::Glyph::option
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Glyph.pm:321
> STACK Bio::Graphics::Glyph::bgcolor
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Glyph.pm:386
> STACK Bio::Graphics::Glyph::filled_box
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Glyph.pm:830
> STACK Bio::Graphics::Glyph::draw_component
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Glyph.pm:959
> STACK Bio::Graphics::Glyph::segments::draw_component
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Glyph/segments.pm:63
> STACK Bio::Graphics::Glyph::draw
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Glyph.pm:650
> STACK Bio::Graphics::Glyph::generic::draw
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Glyph/generic.pm:107
> STACK Bio::Graphics::Glyph::draw
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Glyph.pm:642
> STACK Bio::Graphics::Glyph::generic::draw
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Glyph/generic.pm:107
> STACK Bio::Graphics::Glyph::track::draw
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Glyph/track.pm:21
> STACK Bio::Graphics::Panel::gd
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Panel.pm:461
> STACK Bio::Graphics::Panel::png
> /usr/lib/perl5/site_perl/5.6.1/Bio/Graphics/Panel.pm:781
> STACK main::create_overview ./htmlresult1.pl:147
> STACK toplevel ./htmlresult1.pl:20
>
> --------------------------------------
> Any hints?
>
> Daniel
>
> Lincoln Stein wrote:
> > Hi Dan,
> >
> > Try changing the "generic" glyph to "segments."  The first glyph doesn't
> > know how to deal with subparts (such as HSPs), the second does.
> >
> > Lincoln
> >
> > On Monday 17 November 2003 05:06 am, Daniel Lang wrote:
> >>Hi,
> >>I want to generate overview graphics from BLAST reports, where the hits
> >>are sorted and colored (>1e-10 -->green, ...)according their evalues...
> >>
> >>So I thought, I could solve this using a callback function for the
> >>bgcolor and using the 'low_score' sort_order, but when applied to a
> >>BLAST report, it results in sorted but only red hits?
> >>I also tried introducing the evalues as additional tags like done with
> >>'bits' or 'range', but when testing for this tag in the callback
> >>(has_tag) its not available?
> >>So I wander if the function is envoked for each hit in the while loop?
> >>
> >>Here the code sniplet:
> >>
> >>my $track = $panel->add_track(-glyph       => 'generic',
> >>                                 -label       => 1,
> >>                                 -connector   => 'dashed',
> >>				-height      => 5,
> >>                                 -bgcolor     =>  sub {
> >>						    my $feature = shift;
> >>						    my $evalue = $feature->score;
> >>						    if ($evalue < 1e-10) {return 'green';}
> >>						    else {return 'red';}}
> >>						    ,
> >>				-fontcolor   => 'green',
> >>                                 -font2color  => 'red',
> >>                                 -sort_order  => 'low_score',
> >>				-min_score => '1e-1000',
> >>				-max_score => '10000',
> >>                                 -description => sub {
> >>                                   my $feature = shift;
> >>                                   return unless
> >> $feature->has_tag('bits'); my ($description) =
> >>$feature->each_tag_value('bits');
> >>                                   my $score = $feature->score;
> >>                                   my ($range) =
> >>$feature->each_tag_value('range');
> >>				  "Score=$description bits, E-value=$score, $range";
> >>                                  });
> >>
> >>     while( my $hit = $result->next_hit ) {
> >>	my $evalue = $hit->significance;
> >>	my $feature = Bio::SeqFeature::Generic->new(-score   => $evalue,
> >>						    -display_name => $hit->name,
> >>						    -tag     => { 'bits' => $hit->bits,
> >>								  'range' => "from ". $hit->start('query') . " to " .
> >>$hit->end('query'),
> >>								  },
> >>						    );
> >>	while( my $hsp = $hit->next_hsp ) {
> >>	   $feature->add_sub_SeqFeature($hsp,'EXPAND');
> >>	 }
> >>	$track->add_feature($feature);
> >>   }
> >>
> >>Thanks in advance,
> >>Daniel
> >>
> >>_______________________________________________
> >>Bioperl-l mailing list
> >>Bioperl-l at portal.open-bio.org
> >>http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l

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




More information about the Bioperl-l mailing list