[Bioperl-l] Bio::Search results

Sean O'Keeffe limericksean at gmail.com
Tue Aug 30 04:55:27 EDT 2005

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

use Bio::SearchIO;

my $in =3D new Bio::SearchIO( -format =3D> 'hmmer',  -file =3D> $ARGV[0] );
while(my $result =3D $in->next_result) {
  print $result->query_name(), "\n",$result->query_description(),"\n";
  while (my $hit =3D $result->next_hit) {
    while(my $hsp =3D $hit->next_domain) {
      next unless ($hsp->name =3D~ /^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