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

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

πŸ’– 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 (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::HitTableWriter
  • Bio::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 = A Bio::Search::Result::ResultI object
  • 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 ResultI object. 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