[Bioperl-l] can't parse blast file anymore
Hubert Prielinger
hubert.prielinger at gmx.at
Thu May 4 19:35:42 UTC 2006
Hi,
the following perl script worked fine until a few days ago....
==============================================================
#!/usr/bin/perl -w
use Bio::SearchIO;
use strict;
use DBI;
use Net::MySQL;
#use lib qw(/usr/local/lib/perl5/site_perl/5.8.6/i686-linux);
print "trying to connect to database \n";
my $database = 'antimicro_peptides';
my $host = 'ppc7.bio.ucalgary.ca';
my $user = 'Hubert';
my $password = 'Col00eng30';
my $mysql = Net::MySQL->new(
hostname => $host,
database => $database,
user => $user,
password => $password,
);
print "Connection established \n";
my $selectID = 0;
my $count = 0;
##output database results
#while (my @row = $sth->fetchrow_array)
# { print "@row\n" }
print "start program\n";
my $directory = '/home/Hubert/test';
opendir(DIR, $directory) || die("Cannot open directory");
print "opened directory\n";
foreach my $file (readdir(DIR)) {
if ($file =~ /txt$/) {
$count++;
print "read file $file \n";
$file = $directory . '/' . $file;
my $search = new Bio::SearchIO (-format => 'blast',
-file => $file);
print "bioperl seems to work....\n";
my $cutoff_len = 10;
#iterate over each query sequence
print "try to enter while loop\n";
while (my $result = $search->next_result) {
print "entered 1st while loop\n";
#iterate over each hit on the query sequence
while (my $hit = $result->next_hit) {
print "entered 2nd while loop\n";
#iterate over each HSP in the hit
while (my $hsp = $hit->next_hsp) {
print "entered 3rd while loop\n";
if ($hsp->length('sbjct') <= $cutoff_len) {
#print $hsp->hit_string, "\n";
for ($hsp->hit_string) { #$hsp->hit_string
print "count files....., $count ,\n";
.................
===================================================================
Output:
[Hubert at ppc7 Database_Search]$ /usr/bin/perl Blast.pl
trying to connect to database
Connection established
start program
opened directory
read file 40026.txt
bioperl seems to work....
try to enter while loop
but it doesn't enter the first while loop, it stuck there, first I
thought it is a linux problem, because I updated from FC4 to FC5, but it
isn't because perl is working fine, and it seems bioperl is working fine
too, but it cannot parse the file anymore.....
regards
Hubert
More information about the Bioperl-l
mailing list