sync w/ main trunk
[bioperl-live.git] / Bio / SeqFeature / Similarity.pm
blob03862a8fec3c989ecd73fcdc0abec44c73cf5748
1 # $Id$
3 # BioPerl module for Bio::SeqFeature::Similarity
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Hilmar Lapp <hlapp@gmx.net>
9 # Copyright Hilmar Lapp
11 # You may distribute this module under the same terms as perl itself
13 # POD documentation - main docs before the code
15 =head1 NAME
17 Bio::SeqFeature::Similarity - A sequence feature based on similarity
19 =head1 SYNOPSIS
21 # obtain a similarity feature somehow
22 print "significance: ", $sim_fea->significance(), "\n";
23 print "bit score: ", $sim_fea->bits(), "\n";
24 print "score: ", $sim_fea->score(), "\n";
25 print "fraction of identical residues: ", $sim_fea->frac_identical(), "\n";
27 =head1 DESCRIPTION
29 This module is basically a sequence features based on similarity, and therefore
30 has support for measures assessing the similarity.
32 Everything else is inherited from L<Bio::SeqFeature::Generic>.
34 =head1 FEEDBACK
36 =head2 Mailing Lists
38 User feedback is an integral part of the evolution of this
39 and other Bioperl modules. Send your comments and suggestions preferably
40 to one of the Bioperl mailing lists.
41 Your participation is much appreciated.
43 bioperl-l@bioperl.org - General discussion
44 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
46 =head2 Support
48 Please direct usage questions or support issues to the mailing list:
50 L<bioperl-l@bioperl.org>
52 rather than to the module maintainer directly. Many experienced and
53 reponsive experts will be able look at the problem and quickly
54 address it. Please include a thorough description of the problem
55 with code and data examples if at all possible.
57 =head2 Reporting Bugs
59 Report bugs to the Bioperl bug tracking system to help us keep track
60 the bugs and their resolution. Bug reports can be submitted via the
61 web:
63 http://bugzilla.open-bio.org/
65 =head1 AUTHOR - Hilmar Lapp
67 Email hlapp@gmx.net or hilmar.lapp@pharma.novartis.com
69 =head1 APPENDIX
71 The rest of the documentation details each of the object
72 methods. Internal methods are usually preceded with a _
74 =cut
77 # Let the code begin...
80 package Bio::SeqFeature::Similarity;
81 use strict;
84 use base qw(Bio::SeqFeature::Generic);
86 sub new {
87 my ( $caller, @args) = @_;
88 my ($self) = $caller->SUPER::new(@args);
90 my ($primary,$evalue, $bits, $frac,$seqlen,$seqdesc) =
91 $self->_rearrange([qw(PRIMARY
92 EXPECT
93 BITS
94 FRAC
95 SEQLENGTH
96 SEQDESC
97 )],@args);
99 defined $evalue && $self->significance($evalue);
100 defined $bits && $self->bits($bits);
101 defined $frac && $self->frac_identical($frac);
102 defined $seqlen && $self->seqlength($seqlen);
103 defined $seqdesc && $self->seqdesc($seqdesc);
104 $primary = 'similarity' unless defined $primary;
105 $self->primary_tag($primary) unless( defined $self->primary_tag() );
106 $self->strand(0) unless( defined $self->strand() );
108 return $self;
111 =head2 significance
113 Title : significance
114 Usage : $evalue = $obj->significance();
115 $obj->significance($evalue);
116 Function:
117 Returns :
118 Args :
121 =cut
123 sub significance {
124 return shift->_tag_value('signif', @_);
127 =head2 bits
129 Title : bits
130 Usage : $bits = $obj->bits();
131 $obj->bits($value);
132 Function:
133 Returns :
134 Args :
137 =cut
139 sub bits {
140 return shift->_tag_value('Bits', @_);
143 =head2 frac_identical
145 Title : frac_identical
146 Usage : $fracid = $obj->frac_identical();
147 $obj->frac_identical($value);
148 Function:
149 Returns :
150 Args :
153 =cut
155 sub frac_identical {
156 return shift->_tag_value('FracId', @_);
159 =head2 seqlength
161 Title : seqlength
162 Usage : $len = $obj->seqlength();
163 $obj->seqlength($len);
164 Function:
165 Returns :
166 Args :
169 =cut
171 sub seqlength {
172 return shift->_tag_value('SeqLength', @_);
175 =head2 seqdesc
177 Title : seqdesc
178 Usage : $desc = $obj->seqdesc();
179 $obj->seqdesc($desc);
180 Function: At present this method is a shorthand for
181 $obj->annotation()->description().
183 Note that this is not stored in the tag system and hence will
184 not be included in the return value of gff_string().
185 Returns :
186 Args :
189 =cut
191 sub seqdesc {
192 my ($self, $value) = @_;
194 if( defined $value ) {
195 my $v = Bio::Annotation::SimpleValue->new();
196 $v->value($value);
197 $self->annotation->add_Annotation('description',$v);
199 my ($v) = $self->annotation()->get_Annotations('description');
200 return defined $v ? $v->value : undef;
204 # Everything else is just inherited from SeqFeature::Generic.