[Bioperl-l] bioperl 1.4 SearchIO doesn't work parsing Blast output
Hubert Prielinger
hubert.prielinger at gmx.at
Wed Feb 8 22:22:44 UTC 2006
hi,
I have installed from the following page:
http://news.open-bio.org/archives/2005_10.html, the Core, Run and Ext.
I'm using only the SearchIO without remoteblast module, because I have
already all my Blast output files.
My operating system is fedora core 9.
Code:
#!/usr/bin/perl -w
use Bio::SearchIO;
print "start program\n";
my $directory =
"/home/Hubert/installed/eclipse/workspace/Database_Search/result_4";
opendir(DIR, $directory) || die("Cannot open directory");
print "opened directory\n";
foreach my $file (readdir(DIR)) {
print "read file\n";
my $search = new Bio::SearchIO (-format => 'blast',
-file => $file);
my $cutoff_len = 10;
#iterate over each query sequence
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) {
#iterate over each HSP in the hit
while (my $hsp = $hit->next_hsp) {
if ($hsp->length('sbjct') <= $cutoff_len) {
#print $hsp->hit_string, "\n";
for ($hsp->hit_string) {
if (tr/K// >= 2 || tr/R// >= 2 && tr/W// >= 2 ||
tr/K// == 1 && tr/R// == 1 && tr/W// >= 2) {
# Print some tab-delimited data about this HSP
open (bigShot, ">>BlastOutputTrial.txt") ||
die ("Could not open file. $!");
#print $result->query_name, "\t";
# print $hit->significance, "\t";
print bigShot $hit->name, "-->";
print bigShot $hit->description, "\n";
#print bigShot "Query: ",
$hsp->start('query'), " ", $hsp->query_string, " ",
$hsp->end('query'), "\n";
print bigShot "Seq: ", $hsp->start('hit'),
" ", $hsp->hit_string, " ", $hsp->end('hit'), "\n";
# print $hsp->rank, "\t";
# print $hsp->percent_identity, "\t";
# print $hsp->evalue, "\t";
# print $hsp->hsp_length, "\n";
close (bigShot);
};
}
}
}
}
}
}
closedir(DIR);
Chris Fields wrote:
>Make sure you ran a full installation of bioperl-1.5.1 or bioperl-live (not
>just the modules you want; mixing bioperl versions might work, but you might
>run into interoperability problems). Then replace the Bio::SearchIO::blast
>with the one in Bugzilla. The 'other option' you mentioned might be trying
>XML instead of text, which is more stable in the long run. You will still
>need to run a full upgrade to bioperl 1.5.1 for that; make sure you read
>this:
>
>http://bioperl.org/wiki/Module:Bio::Tools::Run::RemoteBlast
>
>If you're using SearchIO directly instead of Remoteblast, you should be able
>to set the '-readmethod' flag to 'blastxml'.
>
>It also wouldn't hurt to know what OS you're using or see some code. Roger
>is out there somewhere (I think) and may also have some input.
>
>Christopher Fields
>Postdoctoral Researcher - Switzer Lab
>Dept. of Biochemistry
>University of Illinois Urbana-Champaign
>
>
>
>>-----Original Message-----
>>From: Hubert Prielinger [mailto:hubert.prielinger at gmx.at]
>>Sent: Wednesday, February 08, 2006 3:41 PM
>>To: Chris Fields; bioperl-l at bioperl.org
>>Subject: Re: [Bioperl-l] bioperl 1.4 SearchIO doesn't work
>>parsing Blast output
>>
>>hi chris,
>>thanks, I have upgraded to version 1.5.1 but it isn't still
>>working, do you have any ohter idea, the problem I have is
>>that I have to parse a lot of textfiles....
>>or shall I look for another option to parse those files...
>>
>>regards
>>Hubert
>>
>>
>>
>>Chris Fields wrote:
>>
>>
>>
>>>My guess is you're running into text parsing problems in
>>>Bio::SearchIO::blast. Upgrade to the latest developer
>>>
>>>
>>version (1.5.1)
>>
>>
>>>or bioperl-live (CVS), then see the bug below.
>>>
>>>http://bugzilla.bioperl.org/show_bug.cgi?id=1934
>>>
>>>I think the first problem you ran into is solved in bioperl
>>>
>>>
>>1.5.1, the
>>
>>
>>>last problem (more recent, not related to the first) has
>>>
>>>
>>been fixed but
>>
>>
>>>hasn't been committed to bioperl-live yet. The fixed
>>>
>>>
>>SearchIO::blast
>>
>>
>>>is available in the link above, but realize it hasn't been
>>>
>>>
>>committed yet and may change.
>>
>>
>>>Christopher Fields
>>>Postdoctoral Researcher - Switzer Lab
>>>Dept. of Biochemistry
>>>University of Illinois Urbana-Champaign
>>>
>>>
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>From: bioperl-l-bounces at lists.open-bio.org
>>>>[mailto:bioperl-l-bounces at lists.open-bio.org] On Behalf Of Hubert
>>>>Prielinger
>>>>Sent: Wednesday, February 08, 2006 2:52 PM
>>>>To: bioperl-l at bioperl.org
>>>>Subject: [Bioperl-l] bioperl 1.4 SearchIO doesn't work
>>>>
>>>>
>>parsing Blast
>>
>>
>>>>output
>>>>
>>>>Hi,
>>>>If I want to parse a Blast Output (Version 2.2.12) with
>>>>
>>>>
>>Bio::SearchIO,
>>
>>
>>>>I get the following error message:
>>>>
>>>>MSG: no data for midline Query 1 WWWKWRW 7
>>>>STACK Bio::SearchIO::blast::next_result
>>>>/usr/lib/perl5/site_perl/5.8.6/Bio/SearchIO/blast.pm:1151
>>>>STACK toplevel
>>>>/home/Hubert/installed/eclipse/workspace/Database_Search/Blast.pl:21
>>>>
>>>>is that a bug......
>>>>
>>>>If I want to parse Blast Output (version 2.2.13), I don't get
>>>>anything.....
>>>>I'm using bioperl 1.4
>>>>
>>>>before, I have installed bioperl 1.4, it worked fine parsing Blast
>>>>Output (version 2.2.12), but I don't remember which bioperl
>>>>
>>>>
>>version I
>>
>>
>>>>had installed
>>>>
>>>>thanks in advance
>>>>
>>>>Hubert
>>>>
>>>>
>>>>
>>>>_______________________________________________
>>>>Bioperl-l mailing list
>>>>Bioperl-l at lists.open-bio.org
>>>>http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>
>
>
>
More information about the Bioperl-l
mailing list