Bio::SeqFeature SimilarityPair
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Summary
Bio::SeqFeature::SimilarityPair - Sequence feature based on the similarity
of two sequences.
Package variables
No package variables defined.
Included modules
Bio::SearchIO
Bio::SeqFeature::FeaturePair
Bio::SeqFeature::Similarity
Inherit
Bio::SeqFeature::FeaturePair
Synopsis
  $sim_pair = Bio::SeqFeature::SimilarityPair->from_searchResult($blastHit);

  $sim = $sim_pair->query(); # a Bio::SeqFeature::Similarity object - the query
  $sim = $sim_pair->hit();   # dto - the hit.

  # some properties for the similarity pair
  $expect = $sim_pair->significance();
  $score = $sim_pair->score();
  $bitscore = $sim_pair->bits();

  # this will not write the description for the sequence (only its name)
  print $sim_pair->query()->gff_string(), "\n";
Description
Lightweight similarity search result as a pair of Similarity
features. This class inherits off Bio::SeqFeature::FeaturePair and
therefore implements Bio::SeqFeatureI, whereas the two features of the
pair are descendants of Bio::SeqFeature::Generic, with better support
for representing similarity search results in a cleaner way.
Methods
newDescriptionCode
queryDescriptionCode
subjectDescriptionCode
hitDescriptionCode
source_tagDescriptionCode
significanceDescriptionCode
scoreDescriptionCode
bitsDescriptionCode
Methods description
newcode    nextTop
 Title   : new
 Usage   : my $similarityPair = new Bio::SeqFeature::SimilarityPair
                                 (-hit   => $hit,
				  -query => $query,
				  -source => 'blastp');
 Function: Initializes a new SimilarityPair object
 Returns : Bio::SeqFeature::SimilarityPair
 Args    : -query => The query in a Feature pair 
           -hit   => (formerly '-subject') the subject/hit in a Feature pair
querycodeprevnextTop
 Title   : query
 Usage   : $query_feature = $obj->query();
           $obj->query($query_feature);
 Function: 
 Returns : 
 Args    :
subjectcodeprevnextTop
 Title   : subject
 Usage   : $sbjct_feature = $obj->subject();
           $obj->subject($sbjct_feature);
 Function: Get/Set Subject for a SimilarityPair 
 Returns : Bio::SeqFeature::Similarity
 Args    : [optional] Bio::SeqFeature::Similarity
 Notes   : Deprecated.  Use the method 'hit' instead
hitcodeprevnextTop
 Title   : hit
 Usage   : $sbjct_feature = $obj->hit();
           $obj->hit($sbjct_feature);
 Function: Get/Set Hit for a SimilarityPair 
 Returns : Bio::SeqFeature::Similarity
 Args    : [optional] Bio::SeqFeature::Similarity
source_tagcodeprevnextTop
 Title   : source_tag
 Usage   : $source = $obj->source_tag(); # i.e., program
           $obj->source_tag($evalue);
 Function: 
 Returns : 
 Args    :
significancecodeprevnextTop
 Title   : significance
 Usage   : $evalue = $obj->significance();
           $obj->significance($evalue);
 Function: 
 Returns : 
 Args    :
scorecodeprevnextTop
 Title   : score
 Usage   : $score = $obj->score();
           $obj->score($value);
 Function: 
 Returns : 
 Args    :
bitscodeprevnextTop
 Title   : bits
 Usage   : $bits = $obj->bits();
           $obj->bits($value);
 Function: 
 Returns : 
 Args    :
Methods code
newdescriptionprevnextTop
sub new {
    my($class,@args) = @_;

    my $self = $class->SUPER::new(@args);

    # Hack to deal with the fact that SimilarityPair calls strand()
# which will lead to an error in Bio::Search::HSP::BlastHSP
# because parsing hasn't yet occurred.
# TODO: Remove this when BlastHSP doesn't do lazy parsing.
$self->{'_initializing'} = 1; my ($hit, $query, $fea1, $source,$sbjct) = $self->_rearrange([qw(HIT QUERY FEATURE1 SOURCE SUBJECT )],@args); if( $sbjct ) { $self->deprecated("use of -subject deprecated: SimilarityPair now uses 'hit'"); if(! $hit) { $hit = $sbjct } else { $self->warn("-hit and -subject were specified, using -hit and ignoring -subject"); } } # make sure at least the query feature exists -- this refers to feature1
if($query && ! $fea1) { $self->query( $query); } else { $self->query('null'); } # call with no args sets a default value for query
$hit && $self->hit($hit); # the following refer to feature1, which has been ensured to exist
$self->primary_tag('similarity') unless( defined $self->primary_tag() ); $source && $self->source_tag($source); $self->strand(0) unless( defined $self->strand() ); $self->{'_initializing'} = 0; # See "Hack" note above
return $self;
}
querydescriptionprevnextTop
sub query {
    my ($self, @args) = @_;
    my $f = $self->feature1();
    if( ! @args || ( !ref($args[0]) && $args[0] eq 'null') ) {
	if( ! defined( $f) ) {
	    @args = Bio::SeqFeature::Similarity->new();	    
	} elsif( ! $f->isa('Bio::SeqFeature::Similarity') && 
		 $f->isa('Bio::SeqFeatureI') ) {
	    # a Bio::SeqFeature::Generic was placeholder for feature1	    
my $newf = new Bio::SeqFeature::Similarity( -start => $f->start(), -end => $f->end(), -strand => $f->strand(), -primary => $f->primary_tag(), -source => $f->source_tag(), -seqname => $f->seqname(), -score => $f->score(), -frame => $f->frame(), ); foreach my $tag ( $newf->all_tags ) { $tag->add_tag($tag, $newf->each_tag($tag)); } @args = $newf; } else { @args = (); } } return $self->feature1(@args);
}
subjectdescriptionprevnextTop
sub subject {
     my $self = shift;
    $self->deprecated("Method subject deprecated: use hit() instead");
    $self->hit(@_);
}
hitdescriptionprevnextTop
sub hit {
    my ($self, @args) = @_;
    my $f = $self->feature2();
    if(! @args || (!ref($args[0]) && $args[0] eq 'null') ) {
	if( ! defined( $f) ) {
	    @args = Bio::SeqFeature::Similarity->new();
	} elsif( ! $f->isa('Bio::SeqFeature::Similarity') && 
		 $f->isa('Bio::SeqFeatureI')) {
	    # a Bio::SeqFeature::Generic was placeholder for feature2	    
my $newf = new Bio::SeqFeature::Similarity( -start => $f->start(), -end => $f->end(), -strand => $f->strand(), -primary => $f->primary_tag(), -source => $f->source_tag(), -seqname => $f->seqname(), -score => $f->score(), -frame => $f->frame(), ); foreach my $tag ( $newf->all_tags ) { $tag->add_tag($tag, $newf->each_tag($tag)); } @args = $newf; } } return $self->feature2(@args);
}
source_tagdescriptionprevnextTop
sub source_tag {
    my ($self, @args) = @_;

    if(@args) {
	$self->hit()->source_tag(@args);
    }
    return $self->query()->source_tag(@args);
}
significancedescriptionprevnextTop
sub significance {
    my ($self, @args) = @_;

    if(@args) {
	$self->hit()->significance(@args);
    }
    return $self->query()->significance(@args);
}
scoredescriptionprevnextTop
sub score {
    my ($self, @args) = @_;

    if(@args) {
	$self->hit()->score(@args);
    }
    return $self->query()->score(@args);
}
bitsdescriptionprevnextTop
sub bits {
    my ($self, @args) = @_;

    if(@args) {
	$self->hit()->bits(@args);
    }
    return $self->query()->bits(@args);
}
General documentation
FEEDBACKTop
Mailing ListsTop
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
  bioperl-l@bioperl.org              - General discussion
  http://bio.perl.org/MailList.html  - About the mailing lists
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via
email or the web:
  bioperl-bugs@bio.perl.org
  http://bio.perl.org/bioperl-bugs/
AUTHOR - Hilmar LappTop
Email hlapp@gmx.net or hilmar.lapp@pharma.novartis.com
Describe contact details here
APPENDIXTop
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _