Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/SeqFeature/Similarity.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: Similarity.pm,v 1.10 2002/11/01 21:39:05 jason Exp $ | |
2 # | |
3 # BioPerl module for Bio::SeqFeature::Similarity | |
4 # | |
5 # Cared for by Hilmar Lapp <hlapp@gmx.net> | |
6 # | |
7 # Copyright Hilmar Lapp | |
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::SeqFeature::Similarity - A sequence feature based on similarity | |
16 | |
17 =head1 SYNOPSIS | |
18 | |
19 # obtain a similarity feature somehow | |
20 print "significance: ", $sim_fea->significance(), "\n"; | |
21 print "bit score: ", $sim_fea->bits(), "\n"; | |
22 print "score: ", $sim_fea->score(), "\n"; | |
23 print "fraction of identical residues: ", $sim_fea->frac_identical(), "\n"; | |
24 | |
25 =head1 DESCRIPTION | |
26 | |
27 This module is basically a sequence features based on similarity, and therefore | |
28 has support for measures assessing the similarity. | |
29 | |
30 Everything else is inherited from L<Bio::SeqFeature::Generic>. | |
31 | |
32 =head1 FEEDBACK | |
33 | |
34 =head2 Mailing Lists | |
35 | |
36 User feedback is an integral part of the evolution of this | |
37 and other Bioperl modules. Send your comments and suggestions preferably | |
38 to one of the Bioperl mailing lists. | |
39 Your participation is much appreciated. | |
40 | |
41 bioperl-l@bioperl.org - General discussion | |
42 http://bio.perl.org/MailList.html - About the mailing lists | |
43 | |
44 =head2 Reporting Bugs | |
45 | |
46 Report bugs to the Bioperl bug tracking system to help us keep track | |
47 the bugs and their resolution. | |
48 Bug reports can be submitted via email or the web: | |
49 | |
50 bioperl-bugs@bio.perl.org | |
51 http://bugzilla.bioperl.org/ | |
52 | |
53 =head1 AUTHOR - Hilmar Lapp | |
54 | |
55 Email hlapp@gmx.net or hilmar.lapp@pharma.novartis.com | |
56 | |
57 Describe contact details here | |
58 | |
59 =head1 APPENDIX | |
60 | |
61 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ | |
62 | |
63 =cut | |
64 | |
65 | |
66 # Let the code begin... | |
67 | |
68 | |
69 package Bio::SeqFeature::Similarity; | |
70 use vars qw(@ISA); | |
71 use strict; | |
72 | |
73 use Bio::SeqFeature::Generic; | |
74 | |
75 @ISA = qw(Bio::SeqFeature::Generic); | |
76 | |
77 sub new { | |
78 my ( $caller, @args) = @_; | |
79 my ($self) = $caller->SUPER::new(@args); | |
80 | |
81 my ($primary,$evalue, $bits, $frac,$seqlen,$seqdesc) = | |
82 $self->_rearrange([qw(PRIMARY | |
83 EXPECT | |
84 BITS | |
85 FRAC | |
86 SEQDESC | |
87 SEQLENGTH | |
88 )],@args); | |
89 | |
90 defined $evalue && $self->significance($evalue); | |
91 defined $bits && $self->bits($bits); | |
92 defined $frac && $self->frac_identical($frac); | |
93 defined $seqlen && $self->seqlength($seqlen); | |
94 defined $seqdesc && $self->seqdesc($seqdesc); | |
95 $primary = 'similarity' unless defined $primary; | |
96 $self->primary_tag($primary) unless( defined $self->primary_tag() ); | |
97 $self->strand(0) unless( defined $self->strand() ); | |
98 | |
99 return $self; | |
100 } | |
101 | |
102 =head2 significance | |
103 | |
104 Title : significance | |
105 Usage : $evalue = $obj->significance(); | |
106 $obj->significance($evalue); | |
107 Function: | |
108 Returns : | |
109 Args : | |
110 | |
111 | |
112 =cut | |
113 | |
114 sub significance { | |
115 my ($self, $value) = @_; | |
116 | |
117 return $self->_tag_value('signif', $value); | |
118 } | |
119 | |
120 =head2 bits | |
121 | |
122 Title : bits | |
123 Usage : $bits = $obj->bits(); | |
124 $obj->bits($value); | |
125 Function: | |
126 Returns : | |
127 Args : | |
128 | |
129 | |
130 =cut | |
131 | |
132 sub bits { | |
133 my ($self, $value) = @_; | |
134 | |
135 return $self->_tag_value('Bits', $value); | |
136 } | |
137 | |
138 =head2 frac_identical | |
139 | |
140 Title : frac_identical | |
141 Usage : $fracid = $obj->frac_identical(); | |
142 $obj->frac_identical($value); | |
143 Function: | |
144 Returns : | |
145 Args : | |
146 | |
147 | |
148 =cut | |
149 | |
150 sub frac_identical { | |
151 my ($self, $value) = @_; | |
152 | |
153 return $self->_tag_value('FracId', $value); | |
154 } | |
155 | |
156 =head2 seqlength | |
157 | |
158 Title : seqlength | |
159 Usage : $len = $obj->seqlength(); | |
160 $obj->seqlength($len); | |
161 Function: | |
162 Returns : | |
163 Args : | |
164 | |
165 | |
166 =cut | |
167 | |
168 sub seqlength { | |
169 my ($self, $value) = @_; | |
170 | |
171 return $self->_tag_value('SeqLength', $value); | |
172 } | |
173 | |
174 =head2 seqdesc | |
175 | |
176 Title : seqdesc | |
177 Usage : $desc = $obj->seqdesc(); | |
178 $obj->seqdesc($desc); | |
179 Function: At present this method is a shorthand for | |
180 $obj->annotation()->description(). | |
181 | |
182 Note that this is not stored in the tag system and hence will | |
183 not be included in the return value of gff_string(). | |
184 Returns : | |
185 Args : | |
186 | |
187 | |
188 =cut | |
189 | |
190 sub seqdesc { | |
191 my ($self, $value) = @_; | |
192 | |
193 if( defined $value ) { | |
194 my $v = Bio::Annotation::SimpleValue->new(); | |
195 $v->value($value); | |
196 $self->annotation->add_Annotation('description',$v); | |
197 } | |
198 my ($v) = $self->annotation()->get_Annotations('description'); | |
199 return $v ? $v->value : undef; | |
200 } | |
201 | |
202 # | |
203 # Everything else is just inherited from SeqFeature::Generic. | |
204 # | |
205 | |
206 1; |