Bio::S...tWriter(3pm)

πŸ“¦
version 1.7.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– 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::HTMLResultWriter object ✨
  • Returns β€” Bio::SearchIO::Writer::HTMLResultWriter
  • Args β€” -filters => hashref with any or all of the keys (HSP HIT RESULT) 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 %s which 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::ResultI in a string. This is an abstract method. For some useful implementations, see ResultTableWriter.pm, HitTableWriter.pm, and HSPTableWriter.pm.
  • Usage β€” print $writer->to_string( $result_obj, @args );
  • Argument β€” $result_obj = A Bio::Search::Result::ResultI object; @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
  • 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()>
  • 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 a Bio::Search::Result::ResultI
  • See Also β€” hit_link_align, remote_database, id_parser
  • 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 a Bio::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 \x01 between 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 a Bio::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_id uses 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 own id_parser subroutine, 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 $1 from 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
  • 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