[Bioperl-l] adding HSP information to BLAST output graphic (Bio::Graphics)
Adam Witney
awitney at sgul.ac.uk
Wed Aug 27 16:21:12 UTC 2008
after some digging around myself, this seems to do the trick, although
i don't know if it will always work, as i am having to add a separate
sort function.
On 21 Aug 2008, at 15:41, Adam Witney wrote:
>
> Hi,
>
> I am going through the Bio::Graphics HOWTO on the wiki.
>
> Looking at render_blast4.pl, the description text describes the
> whole hit and is set for the whole track, but i would like to be
> able to add HSP information such as the identity matches onto the
> picture, this is stored in the $hsp object. How would i go about
> adding that to the picture?
>
> the relevant piece of code is:
>
> my $track = $panel->add_track(
> -glyph => 'graded_segments',
> -label => 1,
> -connector => 'dashed',
> -bgcolor => 'blue',
> -font2color => 'red',
> -sort_order => 'high_score',
-part_labels => sub {
my ($feature,undef,$partno) = @_;
my @features =
sort_features($feature->get_SeqFeatures());
return $features[$partno]-
>num_identical.'/'.$features[$partno]->length.' (score='.
$features[$partno]->score.')' if $features[$partno];
},
> -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";
> # "score=$score";
> },
> );
sub sort_features {
my @array = @_;
if(@array < 2){return @array}
my @sorted = sort {$a->start <=> $b->start} @array;
return @sorted;
}
is this the best way to achieve this?
thanks
adam
More information about the Bioperl-l
mailing list