[Bioperl-l] Boxes and features...

William Boileau boileau at essi.fr
Mon Mar 3 16:42:43 EST 2003


This is how I thought it worked... but then, when I try got get the values
of a tag by calling the each_get_value() method on the feature box with
the parameter 'name', i get an error :MSG: asking for tag value that does not exist name

That's why i was trying to print all the tags with the code below... but
my tags array seem to be empty...
So where i am mistaking ? Any idea would be really helpful, thanks !

William



> The boxes() call gives you back what you put in via add_track() and
> add_feature().  So in this case you're adding a new
> Bio::SeqFeature::Generic  for each blast hit, and each one has the tags
> "name" and "description".  You  should get the same exact objects out
> when you call boxes().
>
> Lincoln
>
>
> On Thursday 27 February 2003 10:27 am, William Boileau wrote:
>> I don't understand much how it all works :\
>> what is the kind of feature we get with the boxes ?
>> I would say Bio::SeqFeature::Generic, but I am not sure... and what
>> are the tags we can get with the features ? can they be entered
>> manually ?Because in the code below, when i try to list the tags in
>> the feature of a box, they're empty... And to be honest, this is not
>> exactly what i expected :DIf you have any idea, it would be really
>> helpful! thanks !
>>
>> William Boileau
>>
>>
>> ----------
>> $searchio = new Bio::SearchIO ('-format' => 'blast',
>> 			       '-file' => "blast_will.out");
>>
>> $result = $searchio->next_result;
>>
>> #Create a panel object
>> my $panel = Bio::Graphics::Panel->new( -length
>> =>$result->query_length,
>> 				       -width => 1000,
>> 				       -pad_left => 10,
>> 				       -pad_right => 10,
>> 				     );
>>
>> my $full_length = Bio::SeqFeature::Generic->new(-start => 1,
>> 						-end => $result->query_length,
>> 						-seq_id=> $result->query_name
>> 					       );
>> $panel->add_track($full_length,
>> 		  -glyph   => 'arrow',
>> 		  -tick    => 2,
>> 		  -fgcolor => 'black',
>> 		  -double  => 1,
>> 		  -label   => 1,
>> 		 );
>>
>> my $track = $panel->add_track(-glyph        => 'graded_segments',
>> 			      -label        => 1,
>> 			      -connector    => 'dashed',
>> 			      -bgcolor      => 'blue',
>> 			      -font2color   => 'red',
>> 			      -sort_order   => 'high_score',
>> 			      -box_subparts => 1,
>> 			      -description  => sub {
>> 				my $feature = shift;
>> 				return unless $feature->has_tag('desription');
>> 				my ($description) = $feature->each_tag_value('description'); my
>> 				$score = $feature->score;
>> 				"$description, score=$score";
>>                                  }
>> 			     );
>>
>> while( my $hit = $result->next_hit ) {
>>   next unless $hit->significance < '1e-20';
>>   my $feature = Bio::SeqFeature::Generic->new(-score  =>
>>   $hit->raw_score,
>> 					      -seq_id => $hit->name,
>> 					      -tag    => {
>> 							  description => $hit->description,
>> 							  name => $hit_name
>> 							 },
>> 					     );
>>   while( my $hsp = $hit->next_hsp ) {
>>     $feature->add_sub_SeqFeature($hsp,'EXPAND');
>>   }
>>
>>   $track->add_feature($feature);
>> }
>>
>> my @boxes = $panel->boxes;
>> foreach ( $panel->boxes() ) {
>>    my $feature_box = $_->[0];
>>    my $coords  = join( ',', @{$_}[1..4] );
>>
>>    my @tags = $feature_box->get_all_tags();
>>    foreach $x (@tags) {
>>      print $x;
>>    }
>> }
>>
>>
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at bioperl.org
>> http://bioperl.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