[Bioperl-l] Is it possible to parse BLAST output using IO:String?

Bernd Web bernd.web at gmail.com
Mon Oct 30 20:44:31 UTC 2006


Hi Ryan,

I parse blastn output using IO::String w/o problems:

 my $stringfh = new IO::String($input);
 my $in = new Bio::SearchIO(-format => 'blast', -fh => $stringfh);

however this is input does not come via backticks.


bernd

On 10/30/06, Ryan Golhar <golharam at umdnj.edu> wrote:
> I'm trying to parse some blast output w/o actually creating the output
> file.  Instead, I'm capturing the output in a variable and would like to
> use IO::String to represent the file:
>
>         $_ = `megablast -d somedatabase -i somesequence -D 2`;
>         my $blast_file = new IO::String($_);
>         my $searchio = new Bio::SearchIO(-format => 'blast', -fh =>
> $blast_file);
>         my $results = $searchio->next_result;
>         my $hit = $results->next_hit;
>         if (! defined($hit)) {
>                 warn "No BLAST hit for $accession on chr $chr for
> Seq/$orth_id/$organism\n\n";
>                 return;
>         }
>
> Now, when Bio::SearchIO tries to read the output line by line, instead
> it reads the entire output as 1 line.
>
> If I provide the output in a file and use:
>
>         my $searchio = new Bio::SearchIO(-format => 'blast', -file =>
> '/tmp/somefile.blast');
>
> This works...so is it possible to use IO::String to provide
> Bio::SearchIO with BLAST output?
>
> Ryan
>
> _______________________________________________
> 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