[Bioperl-l] undef query_len error with Bio::Search::Hit::GenericHit::num_unaligned_query

Freimuth, Robert freimuth at pathology.wustl.edu
Thu Jun 8 17:12:36 UTC 2006


Hi,

I'm trying to use the Bio::Search::Hit::GenericHit class to tile a set
of hits from blast, then get some information about the tiled result.  I
thought I'd use the num_unaligned_query and num_unaligned_hit methods to
get the number of unaligned bases in the tiled result, then subtract
that from the length of the query/subject sequence to get the number of
aligned bases in the region spanned by the hit(s).  My code is below,
followed by the error message.


while( my $result_obj = $blast_obj->next_result() )
{
    while( my $hit_obj = $result_obj->next_hit() )
    {
        my $generic_hit_obj = Bio::Search::Hit::GenericHit->new( -name
=> $hit_obj->name() );
        $generic_hit_obj->overlap( 0 ); # tile any hsps that overlap >
this number of bp

        while( my $hsp_obj = $hit_obj->next_hsp() )
        {
            # add all HSPs to a GenericHit object so they can be tiled
together
            $generic_hit_obj->add_hsp( $hsp_obj );
        }

        my $num_unaligned_query =
$generic_hit_obj->num_unaligned_query();
        my $num_unaligned_hit = $generic_hit_obj->num_unaligned_hit();



------------- EXCEPTION  -------------
MSG: Must have defined query_len
STACK Bio::Search::Hit::GenericHit::logical_length
/usr/lib/perl5/site_perl/5.8.0/Bio/Search/Hit/GenericHit.pm:698
STACK Bio::Search::Hit::GenericHit::num_unaligned_query
/usr/lib/perl5/site_perl/5.8.0/Bio/Search/Hit/GenericHit.pm:1264
STACK main::process_blast_hit blast_needle_timetrials_1.pl:245
STACK toplevel blast_needle_timetrials_1.pl:94
 
--------------------------------------


I looked through the docs to try to find an explanation or some mention
of how to set query_len, but I didn't find anything.  Could someone
please point out what I'm doing wrong?  Additionally, if I'm making this
harder than it needs to be, please give me a gentle whack with the clue
stick.

Thanks,
Bob





More information about the Bioperl-l mailing list