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 outputmy $MinLength = 100; # need a variable with scope outside the methodsub 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
This object implements the SearchWriterI interface which will produce a set of HTML for a specific Bio::Search::Report::ReportI interface.
See Bio::SearchIO::SearchWriterI for more info on the filter method.
FEEDBACK
Mailing Lists
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.
[email protected] - General discussionhttp://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
rather than to the module maintainer directly. Many experienced and reponsive experts 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.
Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us 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 [email protected]
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
new
Title : newUsage : my $obj = Bio::SearchIO::Writer::HTMLResultWriter->new();Function: Builds a new Bio::SearchIO::Writer::HTMLResultWriter objectReturns : Bio::SearchIO::Writer::HTMLResultWriterArgs : -filters => hashref with any or all of the keys (HSP HIT RESULT)which have values pointing to a subroutine referencewhich 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 lineseven if they are parsed out.Links = (1)
remote_database_url
Title : remote_database_urlUsage : $obj->remote_database_url($type,$newval)Function: This should return or set a string that contains a %s which can befilled in with sprintf.Returns : value of remote_database_urlArgs : $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
hit_link_desc
Title : hit_link_descUsage : $self->hit_link_desc(\&link_function);Function: Get/Set the function which provides an HTMLlink(s) for the given hit to be usedwithin the description section at the top of the BLAST report.This allows a person reading the report withina web browser to go to one or more database entries forthe given hit from the description section.Returns : Function referenceArgs : Function referenceSee Also: L<default_hit_link_desc()>
default_hit_link_desc
Title : default_hit_link_descUsage : $self->default_hit_link_desc($hit, $result)Function: Provides an HTML link(s) for the given hit to be usedwithin the description section at the top of the BLAST report.This allows a person reading the report withina web browser to go to one or more database entries forthe given hit from the description section.Returns : string containing HTML markup "<a href...")The default implementation returns an HTML link to theURL supplied by the remote_database_url() methodand 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::HitISecond argument is a Bio::Search::Result::ResultI
See Also: hit_link_align, remote_database, id_parser
hit_link_align
Title : hit_link_alignUsage : $self->hit_link_align(\&link_function);Function: Get/Set the function which provides an HTML link(s)for the given hit to be usedwithin the HSP alignment section of the BLAST report.This allows a person reading the report withina web browser to go to one or more database entries forthe 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::HitISecond argument is a Bio::Search::Result::ResultI
See Also: hit_link_desc, remote_database, id_parser
hit_desc_line
Title : hit_desc_lineUsage : $self->hit_desc_line(\&link_function);Function: Get/Set the function which provides HTML for the descriptioninformation from a hit. This allows one to parsethe rest of the description and split up lines, add links, etc.Returns : Function referenceArgs : Function referenceSee Also: L<default_hit_link_desc()>
default_hit_desc_line
Title : default_hit_desc_lineUsage : $self->default_hit_desc_line($hit, $result)Function: Parses the description line information, splits based on thehidden \x01 between independent descriptions, checks the lines forpossible web links, and adds HTML link(s) for the given hit to beused.Returns : string containing HTML markup "<a href...")The default implementation returns an HTML link to theURL supplied by the remote_database_url() methodand 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::HitISecond argument is a Bio::Search::Result::ResultI
See Also: hit_link_align, remote_database, id_parser
start_report
Title : start_reportUsage : $index->start_report( CODE )Function: Stores or returns the code towrite the start of the <HTML> block, the <TITLE> blockand the start of the <BODY> block of HTML. Usefulfor (for instance) specifying alternativeHTML if you are embedding the output inan HTML page which you have already started.(For example a routine returning a null string).Returns \&default_start_report (see below) if notset.Example : $index->start_report( \&my_start_report )Returns : ref to CODE if called without argumentsArgs : CODE
default_start_report
Title : default_start_reportUsage : $self->default_start_report($result)Function: The default method to call when starting a report.Returns : stingArgs : First argument is a Bio::Search::Result::ResultI
title
Title : titleUsage : $self->title($CODE)Function: Stores or returns the code to provide HTML for the givenBLAST report that will appear at the top of the BLAST reportHTML output. Useful for (for instance) specifyingalternative routines to write your own titles.Returns \&default_title (see below) if notset.Example : $index->title( \&my_title )Returns : ref to CODE if called without argumentsArgs : CODE
default_title
Title : default_titleUsage : $self->default_title($result)Function: Provides HTML for the given BLAST report that will appearat the top of the BLAST report HTML output.Returns : string containing HTML markupThe default implementation returns <CENTER> <H1> HTMLcontaining text such as:"Bioperl Reformatted HTML of BLASTP Search Reportfor gi|1786183|gb|AAC73113.1|"Args : First argument is a Bio::Search::Result::ResultI
introduction
Title : introductionUsage : $self->introduction($CODE)Function: Stores or returns the code to provide HTML for the givenBLAST report detailing the query and thedatabase information.Useful for (for instance) specifyingroutines returning alternative introductions.Returns \&default_introduction (see below) if notset.Example : $index->introduction( \&my_introduction )Returns : ref to CODE if called without argumentsArgs : CODE
default_introduction
Title : default_introductionUsage : $self->default_introduction($result)Function: Outputs HTML to provide the queryand the database informationReturns : string containing HTMLArgs : First argument is a Bio::Search::Result::ResultISecond argument is string holding literature citation
end_report
Title : end_reportUsage : $self->end_report()Function: The method to call when ending a report, this ismostly for cleanup for formats which require you tohave something at the end of the document (</BODY></HTML>)for HTMLReturns : stringArgs : none
id_parser
Title : id_parserUsage : $index->id_parser( CODE )Function: Stores or returns the code used by record_id toparse the ID for record from a string. Usefulfor (for instance) specifying a differentparser for different flavours of FASTA file.Returns \&default_id_parser (see below) if notset. If you supply your own id_parsersubroutine, then it should expect a fastadescription line. An entry will be added tothe index for each string in the list returned.Example : $index->id_parser( \&my_id_parser )Returns : ref to CODE if called without argumentsArgs : CODE
default_id_parser
Title : default_id_parserUsage : $id = default_id_parser( $header )Function: The default Fasta ID parser for Fasta.pmReturns $1 from applying the regexp /^>\s*(\S+)/to $header.Returns : ID stringThe default implementation checks for NCBI-styleidentifiers in the given string ('gi|12345|AA54321').For these IDs, it extracts the GI and accession andreturns a two-element list of strings (GI, acc).Args : a fasta header line string
algorithm_reference
Title : algorithm_referenceUsage : my $reference = $writer->algorithm_reference($result);Function: Returns the appropriate Bibliographic reference for thealgorithm format being producedReturns : StringArgs : L<Bio::Search::Result::ResultI> to reference
Methods Bio::SearchIO::SearchWriterI
Bio::SearchIO::SearchWriterI inherited methods.
filter
Title : filterUsage : $writer->filter('hsp', \&hsp_filter);Function: Filter out either at HSP,Hit,or Result levelReturns : noneArgs : string => data type,CODE reference
no_wublastlinks
Title : no_wublastlinksUsage : $obj->no_wublastlinks($newval)Function: Get/Set boolean value regarding whether or not to displayLink = (1)type output in the report output (WU-BLAST only)Returns : booleanArgs : on set, new boolean value (a scalar or undef, optional)