NAME
Bio::Grep::SearchResult - Data structure for a back-end search hit
SYNOPSIS
# output the search results with nice alignments
while ( my $res = $sbe->next_res ) {
# $res->sequence is a Bio::Seq object with down-/upstream regions
# see Bio::Grep::SearchSettings
print $res->sequence->id . "\n";
# $res->subject is a Bio::Seq object without down-/upstream regions
print $res->subject->seq . "\n";
# print down-/upstream regions lower case, subject seq. uppercase
print $res->mark_subject_uppercase() . "\n";
# output alignment
print $res->alignment_string() . "\n";
# print coordinates: perldoc Bio::SimpleAlign, Bio::LocatableSeq
$print $res->alignment->get_seq_by_pos(1)->start . "\n\n";
}
DESCRIPTION
Bio::Grep::SearchResult is the data structure for one hit in the database.
METHODS
See Bio::Grep::Root for inherited methods.
CONSTRUCTOR
new($arg_ref)
;-
This function constructs a Bio::Grep::SearchResult object. Takes as argument a hash reference that initializes the member variables below.
Only called by the back-end parser.
my $result = Bio::Grep::SearchResult->new( { sequence => $seq, begin => $begin, end => $end, alignment => $alignment, ... percent_identity => $identity, } );
PACKAGE METHODS
subject()
-
Creates a Bio::Seq object with the sequence found in the database (see sequence()) , but without upstream and downstream regions.
upstream()
-
The upstream region as Bio::Seq object. See subject().
downstream()
-
The downstream region as Bio::Seq object. See subject().
reverse_complement()
-
Returns a true value if hit is a reverse complement hit, 0 otherwise.
Some predefined methods for printing objects:
mark_subject_uppercase()
-
This function returns the sequence in a string. the substring from
$self->begin
to$self->end
will be in uppercase, the rest in lowercase. alignment_string()
-
This function returns a string with the formatted alignment. We use CLUSTALW Format without many blank lines and CLUSTAL header. In some back-ends like Agrep, this function will return an empty string if
no_alignments
is true.
ACCESSORS/MUTATORS
Following the Bioperl guidelines, accessors are also mutators:
$res->sequence('CCCCC');
print $res->sequence; # prints CCCCC
sequence()
-
Get/set the sequence found in database with up- and downstream regions. Bio::Seq object.
query()
-
Get the query as Bio::Seq object. Useful for multiple queries. If <direct_and_rev_com> is set, then a reverse complement hit is marked with ' (reverse complement)' in
$query->desc
andreverse_complement
(see below) is 1.# DON'T DO THIS: if ($query->desc =~ m{ \(reverse\scomplement\)\z}xms) { ... } # use reverse_complement instead: if ($res->reverse_complement) { ... }
alignment()
-
Get/set the alignment of the match. See Bio::SimpleAlign for details. There are powerful modules for converting this module in many formats. See Bio::AlignIO for details.
sequence_id()
-
Get/set the sequence id in database. This is an internal id of the back-end, not any id of some annotation in the sequence name. The internal id can be used in the back-end function get_sequences() (See Bio::Grep::Backend::BackendI).
begin()
-
Get/set the position of the beginning of the subject in the sequence. This allows retrieving upstream regions from the back-end. First position is 0.
my $seq = $res->sequence->seq; my $upstream = substr $seq, 0, $res->begin; my $subject = substr $seq, $res->begin, $res->end - $res->begin; my $downstream = substr $seq, $res->end;
Note that
$res->begin
differs from$sbe->settings->upstream
if the available upstream region is smaller than requested! end()
-
Get/set the position of the end of the subject in the sequence. This allows retrieving downstream regions from the back-end. See
begin()
. dG()
-
Get/set
dG
. See Bio::Grep::RNA::HybridizationI for details. remark()
-
Get/set some additional information like filter results to this hit.
evalue()
-
Get/set the evalue of this hit.
percent_identity()
-
Get/set the identity in percent of this hit.
SEE ALSO
Bio::SimpleAlign Bio::LocatableSeq Bio::AlignIO Bio::Seq Bio::SeqIO Bio::Grep::Backend::BackendI
AUTHOR
Markus Riester, <mriester@gmx.de>
LICENSE AND COPYRIGHT
Copyright (C) 2007-2009 by M. Riester.
Based on Weigel::Search v0.13, Copyright (C) 2005-2006 by Max Planck Institute for Developmental Biology, Tuebingen.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.