[Bioperl-l] GenericHit vs. BlastHit

Paul Boutros pcboutro@engmail.uwaterloo.ca
Thu, 22 Aug 2002 10:02:59 -0400 (EDT)


Hi again,

I'm doing some parsing of BLAST results with the SearchIO system, and it
appears that SearchIO is returning me GenericResult and GenericHit
objects, rather than the more detailed & specific BlastResult & BlastHit
objects.  Is this a feature, or is there some particular way of getting it
to return the BlastXXXX objects instead?  I'd prefer the Blast objects
because they have some methods that are not available through the generic
objects, like ->bits() for the bit-score.

My code is:
use strict;
use Bio::SearchIO;

my $searchio = new Bio::SearchIO(
			'-format'	=> 'blast',
			'-file'		=> '15k5prime.pre',
			);

while (my $result = $searchio->next_result()) {

	print $result->query_name(), "n";

	while (my $hit = $result->next_hit()) {
		print $hit->significance(), "\n";
		print $hit->hit_length(), "\n";
		}

	}

System:
Perl: 5.6.1
BioPerl: 1.00.2
OS: W2K (sp3)

<Off topic> Incidentally, as a comment on the whole "question about the
nature of bioperl" thread, I have to point out that two days ago I hadn't
used BioPerl for anything.  Today, I couldn't imagine parsing my blast
output by hand again.  It works, and it's useful.  Search me about the
stuff I haven't used, but it took a day to learn which isn't remotely
significant for any large library.  I like it.</off topic>