[Bioperl-l] Boxes and features...

William Boileau boileau at essi.fr
Thu Feb 27 16:27:39 EST 2003


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;
   }
}




More information about the Bioperl-l mailing list