Bio::S...Writer(3pm)
π Bio::SearchIO::Writer::ResultTableWriter π
okay bestie, so this is a page from the User Contributed Perl Documentation, section 3pm, and it's literally all about Bio::SearchIO::Writer::ResultTableWriter β the lil icon that spits out tab-delimited data for every Bio::Search::Result::ResultI object. let's get into it π
β¨ NAME β¨
Bio::SearchIO::Writer::ResultTableWriter β Outputs tab-delimited data for each Bio::Search::Result::ResultI object.
πΈ SYNOPSIS πΈ
Example 1: Using the default columns
use Bio::SearchIO;
use Bio::SearchIO::Writer::ResultTableWriter;
my $in = Bio::SearchIO->new();
my $writer = Bio::SearchIO::Writer::ResultTableWriter->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: Specifying a subset of columns
use Bio::SearchIO;
use Bio::SearchIO::Writer::ResultTableWriter;
my $in = Bio::SearchIO->new();
my $writer = Bio::SearchIO::Writer::ResultTableWriter->new(
-columns => [qw(
query_name
query_length
num_hits
)] );
my $out = Bio::SearchIO->new( -writer => $writer,
-file => ">result.out" );
while ( my $result = $in->next_result() ) {
$out->write_result($result, ($in->report_count - 1 ? 0 : 1) );
}
Custom Labels
ngl you don't have to be stuck with the default labels if they're not giving what they need to give. π
you can set your own by passing a -labels hash reference parameter when you create the ResultTableWriter object. the keys of that hash are the column number (left-most column = 1) for the label(s) you wanna specify. here's the moment:
my $writer = Bio::SearchIO::Writer::ResultTableWriter->new(
-columns => [qw( query_name
query_length
query_description
num_hits)],
-labels => { 1 => 'QUERY_GI',
2 => 'QUERY_LENGTH' } );
π¦ DESCRIPTION π¦
Bio::SearchIO::Writer::ResultTableWriter outputs data in tab-delimited format for each search result β one row per search result. it's a very coarse-grain level of info, because it literally only includes the data stored in the Bio::Search::Result::ResultI object itself. it does not include any info about hits or HSPs. no hits, no HSPs, nothing. just the result-level vibe. β¨
and honestly? you will most likely never use this object directly β instead you'll use one of its subclasses: Bio::SearchIO::Writer::HitTableWriter or Bio::SearchIO::Writer::HSPTableWriter. it's giving "base class that does the groundwork so its children can shine". π
Available Columns
here are the columns you can specify in the -columns parameter when you create a ResultTableWriter object. and listen β if you don't pass a -columns parameter at all, this exact list, in this exact order, gets used as the default:
query_name
query_length
query_description
for more deets about these columns, check the documentation for the corresponding method in Bio::Search::Result::ResultI. iykyk π«Ά
π 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 one of the Bioperl mailing lists. your participation is much appreciated. π₯Ή
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 responsive experts who will be able to look at the problem and quickly address it. and please include a thorough description of the problem with code and data examples if at all possible β the more context the better, bestie. π«Ά
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 π
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.
π DISCLAIMER π
this software is provided "as is" without warranty of any kind. (yes, the classic. no promises, no cap.)
π SEE ALSO π
Bio::SearchIO::Writer::HitTableWriterBio::SearchIO::Writer::HSPTableWriter
π₯ METHODS π₯
to_string()
Note: 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 as illustrated in the SYNOPSIS section. so like... hands off, it's doing its own thing. π
- Title β
to_string() - Usage β
print $writer->to_string( $result_obj, [$include_labels] ); - Argument β
$result_obj= ABio::Search::Result::ResultIobject - Argument β
$include_labels= boolean, if true column labels are included (default:false) - Returns β String containing tab-delimited set of data for each hit in a
ResultIobject. Some data is summed across multiple HSPs. - Throws β n/a
column_labels
- Usage β
print $result_obj->column_labels(); - Purpose β Get column labels for
to_string(). - Returns β String containing column labels. Tab-delimited.
- Argument β n/a
- 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!! π§ this lil doc shipped with perl v5.32.1 and got its date stamp on 2021-08-15 β so go forth, write those tab-delimited results, and slay. periodt. π β¨π¦
π¦ 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