t/AlignIO/AlignIO.t: fix number of tests in plan (fixup c523e6bed866)
[bioperl-live.git] / Bio / Search / Hit / BlastHit.pm
blobcb4371688581e79ac4cc35dc7de64a54f036cdbe
2 # BioPerl module for Bio::Search::Hit::GenericHit
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Jason Stajich <jason@bioperl.org>
8 # Copyright Jason Stajich
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
14 =head1 NAME
16 Bio::Search::Hit::BlastHit - Blast-specific subclass of Bio::Search::Hit::GenericHit
18 =head1 SYNOPSIS
20 use Bio::Search::Hit::BlastHit;
21 my $hit = Bio::Search::Hit::BlastHit->new(-algorithm => 'blastp');
23 # See Bio::Search::Hit::GenericHit for information about working with Hits.
25 # TODO: Describe how to configure a SearchIO stream so that it generates
26 # GenericHit objects.
28 =head1 DESCRIPTION
30 This object is a subclass of Bio::Search::Hit::GenericHit
31 and provides some operations that facilitate working with BLAST
32 and PSI-BLAST Hits.
34 For general information about working with Hits, see
35 Bio::Search::Hit::GenericHit.
37 =head1 FEEDBACK
39 =head2 Mailing Lists
41 User feedback is an integral part of the evolution of this and other
42 Bioperl modules. Send your comments and suggestions preferably to
43 the Bioperl mailing list. Your participation is much appreciated.
45 bioperl-l@bioperl.org - General discussion
46 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
48 =head2 Support
50 Please direct usage questions or support issues to the mailing list:
52 I<bioperl-l@bioperl.org>
54 rather than to the module maintainer directly. Many experienced and
55 reponsive experts will be able look at the problem and quickly
56 address it. Please include a thorough description of the problem
57 with code and data examples if at all possible.
59 =head2 Reporting Bugs
61 Report bugs to the Bioperl bug tracking system to help us keep track
62 of the bugs and their resolution. Bug reports can be submitted via the
63 web:
65 https://github.com/bioperl/bioperl-live/issues
67 =head1 AUTHOR - Jason Stajich and Steve Chervitz
69 Email jason@bioperl.org
70 Email sac@bioperl.org
72 =head1 APPENDIX
74 The rest of the documentation details each of the object methods.
75 Internal methods are usually preceded with a _
77 =cut
80 # Let the code begin...
83 package Bio::Search::Hit::BlastHit;
84 use strict;
86 use Bio::Search::SearchUtils;
88 use base qw(Bio::Search::Hit::GenericHit);
90 =head2 new
92 Title : new
93 Usage : my $obj = Bio::Search::Hit::GenericHit->new();
94 Function: Builds a new Bio::Search::Hit::GenericHit object
95 Returns : Bio::Search::Hit::GenericHit
96 Args : See Bio::Search::Hit::GenericHit() for other args.
97 Here are the BLAST-specific args that can be used when
98 creating BlastHit objects:
99 -iteration => integer for the PSI-Blast iteration number
100 -found_again => boolean, true if hit appears in a
101 "previously found" section of a PSI-Blast report.
103 =cut
105 sub new {
106 my($class,@args) = @_;
108 my $self = $class->SUPER::new(@args);
109 my ($iter,$found) = $self->_rearrange([qw(ITERATION
110 FOUND_AGAIN
111 )], @args);
113 defined $iter && $self->iteration($iter);
114 defined $found && $self->found_again($found);
116 return $self;
119 =head2 iteration
121 Usage : $hit->iteration( $iteration_num );
122 Purpose : Gets the iteration number in which the Hit was found.
123 Example : $iteration_num = $sbjct->iteration();
124 Returns : Integer greater than or equal to 1
125 Non-PSI-BLAST reports will report iteration as 1, but this number
126 is only meaningful for PSI-BLAST reports.
127 Argument : iteration_num (optional, used when setting only)
128 Throws : none
130 See Also : L<found_again()|found_again>
132 =cut
134 sub iteration{
135 my ($self,$value) = @_;
136 if( defined $value) {
137 $self->{'_psiblast_iteration'} = $value;
139 return $self->{'_psiblast_iteration'};
142 =head2 found_again
144 Title : found_again
145 Usage : $hit->found_again;
146 $hit->found_again(1);
147 Purpose : Gets a boolean indicator whether or not the hit has
148 been found in a previous iteration.
149 This is only applicable to PSI-BLAST reports.
151 This method indicates if the hit was reported in the
152 "Sequences used in model and found again" section of the
153 PSI-BLAST report or if it was reported in the
154 "Sequences not found previously or not previously below threshold"
155 section of the PSI-BLAST report. Only for hits in iteration > 1.
157 Example : if( $hit->found_again()) { ... };
158 Returns : Boolean, true (1) if the hit has been found in a
159 previous PSI-BLAST iteration.
160 Returns false (0 or undef) for hits that have not occurred in a
161 previous PSI-BLAST iteration.
162 Argument : Boolean (1 or 0). Only used for setting.
163 Throws : none
165 See Also : L<iteration()|iteration>
167 =cut
169 sub found_again {
170 my $self = shift;
171 return $self->{'_found_again'} = shift if @_;
172 return $self->{'_found_again'};
176 sub expect { shift->significance(@_) }