[Bioperl-l] Hit length using length_aln()

Ken kjgraham@ucdavis.edu
Fri, 12 Jul 2002 15:54:39 -0700


I'm still learning BioPerl so bear with me.
I want the total length for a hit across all the HSPs so I figured I should 
use length_aln. 
All I get is an error message:
  Can't locate object method "length_aln" via package 
"Bio::Search::Hit::GenericHit"

I can't locate length_aln() in that package either, so Perl and I agree 
there...
I found it in Bio::Search::Hit::BLASTHit.

I'm able to return all of the HSPs from the hit object - so I  know that I've 
got a good reference to the hit.

The code is pretty straightforward:
-----------------------------------------------------------------------------------------
my $searchio = new Bio::SearchIO ('-format' => 'blast', '-file'   
=>$blastfile );
my $result = $searchio->next_result;
# get info about the first hit
while( my $hit = $result->next_hit()) {
	my @hsps_lens;
	my $hit_name = $hit->name ;
	#for each hit look at each HSP
	my @hsp_s = $hit->hsps();
	my $lenObj = $hit->length_aln();
-----------------------------------------------------------------------------------------
If I remove the reference to length_aln() everything works.
I've thought about creating something that adds the length of each HSP, but I 
figured that's what length_aln() does.
Any ideas why this doesn't work?
Thanks in advance for any help,
Ken Graham
Biological Chemistry
U.C. Davis School of Medicine