[Bioperl-l] Can I get different Graphics::Panel colours for
different HSP frames within the same blast hit?
Marcus Claesson
m.claesson at student.ucc.ie
Wed Dec 8 09:07:59 EST 2004
Hi!
In my Graphics::Panel overview of blastx results I would like to have
different colours for hits in different frames. It works fine among hits
but not for HSPs within the same hit. It then uses the frame value for
the first instance, and I only get one colour. Has anyone managed to
side step that? Below is the code I've used so far.
Many thanks!
Marcus
#!/usr/bin/perl -w
use Bio::Graphics;
use Bio::SearchIO;
my $searchio = Bio::SearchIO->new(-file=>blastx_results.out
-format => 'blast');
my $result = $searchio->next_result();
my $panel = Bio::Graphics::Panel->new(-length=> $result->query_length,
-width=> 800);
my $track = $panel->add_track(-glyph => 'graded_segments',
-label => 1,
-connector => 'dashed',
-bgcolor => sub {
my $feature = shift;
my ($frame) = $feature->frame();
return "red" if ($frame =~ /0/);
return "green" if ($frame =~ /1/);
return "blue" if ($frame =~ /2/)},
-strand_arrow => 'tue');
while( my $hit = $result->next_hit ) {
my $feature = Bio::SeqFeature::Generic->new(-score=>$hit->raw_score,
-frame=> $hit->frame);
while( my $hsp = $hit->next_hsp ) {
$feature->add_sub_SeqFeature($hsp,'EXPAND');
}
$track->add_feature($feature);
}
print $panel->png;
More information about the Bioperl-l
mailing list