2 # BioPerl module for Bio::Search::HSP::WABAHSP
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
16 Bio::Search::HSP::WABAHSP - HSP object suitable for describing WABA alignments
20 # use this object as you would a GenericHSP
21 # a few other methods have been added including state
25 This object implements a few of the extra methods such as
26 hmmstate_string which returns the HMM state representation for the
27 WABA alignment. We also must implement a method to calculate
28 homology_string since it is not returned by the algorithm in the
29 machine readable format.
35 User feedback is an integral part of the evolution of this and other
36 Bioperl modules. Send your comments and suggestions preferably to
37 the Bioperl mailing list. Your participation is much appreciated.
39 bioperl-l@bioperl.org - General discussion
40 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
44 Please direct usage questions or support issues to the mailing list:
46 I<bioperl-l@bioperl.org>
48 rather than to the module maintainer directly. Many experienced and
49 reponsive experts will be able look at the problem and quickly
50 address it. Please include a thorough description of the problem
51 with code and data examples if at all possible.
55 Report bugs to the Bioperl bug tracking system to help us keep track
56 of the bugs and their resolution. Bug reports can be submitted via the
59 https://github.com/bioperl/bioperl-live/issues
61 =head1 AUTHOR - Jason Stajich
63 Email jason@bioperl.org
67 The rest of the documentation details each of the object methods.
68 Internal methods are usually preceded with a _
72 # Let the code begin...
75 package Bio
::Search
::HSP
::WABAHSP
;
79 use base
qw(Bio::Search::HSP::GenericHSP);
84 Usage : my $obj = Bio::Search::HSP::WABAHSP->new();
85 Function: Builds a new Bio::Search::HSP::WABAHSP object
86 Returns : Bio::Search::HSP::WABAHSP
87 Args : -hmmstate_seq => the string representing the state output from WABA
92 my($class,@args) = @_;
94 # gotta do some preprocessing before we send the arguments to the superclass
95 my ($len,$qs,$hs) = Bio
::Root
::RootI
->_rearrange([qw(HSP_LENGTH
98 if( $len != length($qs) ) {
99 Bio
::Root
::RootI
->warn("HSP_LENGTH must equal length of query_seq string, using value from QUERY_SEQ\n");
102 my( $homol_seq,$gapct,$identical) = ('',0,0);
104 for(my $i=0;$i<$len;$i++) {
105 my $q = substr($qs,$i,1);
106 my $h = substr($hs,$i,1);
107 if( $q eq '-' || $h eq '-' ) {
110 } elsif( $q eq $h ) {
117 my $self = $class->SUPER::new
('-conserved' => $identical,
118 '-identical' => $identical,
120 '-homology_seq' => $homol_seq,
123 my ($hmmst) = $self->_rearrange([qw(HMMSTATE_SEQ)],@args);
124 defined $hmmst && $self->hmmstate_string($hmmst);
126 $self->add_tag_value('Target' , join(" ","Sequence:".$self->hit->seq_id,
127 $self->hit->start, $self->hit->end));
132 =head2 hmmstate_string
134 Title : hmmstate_string
135 Usage : my $hmmseq = $wabahsp->hmmstate_string();
136 Function: Get/Set the WABA HMM stateseq
138 Args : [optional] string
144 my ($self,$val) = @_;
146 $self->{'_hmmstate_string'} = $val;
148 return $self->{'_hmmstate_string'};
151 =head2 homology_string
153 Title : homolgy_string
154 Usage : my $homology_str = $hsp->homology_string();
155 Function: Homology string must be calculated for a WABA HSP so we can do
156 so here and cache the result so it is only done once