[Bioperl-l] Blast html report
Jason Stajich
jason@cgt.mc.duke.edu
Fri, 5 Apr 2002 08:24:38 -0500 (EST)
It is not written to read in blast html format at this point. plain text
or ncbi xml only right now. You can, however, read in plain text and use
the HTMLWriter to generate HTML.
See Bio::SearchIO::Writer::HTMLResultWriter for info.
Bascially
use Bio::SearchIO;
use Bio::SearchIO::Writer::HTMLResultWriter;
my $in = new Bio::SearchIO(-format => 'blast',
-file => shift @ARGV);
my $writer = new Bio::SearchIO::Writer::HTMLResultWriter();
my $out = new Bio::SearchIO(-writer => $writer);
$out->write_result($in->next_result);
Of course adding paremeters so it uses a file instead of STDOUT to write
is possible.
On Fri, 5 Apr 2002, Vilanova,David,LAUSANNE,NRC/BS wrote:
> Hi,
> I have a multiple sequence fasta file. I'm running a blast for each sequence
> and parsing the output. I'm also trying to generate with the same script the
> html report
> using the parameter :blast->T(T) for each sequence I blast.
> The thing is that I launch the blast using standalone and parse it with
> searchIO directly without generating an intermediate blast output but than
> bioperl tries to parse the new "html object"(normal ) and fails...
>
>
>
> use Bio::SeqIO; # manipulate sequences
> use Bio::Tools::Run::StandAloneBlast; # Launch blast
> use Bio::SearchIO ;#new Bioperl 1.0
>
> begining of script skip............
> .................................
> ..............................
>
> my $blast = Bio::Tools::Run::StandAloneBlast->new(
> database => 'databse.fasta',
> program => 'blastn',
> '_READMETHOD' => 'Blast',
>
> );
>
>
> #More blast parameters
> $blast->a(2); #nb of cpu
> #$blast->T(T); # create blast output
> #$blast->e(0.0000000001); #e-10
>
> while ( $seq = $Seq_in->next_seq() )
> {
>
> my $blast_output = $blast->blastall($seq);
> $name = $seq->id();
> $output = './files/'.$name.".html";
> $blast->o($output); #Create html output file
> print HTML_INDEX ("<tr><A
> HREF='$output'>$name</A></tr> ");
>
> while (my $result = $blast_output->next_result()) {
>
> # Get info about the entire report
> my $query_name = $result->query_name();
>
> # get info about each hit
> my ($hit, $hsp);
> while ($hit = $result->next_hit()) {
> my $hit_name = $hit->name()
> ;
> my $hit_description =
> $hit->description();
> my $hit_rawscore =
> $hit->raw_score();
> my $hit_length = $hit->lengt
> }
> }
> }
> ...........
> .........end of script
>
> Here is the error....
> ------------- EXCEPTION -------------
> MSG: no data for midline <PRE>
> STACK Bio::SearchIO::blast::next_result
> /usr/lib/perl5/site_perl/5.6.1/Bio/SearchIO/blast.pm:486
> STACK toplevel Blast_and_parse_all_bioperl_1_create_html_report.pl:85
>
>
> It looks like It's trying to parse an html report but I just want to create
> an html output of each blast.
>
> Does anybody know why ???
>
>
>
> David Vilanova
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>
--
Jason Stajich
Duke University
jason@cgt.mc.duke.edu