[Bioperl-guts-l] [BioPerl - Bug #3251] Blast parsing will not return Database values for queries without hits

redmine at redmine.open-bio.org redmine at redmine.open-bio.org
Fri Jun 17 15:44:26 EDT 2011


Issue #3251 has been updated by Chris Fields.

Assignee set to Bioperl Guts


----------------------------------------
Bug #3251: Blast parsing will not return Database values for queries without hits
https://redmine.open-bio.org/issues/3251

Author: Francisco J. Ossandon
Status: New
Priority: Normal
Assignee: Bioperl Guts
Category: 
Target version: 
URL: 


I've found that in a Blast output, any query with "no hits found" will return empty values for the following database-related methods, EXCEPT if the query without hits it's the first result of the output:
<pre>
use warnings;
use strict;
use Bio::SearchIO;

my $blast_file = 'rps-blastp_output_nohits.txt';
my $blast_in = Bio::SearchIO->new(-file   => "<$blast_file",
                                  -format => 'blast');
while (my $result = $blast_in->next_result) {
    my $qry_name   = $result->query_name;
    my $db_name    = $result->database_name;
    my $db_letters = $result->database_letters;
    my $db_entries = $result->database_entries;
    if ($db_name eq '' or $db_letters eq '' or $db_entries eq '') {
        print "$qry_name with empty values!\n";
    }
    else {
        print "$qry_name OK\n"
    }
}
print "Done!\n";
exit;
</pre>
So the queries that have hits will return the values for $db_name, $db_letters and $db_entries, but the queries without hits will not (unless it's the first on the list). Since these values are declared at the start and end of the Blast output, I think that they should be stored at the beginning of the parse and be persistent across all the query results from the output, or until it needs to be updated because of concatenated blast outputs in a single file. Besides, this can cause problems if you need to take different actions depending on the DB name when parsing a batch of blast outputs for example.

I've attached 2 example files, one with 2 queries (1 with hits, 1 without hits), and the other with 5 queries without any hits at all.


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here and login: http://redmine.open-bio.org



More information about the Bioperl-guts-l mailing list