[Bioperl-l] HTMLResultWriter

Mark A. Jensen maj at fortinbras.us
Mon Jan 25 21:07:49 UTC 2010


Lorenzo--
your $blast_report is set to be (some of) the text returned
by a system call of a blast program; this isn't going to be
an object of any kind, and so no functions can be
called from it (as at "$blast_report->next_result"). You need
to parse the text generated by the blast call using Bio::SearchIO
to get a Bio::Search::Result::BlastResult object.
you could do

@blast_lines = qx/ ...your blast call... /;
open my $bf, ">my.blast";
print $bf, @blast_lines;
close $bf;
$blast_result = Bio::SearchIO->new(-file=>'my.blast',
                                                        -format => 'blast');

and carry on from there. But why not look at
Bio::Tools::Run::StandAloneBlast or
Bio::Tools::Run::StandAloneBlastPlus
to run your blasts within perl? These wrap the blast
programs and deliver BioPerl objects, rather than
plain text output.
cheers MAJ
----- Original Message ----- 
From: <lpaulet at ual.es>
To: <bioperl-l at lists.open-bio.org>
Sent: Monday, January 25, 2010 3:31 PM
Subject: [Bioperl-l] HTMLResultWriter


Hi all,

I'm trying to generate a subroutine that performs a BLAST search and
returns the corresponding reports in txt, xml and html format. I´m
experiencing problems with the latter, as the program returns the
following error message:

"Can't call method "next_result" without a package or object reference at..."

sub blasting    {
my ($query, $E_value) = @_;
my ($outputfilenameB, $outputfilenameX, $outputfilenameH);
$outputfilenameB=$query.".BLAST.txt";
$outputfilenameX=$query.".BLAST.xml";
$outputfilenameH=$query.".BLAST.html";
#legacy_blast.pl blastall -i query -d nr -o blast.out --path /opt/blast/bin
print qx(du -s /tmp);
my $blast_report =qx/$blast -p blastp -d $database -i $query -e
$E_value -b 20000 -o $outputfilenameB/;
my $XMLblast_report =qx/$blast -p blastp -d $database -i $query -e
$E_value -m 7 -b 20000 -o $outputfilenameX/;

my $writerhtml = new Bio::SearchIO::Writer::HTMLResultWriter();
my $outhtml = new Bio::SearchIO(-writer => $writerhtml,
                                  -file   => ">$outputfilenameH");
while( my $result = $blast_report->next_result ) { # get a result from
Bio::SearchIO parsing or build it up in memory
$outhtml->write_result($result);
}
}

Can anyone  see where the problem is?
Cheers!
Lorenzo



_______________________________________________
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