comparison variant_effect_predictor/Bio/Search/HSP/WABAHSP.pm @ 0:1f6dce3d34e0

Uploaded
author mahtabm
date Thu, 11 Apr 2013 02:01:53 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1f6dce3d34e0
1 # $Id: WABAHSP.pm,v 1.5 2002/10/22 07:45:17 lapp Exp $
2 #
3 # BioPerl module for Bio::Search::HSP::WABAHSP
4 #
5 # Cared for by Jason Stajich <jason@bioperl.org>
6 #
7 # Copyright Jason Stajich
8 #
9 # You may distribute this module under the same terms as perl itself
10
11 # POD documentation - main docs before the code
12
13 =head1 NAME
14
15 Bio::Search::HSP::WABAHSP - HSP object suitable for describing WABA alignments
16
17 =head1 SYNOPSIS
18
19 # use this object as you would a GenericHSP
20 # a few other methods have been added including state
21
22 =head1 DESCRIPTION
23
24 This object implements a few of the extra methods such as
25 hmmstate_string which returns the HMM state representation for the
26 WABA alignment. We also must implement a method to calculate
27 homology_string since it is not returned by the algorithm in the
28 machine readable format.
29
30 =head1 FEEDBACK
31
32 =head2 Mailing Lists
33
34 User feedback is an integral part of the evolution of this and other
35 Bioperl modules. Send your comments and suggestions preferably to
36 the Bioperl mailing list. Your participation is much appreciated.
37
38 bioperl-l@bioperl.org - General discussion
39 http://bioperl.org/MailList.shtml - About the mailing lists
40
41 =head2 Reporting Bugs
42
43 Report bugs to the Bioperl bug tracking system to help us keep track
44 of the bugs and their resolution. Bug reports can be submitted via
45 email or the web:
46
47 bioperl-bugs@bioperl.org
48 http://bugzilla.bioperl.org/
49
50 =head1 AUTHOR - Jason Stajich
51
52 Email jason@bioperl.org
53
54 Describe contact details here
55
56 =head1 CONTRIBUTORS
57
58 Additional contributors names and emails here
59
60 =head1 APPENDIX
61
62 The rest of the documentation details each of the object methods.
63 Internal methods are usually preceded with a _
64
65 =cut
66
67 # Let the code begin...
68
69
70 package Bio::Search::HSP::WABAHSP;
71 use vars qw(@ISA);
72 use strict;
73 use Bio::Root::RootI;
74 use Bio::Search::HSP::GenericHSP;
75
76 @ISA = qw(Bio::Search::HSP::GenericHSP );
77
78 =head2 new
79
80 Title : new
81 Usage : my $obj = new Bio::Search::HSP::WABAHSP();
82 Function: Builds a new Bio::Search::HSP::WABAHSP object
83 Returns : Bio::Search::HSP::WABAHSP
84 Args : -hmmstate_seq => the string representing the state output from WABA
85
86 =cut
87
88 sub new {
89 my($class,@args) = @_;
90
91 # gotta do some preprocessing before we send the arguments to the superclass
92 my ($len,$qs,$hs) = Bio::Root::RootI->_rearrange([qw(HSP_LENGTH
93 QUERY_SEQ
94 HIT_SEQ)],@args);
95 if( $len != length($qs) ) {
96 Bio::Root::RootI->warn("HSP_LENGTH must equal length of query_seq string, using value from QUERY_SEQ\n");
97 $len = length($qs);
98 }
99 my( $homol_seq,$gapct,$identical) = ('',0,0);
100
101 for(my $i=0;$i<$len;$i++) {
102 my $q = substr($qs,$i,1);
103 my $h = substr($hs,$i,1);
104 if( $q eq '-' || $h eq '-' ) {
105 $homol_seq .= ' ';
106 $gapct ++;
107 } elsif( $q eq $h ) {
108 $homol_seq .= '|';
109 $identical++;
110 } else {
111 $homol_seq .= ' ';
112 }
113 }
114 my $self = $class->SUPER::new('-conserved' => $identical,
115 '-identical' => $identical,
116 '-gaps' => $gapct,
117 '-homology_seq' => $homol_seq,
118 @args);
119
120 my ($hmmst) = $self->_rearrange([qw(HMMSTATE_SEQ)],@args);
121 defined $hmmst && $self->hmmstate_string($hmmst);
122
123 $self->add_tag_value('Target' , join(" ","Sequence:".$self->hit->seq_id,
124 $self->hit->start, $self->hit->end));
125
126 return $self;
127 }
128
129 =head2 hmmstate_string
130
131 Title : hmmstate_string
132 Usage : my $hmmseq = $wabahsp->hmmstate_string();
133 Function: Get/Set the WABA HMM stateseq
134 Returns : string
135 Args : [optional] string
136
137
138 =cut
139
140 sub hmmstate_string{
141 my ($self,$val) = @_;
142 if( defined $val ) {
143 $self->{'_hmmstate_string'} = $val;
144 }
145 return $self->{'_hmmstate_string'};
146 }
147
148 =head2 homolgy_string
149
150 Title : homolgy_string
151 Usage : my $homology_str = $hsp->homology_string();
152 Function: Homology string must be calculated for a WABA HSP so we can do
153 so here and cache the result so it is only done once
154 Returns : string
155 Args : none
156
157
158 =cut
159
160 sub homolgy_string{
161 my ($self) = @_;
162 return '';
163 }
164
165
166 1;