[Bioperl-l] desperate: what's wrong with this code
nkuipers
nkuipers@uvic.ca
Sat, 16 Nov 2002 02:34:18 -0800
Hello all,
Normally I wouldn't whimp out like this but I am coming down to the wire and
am relatively new to using bioperl. I'll probably realize the problem as soon
as I send it but wouldn't have without sending; you know how it goes. ;) No
output from following code. Please offer your insight. If there is no
problem then I know the error lies in surrounding, non-bioperl methodology.
Everything compiles and no runtime errors. bioperl 1.02 with Perl 5.6.0 on
Linux 7.2. Many thanks!
Nathanael
#code snippet
use lib qw( /home/nkuipers/modules/lib/site_perl/5.6.0 );
use Bio::SearchIO;
open FH1, ">>output" or die $!;
open FH2, ">>bunk" or die $!; #not really :)
my $parser = Bio::SearchIO->new( -file => $hashref->{infile}, -format =>
'blastxml' );
my $regex = qr/yaddayadda/;
while ( my $result = $parser->next_result ) {
while ( my $hit = $result->next_hit ) {
while ( my $hsp = $hit->next_hsp ) {
if ( $hit->description =~ m/$regex/ ) {
print FH1 $result->query_name," hit ",$hit->name,"\n",
$hsp->query_string,"\n"
} else {
print FH2 $result->query_name," hit ",$hit->name,"\n",
$hsp->query_string,"\n"
}
}
}
}