[Bioperl-l] Bio::Graphics, sorry to sound redundant :(

William Boileau boileau at essi.fr
Fri Feb 7 16:19:58 EST 2003


I'm really sorry to ask it twice, but as I don't see where the problem
comes from...
Here is the code i actually use. The question is : why doesn't the
extending_arrow glyph work ? I mean, my results are longer than the query,
but  it doesn't appear anywhere on the image... :\I also attached the Blast output file, if one want to try it out...
Anyway, I hope that someone will be able to help... and thanks for any
answer :)
William Boileau


use Bio::Seq;
use Bio::Seq::SeqFactory;
use Bio::SearchIO;
use Bio::Graphics;

#If there exists an image file with the results of a previous query,
#delete it then create it again.
if (-e "img_will.png") {
unlink("img_will.png");
}
open MYFILE3, ">img_will.png";

$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',
			      -description => sub {
				my $feature = shift;
				return unless $feature->has_tag('description');
				my ($description) = $feature->each_tag_value('description');
				my $score = $feature->score;
				"$description, score=$score";
                                 }
			     );

while( my $hit = $result->next_hit ) {
  next unless $hit->significance < 1;
  my $feature = Bio::SeqFeature::Generic->new(-score  => $hit->raw_score,
					      -seq_id => $hit->name,
					      -tag    => {
							   description => $hit->description
							  },
					     );
  while( my $hsp = $hit->next_hsp ) {
    $feature->add_sub_SeqFeature($hsp,'EXPAND');
  }

  $track->add_feature($feature);
}

#The image file is "filled"
print MYFILE3 $panel->png();

close MYFILE3;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: blast_will.out
Type: application/octet-stream
Size: 39429 bytes
Desc: not available
Url : /pipermail/attachments/20030207/76c051df/blast_will.obj


More information about the Bioperl-l mailing list