Bioperl: Question: reading in blast results from scalar?

Chad Matsalla matsallac@EM.AGR.CA
Fri, 03 Mar 2000 18:41:01 -0500


Has anybody successfully passed a scalar containing a blast report to the parser?

I can see that it should use IO::Scalar but I am unable to make it work.
Is there a way to go from an IO::Scalar object to a FileHandle object? Is this the way it should be done?

Here is one of the many things I tried:

tie *OUT, 'IO::Scalar', \$scalar_containing_a_blast_report;
eval {
                $o_blast = Bio::Tools::Blast->new ( -file => *OUT,
                        -parse  =>      1);
};


Result:

Stat on unopened file <OUT> at /usr/lib/perl5/site_perl/5.005/Bio/Root/IOManager.pm line 231.
In sub, exception:
-------------------- EXCEPTION --------------------
MSG: File is empty or non-existent: *main::OUT
CONTEXT: Error in object Bio::Root::IOManager "anonymous Bio::Root::IOManager"
 Contained in Object Bio::Tools::Blast "anonymous Bio::Tools::Blast"
SCRIPT: ./blast_to_html.pl
STACK:
Bio::Root::IOManager::file(231)
Bio::Root::Object::file(2124)
Bio::Root::Utilities::create_filehandle(821)
Bio::Root::Utilities::get_newline(889)
Bio::Tools::Blast::_parse_blast_stream(1621)
Bio::Tools::Blast::parse(1474)
Bio::Tools::SeqAnal::_initialize(286)
Bio::Root::Object::new(455)
main::eval_report(58)
main::./blast_to_html.pl(33)



Thanks,

Chad Matsalla



>>> Steve Chervitz <sac@neomorphic.com> 02/15 1:33 PM >>>
Note that the documentation to the parse method of the Blast.pm module 
states that the -FILE option should point to a file containing the raw 
Blast output, and if not supplied, STDIN is used. 

This isn't the whole story (yes, the docs need to be updated). 
The -FILE parameter can also contain a FileHandle object or a 
typeglob reference.

Given this, Aaron's suggestion seems like a good one, though I also
have not tested it. 

Steve
--
Steve Chervitz
sac@neomorphic.com 

Aaron J Mackey writes:
 > 
 > Another option would be to use the IO::Scalar module to wrap the scalar as
 > a filehandle, and pass that along to the parser (not tested, but can't see
 > why that wouldn't work).
 > 
 > -Aaron
 > 
 > On Tue, 15 Feb 2000, David Block wrote:
 > 
 > > This may be a naive answer, but could you just print the scalar to a file
 > > (or STDOUT) and then pass it along (pipe it)?
 > > 
 > > -Dave
 > > 
 > > On Tue, 15 Feb 2000, Nathan O. Siemers wrote:
 > > 
 > > > 
 > > > Perhaps this is a general perl question.
 > > > 
 > > > 	How does one submit a blast output for parsing, etc, using
 > > > 	Blast.pm, when you have stored the blast result itself into a
 > > > 	scalar, rather than a file?
 > > > 
 > > > 	Thanks,
 > > > 
 > > > 	nathan
 > > > 
 > > > -- 
 > > > N a t h a n   O .  S i e m e r s
 > > > Bioinformatics
 > > > Division of Applied Genomics
 > > > Bristol-Myers Squibb Pharmaceutical Research Institute
 > > > Hopewell Building 3B, P.O. Box 5400, Princeton, NJ 08543-5400
 > > > 609 818-6568
 > > > siemersn@bms.com 
 > > > 
 > > > =========== Bioperl Project Mailing List Message Footer =======
 > > > Project URL: http://bio.perl.org/ 
 > > > For info about how to (un)subscribe, where messages are archived, etc:
 > > > http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html 
 > > > ====================================================================
 > > > 
 > > 
 > > =========== Bioperl Project Mailing List Message Footer =======
 > > Project URL: http://bio.perl.org/ 
 > > For info about how to (un)subscribe, where messages are archived, etc:
 > > http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html 
 > > ====================================================================
 > > 
 > 
 > -- 
 >  o ~   ~   ~   ~   ~   ~  o
 > / Aaron J Mackey           \
 > \  Dr. Pearson Laboratory  / 
 >  \ University of Virginia  \     
 >  /  (804) 924-2821          \
 >  \  amackey@virginia.edu    /
 >   o ~   ~   ~   ~   ~   ~  o
 > 
 > 
 > =========== Bioperl Project Mailing List Message Footer =======
 > Project URL: http://bio.perl.org/ 
 > For info about how to (un)subscribe, where messages are archived, etc:
 > http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html 
 > ====================================================================
 > 
=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/ 
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html 
====================================================================
=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
====================================================================