[Bioperl-l] Bio::Search results

Sean O'Keeffe limericksean at gmail.com
Mon Aug 29 11:03:01 EDT 2005

The following code snippet is something I use to extract information
from hmmer result files:

use Bio::SearchIO;

my $in = new Bio::SearchIO( -format => 'hmmer',  -file => $ARGV[0] );
while(my $result = $in->next_result) {
  print $result->query_name(), "\n",$result->query_description(),"\n";
  while (my $hit = $result->next_hit) {
    while(my $hsp = $hit->next_domain) {
      next unless ($hsp->name =~ /^ig|^lrr|^fn3|^egf|^tsp|^psi/i);
      print $hsp->start(),"\t",$hsp->end(),"\t",$hsp->evalue(),"\n";

The input file is generated by hmmpfam and is given at the command
line. I use it to scan for specific domain names e.g ig, fn3 lrr etc.
This code works for the first loop and then ends so I get the name and
description (no hsp values as their are none for this result):

pep:novel supercontig::NT_085813:405:1510:-1 gene:ENSMUSG00000054059

My question is why does the loop end after one instance. Incidentally
the outputted  name and description above are the last ones in the
hmmer file (maybe the file is read from the back? - don't know if this
means anything).
Any thoughts would be appreciated. Thanks,

More information about the Bioperl-l mailing list