Bio::S...tWriter(3pm)
π Bio::SearchIO::Writer::HTMLResultWriter π
okay bestie, welcome to the Bio::S...tWriter(3pm) page β User Contributed Perl Documentation, fr fr. it's literally the Bio::SearchIO::Writer::HTMLResultWriter module and it's giving "turn your BLAST results into pretty HTML" main character energy. let's get into it β¨
πΈ NAME πΈ
Bio::SearchIO::Writer::HTMLResultWriter β write a Bio::Search::ResultI in HTML π
β¨ SYNOPSIS β¨
use Bio::SearchIO;
use Bio::SearchIO::Writer::HTMLResultWriter;
my $in = Bio::SearchIO->new(-format => 'blast',
-file => shift @ARGV);
my $writer = Bio::SearchIO::Writer::HTMLResultWriter->new();
my $out = Bio::SearchIO->new(-writer => $writer);
$out->write_result($in->next_result);
# to filter your output
my $MinLength = 100; # need a variable with scope outside the method
sub hsp_filter {
my $hsp = shift;
return 1 if $hsp->length('total') > $MinLength;
}
sub result_filter {
my $result = shift;
return $hsp->num_hits > 0;
}
my $writer = Bio::SearchIO::Writer::HTMLResultWriter->new
(-filters => { 'HSP' => \&hsp_filter} );
my $out = Bio::SearchIO->new(-writer => $writer);
$out->write_result($in->next_result);
# can also set the filter via the writer object
$writer->filter('RESULT', \&result_filter);
π DESCRIPTION π
so this object implements the SearchWriterI interface, and what it does is produce a whole set of HTML for a specific Bio::Search::Report::ReportI interface. slay. π
if you wanna know more about the filter method, go check out Bio::SearchIO::SearchWriterI. iykyk.
π«Ά FEEDBACK π«Ά
π Mailing Lists π
user feedback is like, so integral to the evolution of this module and all the other Bioperl modules bestie π₯Ή. send your comments and suggestions preferably to the Bioperl mailing list. your participation is much appreciated, no cap.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
π Support π
please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. there are so many experienced and reponsive experts who will be able look at the problem and quickly address it π«Ά. please include a thorough description of the problem with code and data examples if at all possible. give them the whole lore, not just the vibes.
π Reporting Bugs π
report bugs to the Bioperl bug tracking system so we can keep track of the bugs and their resolution π. bug reports can be submitted via the web:
https://github.com/bioperl/bioperl-live/issues
π AUTHOR - Jason Stajich π
Email jason-at-bioperl-dot-org
π CONTRIBUTORS π
Gary Williams G.Williams@hgmp.mrc.ac.uk
π APPENDIX π
the rest of the documentation details each of the object methods. internal methods are usually preceded with a _ (iykyk, that's the secret handshake π€«).
π new π
- Title β
new - Usage β
my $obj = Bio::SearchIO::Writer::HTMLResultWriter->new(); - Function β Builds a new
Bio::SearchIO::Writer::HTMLResultWriterobject β¨ - Returns β
Bio::SearchIO::Writer::HTMLResultWriter - Args β
-filters=> hashref with any or all of the keys (HSPHITRESULT) which have values pointing to a subroutine reference which will expect to get a-nucleotide_url=> URL sprintf string base for the nt sequences-protein_url=> URL sprintf string base for the aa sequences-no_wublastlinks=> boolean. Do not display WU-BLAST lines even if they are parsed out. Links = (1)
π¦ remote_database_url π¦
- Title β
remote_database_url - Usage β
$obj->remote_database_url($type,$newval) - Function β This should return or set a string that contains a
%swhich can be filled in with sprintf. - Returns β value of
remote_database_url - Args β
$typeβ'PROTEIN'or'P'for protein URLS,'NUCLEOTIDE'or'N'for nucleotide URLS$valueβ new value to set [optional]
π to_string π
- Purpose β Produces data for each
Search::Result::ResultIin a string. This is an abstract method. For some useful implementations, seeResultTableWriter.pm,HitTableWriter.pm, andHSPTableWriter.pm. - Usage β
print $writer->to_string( $result_obj, @args ); - Argument β
$result_obj= ABio::Search::Result::ResultIobject;@args= any additional arguments used by your implementation. - Returns β String containing data for each search Result or any of its sub-objects (Hits and HSPs).
- Throws β n/a
π hit_link_desc π
- Title β
hit_link_desc - Usage β
$self->hit_link_desc(\&link_function); - Function β Get/Set the function which provides an HTML link(s) for the given hit to be used within the description section at the top of the BLAST report. This allows a person reading the report within a web browser to go to one or more database entries for the given hit from the description section.
- Returns β Function reference
- Args β Function reference
- See Also β
L<default_hit_link_desc()>
π§ default_hit_link_desc π§
- Title β
default_hit_link_desc - Usage β
$self->default_hit_link_desc($hit, $result) - Function β Provides an HTML link(s) for the given hit to be used within the description section at the top of the BLAST report. This allows a person reading the report within a web browser to go to one or more database entries for the given hit from the description section.
- Returns β string containing HTML markup
"<a href...")
The default implementation returns an HTML link to the URL supplied by the remote_database_url() method and using the identifier supplied by the id_parser() method. It will use the NCBI GI if present, and the accession if not.
- Args β First argument is a
Bio::Search::Hit::HitI; Second argument is aBio::Search::Result::ResultI - See Also β
hit_link_align,remote_database,id_parser
π₯ hit_link_align π₯
- Title β
hit_link_align - Usage β
$self->hit_link_align(\&link_function); - Function β Get/Set the function which provides an HTML link(s) for the given hit to be used within the HSP alignment section of the BLAST report. This allows a person reading the report within a web browser to go to one or more database entries for the given hit from the alignment section.
- Returns β string containing HTML markup
"<a href...")
The default implementation delegates to hit_link_desc().
- Args β First argument is a
Bio::Search::Hit::HitI; Second argument is aBio::Search::Result::ResultI - See Also β
hit_link_desc,remote_database,id_parser
πΈ hit_desc_line πΈ
- Title β
hit_desc_line - Usage β
$self->hit_desc_line(\&link_function); - Function β Get/Set the function which provides HTML for the description information from a hit. This allows one to parse the rest of the description and split up lines, add links, etc.
- Returns β Function reference
- Args β Function reference
- See Also β
L<default_hit_link_desc()>
π default_hit_desc_line π
- Title β
default_hit_desc_line - Usage β
$self->default_hit_desc_line($hit, $result) - Function β Parses the description line information, splits based on the hidden
\x01between independent descriptions, checks the lines for possible web links, and adds HTML link(s) for the given hit to be used. - Returns β string containing HTML markup
"<a href...")
The default implementation returns an HTML link to the URL supplied by the remote_database_url() method and using the identifier supplied by the id_parser() method. It will use the NCBI GI if present, and the accession if not.
- Args β First argument is a
Bio::Search::Hit::HitI; Second argument is aBio::Search::Result::ResultI - See Also β
hit_link_align,remote_database,id_parser
β¨ start_report β¨
- Title β
start_report - Usage β
$index->start_report( CODE ) - Function β Stores or returns the code to write the start of the
<HTML>block, the<TITLE>block and the start of the<BODY>block of HTML. Useful for (for instance) specifying alternative HTML if you are embedding the output in an HTML page which you have already started. (For example a routine returning a null string). Returns\&default_start_report(see below) if not set. - Example β
$index->start_report( \&my_start_report ) - Returns β ref to CODE if called without arguments
- Args β CODE
π default_start_report π
- Title β
default_start_report - Usage β
$self->default_start_report($result) - Function β The default method to call when starting a report.
- Returns β sting
- Args β First argument is a
Bio::Search::Result::ResultI
π title π
- Title β
title - Usage β
$self->title($CODE) - Function β Stores or returns the code to provide HTML for the given BLAST report that will appear at the top of the BLAST report HTML output. Useful for (for instance) specifying alternative routines to write your own titles. Returns
\&default_title(see below) if not set. - Example β
$index->title( \&my_title ) - Returns β ref to CODE if called without arguments
- Args β CODE
π« default_title π«
- Title β
default_title - Usage β
$self->default_title($result) - Function β Provides HTML for the given BLAST report that will appear at the top of the BLAST report HTML output.
- Returns β string containing HTML markup
The default implementation returns <CENTER> <H1> HTML containing text such as:
"Bioperl Reformatted HTML of BLASTP Search Report for gi|1786183|gb|AAC73113.1|"
- Args β First argument is a
Bio::Search::Result::ResultI
π«§ introduction π«§
- Title β
introduction - Usage β
$self->introduction($CODE) - Function β Stores or returns the code to provide HTML for the given BLAST report detailing the query and the database information. Useful for (for instance) specifying routines returning alternative introductions. Returns
\&default_introduction(see below) if not set. - Example β
$index->introduction( \&my_introduction ) - Returns β ref to CODE if called without arguments
- Args β CODE
π¦ default_introduction π¦
- Title β
default_introduction - Usage β
$self->default_introduction($result) - Function β Outputs HTML to provide the query and the database information
- Returns β string containing HTML
- Args β First argument is a
Bio::Search::Result::ResultI; Second argument is string holding literature citation
π«Ά end_report π«Ά
- Title:
end_report - Usage:
$self->end_report() - Function: okay so this is the one you call when the report is over and you're closing it out π it's mostly cleanup duty β for formats that literally need something sitting at the end of the document (think
</BODY></HTML>for HTML). - Returns: string
- Args: none
π id_parser π
- Title:
id_parser - Usage:
$index->id_parser( CODE ) - Function: stores or hands back the code that
record_iduses to parse the ID for a record out of a string. Super useful when you wanna, say, run a totally different parser for different flavours of FASTA file. If you never set one, it returns\&default_id_parser(peep below π). And bestie, if you do supply your ownid_parsersubroutine, it should expect a fasta description line β and heads up, an entry gets added to the index for each string in the list it returns. - Example:
$index->id_parser( \&my_id_parser ) - Returns: ref to CODE if called without arguments
- Args: CODE
β¨ default_id_parser β¨
- Title:
default_id_parser - Usage:
$id = default_id_parser( $header ) - Function: the default Fasta ID parser for Fasta.pm β it returns
$1from applying the regexp/^>\s*(\S+)/to$header. - Returns: ID string. The default implementation checks for NCBI-style identifiers in the given string (
'gi|12345|AA54321'). For these IDs, it extracts the GI and accession and returns a two-element list of strings (GI, acc). - Args: a fasta header line string
π algorithm_reference π
- Title:
algorithm_reference - Usage:
my $reference = $writer->algorithm_reference($result); - Function: returns the appropriate Bibliographic reference for the algorithm format being produced π
- Returns: String
- Args: L<Bio::Search::Result::ResultI> to reference
π Methods Bio::SearchIO::SearchWriterI π
Bio::SearchIO::SearchWriterI inherited methods. like, they're inherited, she didn't write them, but she still shows up for them π
π¦ filter π¦
- Title:
filter - Usage:
$writer->filter('hsp', \&hsp_filter); - Function: filter stuff out at either the HSP, Hit, or Result level
- Returns: none
- Args: string => data type, CODE reference
π no_wublastlinks π
- Title:
no_wublastlinks - Usage:
$obj->no_wublastlinks($newval) - Function: get/set boolean value regarding whether or not to display
Link = (1)type output in the report output (WU-BLAST only) - Returns: boolean
- Args: on set, new boolean value (a scalar or undef, optional)
that's the whole page bestie!! you made it to the end, so proud, no cap π₯Ήπ«Ά
this absolute icon of a manual page ships as perl v5.32.1, dated 2021-08-15 β and yes it's a Bio::S...tWriter(3pm) situation, iykyk π
π¦ where this page comes from
- debian bookworm: libbio-perl-perl 1.7.8-1 Β· Perl
- debian trixie: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu jammy: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu noble: libbio-perl-perl 1.7.8-1 Β· Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms