Bio::S...eWriter(3pm)
β¨ NAME β¨
Bio::SearchIO::Writer::HSPTableWriter β tab-delimited data for Bio::Search::HSP::HSPI objects π
and yes bestie, she's a 3pm page, living her best life in the User Contributed Perl Documentation section. no cap.
πΈ SYNOPSIS πΈ
okay so here's the vibe. Example 1: just roll with the default columns, she's already perfect β¨
use Bio::SearchIO;
use Bio::SearchIO::Writer::HSPTableWriter;
my $in = Bio::SearchIO->new();
my $writer = Bio::SearchIO::Writer::HSPTableWriter->new();
my $out = Bio::SearchIO->new( -writer => $writer );
while ( my $result = $in->next_result() ) {
$out->write_result($result, ($in->report_count - 1 ? 0 : 1) );
}
Example 2: now we're picking and choosing which columns we want, main character energy π
use Bio::SearchIO;
use Bio::SearchIO::Writer::HSPTableWriter;
my $in = Bio::SearchIO->new();
my $writer = Bio::SearchIO::Writer::HSPTableWriter->new(
-columns => [qw(
query_name
query_length
hit_name
hit_length
rank
frac_identical_query
expect
)] );
my $out = Bio::SearchIO->new( -writer => $writer,
-file => ">searchio.out" );
while ( my $result = $in->next_result() ) {
$out->write_result($result, ($in->report_count - 1 ? 0 : 1) );
}
π¦ Custom Labels π¦
and like, if the default column labels aren't giving what they need to give, you can rename them, periodt. Just pass a -labels hash reference when you build the HSPTableWriter object. the keys are the column number (and bestie, left-most column = 1, not zero, don't come for me) for whichever label(s) you're customizing. here's the moment:
my $writer = Bio::SearchIO::Writer::HSPTableWriter->new(
-columns => [qw( query_name
query_length
hit_name
hit_length )],
-labels => { 1 => 'QUERY_GI',
3 => 'HIT_IDENTIFIER' } );
π DESCRIPTION π
Bio::SearchIO::Writer::HSPTableWriter generates output at the finest level of granularity for data within a search result. it's giving microscope π¬. the data for each HSP inside each hit in a search result comes out in tab-delimited format, one row per HSP. slay.
β Available Columns β
here are all the columns you can name in the -columns parameter when you're creating an HSPTableWriter object. and lowkey important: if you don't pass a -columns parameter at all, this exact list, in this exact order, is the default. π
query_nameβ sequence identifier of the queryquery_lengthβ full length of the query sequencehit_nameβ sequence identifier of the hithit_lengthβ full length of the hit sequenceroundβ round number for hit (PSI-BLAST)rankexpectβ expect value for the alignmentscoreβ score for the alignment (e.g., BLAST score)bitsβ bit score for the alignmentfrac_identical_queryβ fraction of identical substitutions in queryfrac_identical_hitβ fraction of identical substitutions in hitfrac_conserved_queryβ fraction of conserved substitutions in queryfrac_conserved_hitβ fraction of conserved substitutions in hitlength_aln_queryβ length of the aligned portion of the query sequencelength_aln_hitβ length of the aligned portion of the hit sequencegaps_queryβ number of gap characters in the aligned query sequencegaps_hitβ number of gap characters in the aligned hit sequencegaps_totalβ number of gap characters in the aligned query and hit sequencesstart_queryβ starting coordinate of the aligned portion of the query sequenceend_queryβ ending coordinate of the aligned portion of the query sequencestart_hitβ starting coordinate of the aligned portion of the hit sequenceend_hitβ ending coordinate of the aligned portion of the hit sequencestrand_queryβ strand of the aligned query sequencestrand_hitβ strand of the aligned hit sequenceframeβ reading frame of the aligned query sequencehit_descriptionβ full description of the hit sequencequery_descriptionβ full description of the query sequencefrac_identical_totalβ fraction of total identical substitutionsfrac_conserved_totalβ fraction of total conserved substitutions
want the tea on any of these? π΅ the docs for the corresponding method over in Bio::Search::HSP::HSPI have you covered.
π TODO π
still gotta figure out the best way to work in algorithm-specific score columns. the best route is probably to have algorithm-specific subclasses (e.g., BlastHSPTableWriter, FastaHSPTableWriter). it's giving future era, not yet, bestie. π
π«Ά FEEDBACK π«Ά
π Mailing Lists π
user feedback is, like, an integral part of the evolution of this and other Bioperl modules β fr fr. send your comments and suggestions preferably to one of the Bioperl mailing lists. your participation is so appreciated, genuinely π₯Ή
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. many experienced and responsive experts will be able look at the problem and quickly address it. if at all possible, please include a thorough description of the problem with code and data examples. give them the full picture bestie, not just a vibe π§
π 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 π
Steve Chervitz <sac@bioperl.org>
see the FEEDBACK section for where to send bug reports and comments.
π COPYRIGHT π
Copyright (c) 2001 Steve Chervitz. All Rights Reserved.
this library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. iconic behavior honestly π
π DISCLAIMER π
this software is provided "as is" without warranty of any kind. no promises, no cap, that's the deal.
π₯ SEE ALSO π₯
Bio::SearchIO::Writer::HitTableWriterBio::SearchIO::Writer::ResultTableWriter
π§ METHODS π§
π to_string() π
heads up bestie: this method is not intended for direct use. the SearchIO::write_result() method calls it automatically if the writer is hooked up to a SearchIO object, just like the SYNOPSIS section shows.
- Title β
to_string() - Usage β
print $writer->to_string( $result_obj, [$include_labels] ); - Argument β
$result_obj= aBio::Search::Result::ResultIobject;$include_labels= boolean, if true column labels are included (default: false) - Returns β a string containing a tab-delimited set of data for each HSP in each Hit of the supplied
ResultIobject - Throws β n/a
πΈ end_report πΈ
- Title β
end_report - Usage β
$self->end_report() - Function β the method to call when ending a report; this is mostly for cleanup for formats which require you to have something at the end of the document. nothing for a text message.
- Returns β string
- Args β none
π filter π
- Title β
filter - Usage β
$writer->filter('hsp', \&hsp_filter); - Function β filter out either at HSP, Hit, or Result level
- Returns β none
- Args β string => data type, CODE reference
and that's the whole page bestie π brought to you by perl v5.32.1, dated 2021-08-15, out of the User Contributed Perl Documentation for Bio::S...eWriter(3pm). go write some tab-delimited HSP rows, you're gonna eat π
β¨
π¦ 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