2 # BioPerl module for Bio::SeqFeature::SimilarityPair
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Hilmar Lapp <hlapp@gmx.net>
8 # Copyright Hilmar Lapp
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
16 Bio::SeqFeature::SimilarityPair - Sequence feature based on the similarity
21 $sim_pair = Bio::SeqFeature::SimilarityPair->from_searchResult($blastHit);
23 $sim = $sim_pair->query(); # a Bio::SeqFeature::Similarity object - the query
24 $sim = $sim_pair->hit(); # dto - the hit.
26 # some properties for the similarity pair
27 $expect = $sim_pair->significance();
28 $score = $sim_pair->score();
29 $bitscore = $sim_pair->bits();
31 # this will not write the description for the sequence (only its name)
32 print $sim_pair->query()->gff_string(), "\n";
36 Lightweight similarity search result as a pair of Similarity
37 features. This class inherits off Bio::SeqFeature::FeaturePair and
38 therefore implements Bio::SeqFeatureI, whereas the two features of the
39 pair are descendants of Bio::SeqFeature::Generic, with better support
40 for representing similarity search results in a cleaner way.
46 User feedback is an integral part of the evolution of this and other
47 Bioperl modules. Send your comments and suggestions preferably to one
48 of the Bioperl mailing lists. Your participation is much appreciated.
50 bioperl-l@bioperl.org - General discussion
51 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
55 Please direct usage questions or support issues to the mailing list:
57 I<bioperl-l@bioperl.org>
59 rather than to the module maintainer directly. Many experienced and
60 reponsive experts will be able look at the problem and quickly
61 address it. Please include a thorough description of the problem
62 with code and data examples if at all possible.
66 Report bugs to the Bioperl bug tracking system to help us keep track
67 the bugs and their resolution. Bug reports can be submitted via the
70 https://github.com/bioperl/bioperl-live/issues
72 =head1 AUTHOR - Hilmar Lapp
74 Email hlapp@gmx.net or hilmar.lapp@pharma.novartis.com
78 The rest of the documentation details each of the object
79 methods. Internal methods are usually preceded with a _
84 # Let the code begin...
87 package Bio
::SeqFeature
::SimilarityPair
;
90 use Bio
::SeqFeature
::Similarity
;
91 use Bio
::Factory
::ObjectFactory
;
93 use base
qw(Bio::SeqFeature::FeaturePair);
98 Usage : my $similarityPair = Bio::SeqFeature::SimilarityPair->new
101 -source => 'blastp');
102 Function: Initializes a new SimilarityPair object
103 Returns : Bio::SeqFeature::SimilarityPair
104 Args : -query => The query in a Feature pair
105 -hit => (formerly '-subject') the subject/hit in a Feature pair
111 my($class,@args) = @_;
113 if(! grep { lc($_) eq "-feature_factory"; } @args) {
114 # if no overriding factory is provided, provide our preferred one
115 my $fact = Bio
::Factory
::ObjectFactory
->new(
116 -type
=> "Bio::SeqFeature::Similarity",
117 -interface
=> "Bio::SeqFeatureI");
118 push(@args, '-feature_factory', $fact);
120 my $self = $class->SUPER::new
(@args);
122 my ($primary, $hit, $query, $fea1, $source,$sbjct) =
123 $self->_rearrange([qw(PRIMARY
132 # undeprecated by Jason before 1.1 release
133 # $self->deprecated("use of -subject deprecated: SimilarityPair now uses 'hit'");
134 if(! $hit) { $hit = $sbjct }
136 $self->warn("-hit and -subject were specified, using -hit and ignoring -subject");
140 # set the query and subject feature if provided
141 $self->query( $query) if $query && ! $fea1;
142 $hit && $self->hit($hit);
144 # the following refer to feature1, which is guaranteed to exist
145 if( defined $primary || ! defined $self->primary_tag) {
146 $primary = 'similarity' unless defined $primary;
147 $self->primary_tag($primary);
150 $source && $self->source_tag($source);
156 # Everything else is just inherited from SeqFeature::FeaturePair.
162 Usage : $query_feature = $obj->query();
163 $obj->query($query_feature);
164 Function: The query object for this similarity pair
165 Returns : Bio::SeqFeature::Similarity
166 Args : [optional] Bio::SeqFeature::Similarity
168 See L<Bio::SeqFeature::Similarity>, L<Bio::SeqFeature::FeaturePair>
173 return shift->feature1(@_);
182 Usage : $sbjct_feature = $obj->subject();
183 $obj->subject($sbjct_feature);
184 Function: Get/Set Subject for a SimilarityPair
185 Returns : Bio::SeqFeature::Similarity
186 Args : [optional] Bio::SeqFeature::Similarity
187 Notes : Deprecated. Use the method 'hit' instead
193 # $self->deprecated("Method subject deprecated: use hit() instead");
200 Usage : $sbjct_feature = $obj->hit();
201 $obj->hit($sbjct_feature);
202 Function: Get/Set Hit for a SimilarityPair
203 Returns : Bio::SeqFeature::Similarity
204 Args : [optional] Bio::SeqFeature::Similarity
210 return shift->feature2(@_);
216 Usage : $source = $obj->source_tag(); # i.e., program
217 $obj->source_tag($evalue);
218 Function: Gets the source tag (program name typically) for a feature
220 Args : [optional] string
226 my ($self, @args) = @_;
229 $self->hit()->source_tag(@args);
231 return $self->query()->source_tag(@args);
237 Usage : $evalue = $obj->significance();
238 $obj->significance($evalue);
247 my ($self, @args) = @_;
250 $self->hit()->significance(@args);
252 return $self->query()->significance(@args);
258 Usage : $score = $obj->score();
268 my ($self, @args) = @_;
271 $self->hit()->score(@args);
273 # Note: You might think it's only getting set on the hit object.
274 # Actually, it's getting set on both hit and query.
276 return $self->query()->score(@args);
282 Usage : $bits = $obj->bits();
292 my ($self, @args) = @_;
295 $self->hit()->bits(@args);
297 return $self->query()->bits(@args);
300 #################################################################
301 # aliases for backwards compatibility or convenience #
302 #################################################################