| 1 | # | ||||||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::Search::HSP::WABAHSP | ||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||
| 6 | # Cared for by Jason Stajich <jason@bioperl.org> | ||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||
| 8 | # Copyright Jason Stajich | ||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||
| 10 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | # POD documentation - main docs before the code | ||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||
| 14 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||
| 16 | Bio::Search::HSP::WABAHSP - HSP object suitable for describing WABA alignments | ||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | # use this object as you would a GenericHSP | ||||||||||||||||||||||||||||||||
| 21 | # a few other methods have been added including state | ||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||
| 23 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||
| 39 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||
| 40 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | =head2 Support | ||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||
| 44 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||
| 46 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||||||
| 57 | web: | ||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||
| 59 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||
| 61 | =head1 AUTHOR - Jason Stajich | ||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||
| 63 | Email jason@bioperl.org | ||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||
| 65 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||
| 67 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||||||
| 68 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||
| 70 | =cut | ||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | # Let the code begin... | ||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||
| 75 | package Bio::Search::HSP::WABAHSP; | ||||||||||||||||||||||||||||||||
| 76 | 2 | $Bio::Search::HSP::WABAHSP::VERSION = '1.7.8'; | |||||||||||||||||||||||||||||||
| 77 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 78 | 2 | ▶ | use Bio::Root::RootI; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||
| 80 | 2 | ▶ | use base qw(Bio::Search::HSP::GenericHSP); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||
| 82 | =head2 new | ||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||
| 84 | Title : new | ||||||||||||||||||||||||||||||||
| 85 | Usage : my $obj = Bio::Search::HSP::WABAHSP->new(); | ||||||||||||||||||||||||||||||||
| 86 | Function: Builds a new Bio::Search::HSP::WABAHSP object | ||||||||||||||||||||||||||||||||
| 87 | Returns : Bio::Search::HSP::WABAHSP | ||||||||||||||||||||||||||||||||
| 88 | Args : -hmmstate_seq => the string representing the state output from WABA | ||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||
| 90 | =cut | ||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||
| 92 | 4 | ▶ | sub new { | ||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||||||
| 93 | 4 | my($class,@args) = @_; | |||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||
| 95 | # gotta do some preprocessing before we send the arguments to the superclass | ||||||||||||||||||||||||||||||||
| 96 | 4 | my ($len,$qs,$hs) = Bio::Root::RootI->_rearrange([qw(HSP_LENGTH | |||||||||||||||||||||||||||||||
| 97 | QUERY_SEQ | ||||||||||||||||||||||||||||||||
| 98 | HIT_SEQ)],@args); | ||||||||||||||||||||||||||||||||
| 99 | 4 | ▶ | if( $len != length($qs) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 100 | 0 | Bio::Root::RootI->warn("HSP_LENGTH must equal length of query_seq string, using value from QUERY_SEQ\n"); | |||||||||||||||||||||||||||||||
| 101 | 0 | $len = length($qs); | |||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||
| 103 | 4 | my( $homol_seq,$gapct,$identical) = ('',0,0); | |||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||
| 105 | 4 | ▶ | for(my $i=0;$i<$len;$i++) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 106 | 17834 | my $q = substr($qs,$i,1); | |||||||||||||||||||||||||||||||
| 107 | 17834 | my $h = substr($hs,$i,1); | |||||||||||||||||||||||||||||||
| 108 | 17834 | ▶ | if( $q eq '-' || $h eq '-' ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$q eq "-" or $h eq "-"
MC/DC100%2/2
$q eq "-" or $h eq "-"
$q eq "-"
$h eq "-"
Truth table100%3/3
A or B
A= $q eq "-"B= $h eq "-"
| |||||||||||||||||||||||||||||||||
| 109 | 5686 | $homol_seq .= ' '; | |||||||||||||||||||||||||||||||
| 110 | 5686 | $gapct ++; | |||||||||||||||||||||||||||||||
| 111 | } elsif( $q eq $h ) { | ||||||||||||||||||||||||||||||||
| 112 | 8072 | $homol_seq .= '|'; | |||||||||||||||||||||||||||||||
| 113 | 8072 | $identical++; | |||||||||||||||||||||||||||||||
| 114 | } else { | ||||||||||||||||||||||||||||||||
| 115 | 4076 | $homol_seq .= ' '; | |||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||
| 118 | 4 | my $self = $class->SUPER::new('-conserved' => $identical, | |||||||||||||||||||||||||||||||
| 119 | '-identical' => $identical, | ||||||||||||||||||||||||||||||||
| 120 | '-gaps' => $gapct, | ||||||||||||||||||||||||||||||||
| 121 | '-homology_seq' => $homol_seq, | ||||||||||||||||||||||||||||||||
| 122 | @args); | ||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||
| 124 | 4 | my ($hmmst) = $self->_rearrange([qw(HMMSTATE_SEQ)],@args); | |||||||||||||||||||||||||||||||
| 125 | 4 | ▶ | defined $hmmst && $self->hmmstate_string($hmmst); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||
| 127 | 4 | $self->add_tag_value('Target' , join(" ","Sequence:".$self->hit->seq_id, | |||||||||||||||||||||||||||||||
| 128 | $self->hit->start, $self->hit->end)); | ||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||
| 130 | 4 | return $self; | |||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||
| 133 | =head2 hmmstate_string | ||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||
| 135 | Title : hmmstate_string | ||||||||||||||||||||||||||||||||
| 136 | Usage : my $hmmseq = $wabahsp->hmmstate_string(); | ||||||||||||||||||||||||||||||||
| 137 | Function: Get/Set the WABA HMM stateseq | ||||||||||||||||||||||||||||||||
| 138 | Returns : string | ||||||||||||||||||||||||||||||||
| 139 | Args : [optional] string | ||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||
| 142 | =cut | ||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||
| 144 | 8 | ▶ | sub hmmstate_string{ | ||||||||||||||||||||||||||||||
|
Subroutine
hmmstate_string: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 145 | 8 | my ($self,$val) = @_; | |||||||||||||||||||||||||||||||
| 146 | 8 | ▶ | if( defined $val ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 147 | 4 | $self->{'_hmmstate_string'} = $val; | |||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||
| 149 | 8 | return $self->{'_hmmstate_string'}; | |||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||
| 152 | =head2 homology_string | ||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||
| 154 | Title : homolgy_string | ||||||||||||||||||||||||||||||||
| 155 | Usage : my $homology_str = $hsp->homology_string(); | ||||||||||||||||||||||||||||||||
| 156 | Function: Homology string must be calculated for a WABA HSP so we can do | ||||||||||||||||||||||||||||||||
| 157 | so here and cache the result so it is only done once | ||||||||||||||||||||||||||||||||
| 158 | Returns : string | ||||||||||||||||||||||||||||||||
| 159 | Args : none | ||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||
| 162 | =cut | ||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | sub homology_string{ | ||||||||||||||||||||||||||||||
|
Subroutine
homology_string: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 165 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||
| 166 | 0 | return ''; | |||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||
| 170 | 2 | 1; | |||||||||||||||||||||||||||||||