Archive Ensembl HomeArchive Ensembl Home
FeaturePair.pm
Go to the documentation of this file.
00001 =head1 LICENSE
00002 
00003   Copyright (c) 1999-2012 The European Bioinformatics Institute and
00004   Genome Research Limited.  All rights reserved.
00005 
00006   This software is distributed under a modified Apache license.
00007   For license details, please see
00008 
00009     http://www.ensembl.org/info/about/code_licence.html
00010 
00011 =head1 CONTACT
00012 
00013   Please email comments or questions to the public Ensembl
00014   developers list at <dev@ensembl.org>.
00015 
00016   Questions may also be sent to the Ensembl help desk at
00017   <helpdesk@ensembl.org>.
00018 
00019 =cut
00020 
00021 =head1 NAME
00022 
00023 Bio::EnsEMBL::FeaturePair - Stores sequence Features which are
00024 themselves hits to other sequence features.
00025 
00026 =head1 SYNOPSIS
00027 
00028     my $feat = Bio::EnsEMBL::FeaturePair->new(
00029       -start      => 132_231,
00030       -end        => 132_321,
00031       -strand     => -1,
00032       -slice      => $slice,
00033       -hstart     => 10,
00034       -hend       => 100,
00035       -hstrand    => 1,
00036       -score      => 100,
00037       -percent_id => 92.0,
00038       -hseqname   => 'ALUSX10.1',
00039       -analysis   => $analysis
00040     );
00041 
00042     my $hit_start  = $feat->hstart();
00043     my $hit_end    = $feat->hend();
00044     my $hit_strand = $feat->hstrand();
00045     my $analysis   = $feat->analysis();
00046 
00047 =head1 DESCRIPTION
00048 
00049 A sequence feature object where the feature is itself a feature on
00050 another sequence - e.g. a blast hit where residues 1-40 of a protein
00051 sequence SW:HBA_HUMAN has hit to bases 100 - 220 on a genomic sequence
00052 HS120G22.  The genomic sequence coordinates are represented by the
00053 start, end, strand attributes while the protein (hit) coordinates are
00054 represented by the hstart, hend, hstrand attributes.
00055 
00056   $clone = $slice_adpator->fetch_by_region( 'clone', 'HS120G22' );
00057 
00058   $fp = Bio::EnsEMBL::FeaturePair(
00059     -start      => 100,
00060     -end        => 220,
00061     -strand     => 1,
00062     -slice      => $clone,
00063     -hstart     => 1,
00064     -hend       => 40,
00065     -hstrand    => 1,
00066     -percent_id => 92.0,
00067     -score      => 100,
00068     -hseqname   => 'SW:HBA_HUMAN',
00069     -species    => 'Homo sapiens',
00070     -hspecies   => 'Homo sapiens'
00071   );
00072 
00073 =head1 METHODS
00074 
00075 =cut
00076 
00077 package Bio::EnsEMBL::FeaturePair;
00078 
00079 use vars qw(@ISA);
00080 use strict;
00081 
00082 use Bio::EnsEMBL::Feature;
00083 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
00084 use Bio::EnsEMBL::Utils::Exception qw(throw deprecate warning);
00085 
00086 @ISA = qw(Bio::EnsEMBL::Feature);
00087 
00088 
00089 
00090 =head2 new
00091 
00092   Arg [HSTART]    : int - The start of the hit region (optional)
00093   Arg [HEND]      : int - The end of the hit region (optional)
00094   Arg [HSTRAND]   : (0,1,-1) - The strand of the hit region (optional)
00095   Arg [PERCENT_ID]: float -  The precentage identity of the hit (optional)
00096   Arg [SCORE]     : float -  The score of the hit (optional)
00097   Arg [HSEQNAME]  : string - The name of the hit sequence (optional)
00098   Arg [P_VALUE]   : float -  The pvalue or evalue (optional)
00099   Arg [SPECIES]   : string - The species the query sequence is from (optional)
00100   Arg [HSPECIES]  : string - The species the hit sequence is from (optional)
00101   Arg [COVERAGE]  : string - The % of the query that this feature pair covers
00102   Arg [HCOVERAGE] : string - The % of the target this this feature pair covers
00103   Arg [...]       : Named superclass constructor args (Bio::EnsEMBL::Feature)
00104   Example    : $feat = Bio::EnsEMBL::FeaturePair->new(-start    => 132_231,
00105                                               -end      => 132_321,
00106                                               -strand   => -1,
00107                                               -slice    => $slice,
00108                                               -hstart   => 10,
00109                                               -hend     => 100,
00110                                               -hstrand  => 1,
00111                                               -score    => 100,
00112                                               -percent_id => 92.0,
00113                                               -hseqname => 'ALUSX10.1',
00114                                               -analysis => $analysis);
00115   Description: Creates a new Bio::EnsEMBL::FeaturePair object
00116   Returntype : Bio::EnsEMBL::FeaturePair
00117   Exceptions : throw if start > end
00118                throw if invalid strand is provided
00119   Caller     : general
00120   Status     : Stable
00121 
00122 =cut
00123 
00124 sub new {
00125   my $caller = shift;
00126 
00127   my $class = ref($caller) || $caller;
00128 
00129   my $self = $class->SUPER::new(@_);
00130 
00131   my ($hstart,$hend,$hstrand,$percent_id,$score, $species, $hspecies,
00132       $p_value, $hseqname, $f1,$f2, $coverage, $hcoverage, $group_id,$level_id, $external_db_id, $extra_data, $external_db_name, $external_display_db_name) =
00133     rearrange(['HSTART','HEND','HSTRAND','PERCENT_ID','SCORE','SPECIES',
00134                'HSPECIES', 'P_VALUE', 'HSEQNAME', 'FEATURE1','FEATURE2',
00135                'COVERAGE', 'HCOVERAGE', 'GROUP_ID','LEVEL_ID', 'EXTERNAL_DB_ID', 'EXTRA_DATA', 'DBNAME', 'DB_DISPLAY_NAME'], @_);
00136 
00137   if(defined($hstart) && defined($hend) && ($hend < $hstart)) {
00138     throw('HSTART must be less than or equal to HEND');
00139   }
00140 
00141   if(defined($hstrand) && $hstrand != 1 && $hstrand != -1 && $hstrand != 0) {
00142     throw('HSTRAND must be one of (0,1,-1)');
00143   }
00144 
00145   $self->{'hstart'}     = $hstart;
00146   $self->{'hend'}       = $hend;
00147   $self->{'hstrand'}    = $hstrand;
00148   $self->{'score'}      = $score;
00149   $self->{'percent_id'} = $percent_id;
00150   $self->{'species'}    = $species;
00151   $self->{'hspecies'}   = $hspecies;
00152   $self->{'hseqname'}   = $hseqname;
00153   $self->{'coverage'}   = $coverage;
00154   $self->{'hcoverage'}  = $hcoverage;
00155   $self->{'p_value'}    = $p_value;
00156   $self->{'group_id'}   = $group_id;
00157   $self->{'level_id'}   = $level_id;
00158   $self->{'external_db_id'} = $external_db_id;
00159   $self->{'extra_data'} = $extra_data;
00160   $self->{'dbname'} = $external_db_name;
00161   $self->{'db_display_name'} = $external_display_db_name;
00162 
00163   #
00164   # Feature1 and Feature2 arg handling for backwards compatibility
00165   #
00166   if($f1) {
00167     deprecate("Using FEATURE1 arg to construct FeaturePairs" .
00168               " is deprecated.\nUse the args START,END,STRAND,SLICE instead");
00169 
00170     #eval because we are not exactly sure what f1 arg will look like
00171     eval {
00172       $self->{'start'} = $f1->start();
00173       $self->{'end'}   = $f1->end();
00174       $self->{'strand'} = $f1->strand();
00175       $self->{'slice'}  = $f1->contig();
00176       $self->{'analysis'} = $f1->analysis() if($f1->analysis());
00177     };
00178   }
00179 
00180   if($f2) {
00181     deprecate("Using FEATURE2 arg to construct FeaturePairs is deprecated" .
00182               "\nUse the args HSTART,HEND,HSTRAND,HSEQNAME instead");
00183 
00184     #eval because we are not exactly sure what f2 arg will look like
00185     eval {
00186       $self->{'hseqname'} = $f2->seqname();
00187       $self->{'hstart'}   = $f2->start();
00188       $self->{'hend'}     = $f2->end();
00189       $self->{'hstrand'}  = $f2->strand();
00190       $self->{'analysis'} = $f2->analysis() if($f2->analysis());
00191     };
00192   }
00193 
00194   return $self;
00195 }
00196 
00197 
00198 
00199 =head2 hseqname
00200 
00201   Arg [1]    : string $hseqname (optional)
00202   Example    : $hseqname = $fp->hseqname();
00203   Description: Getter/Setter for the name of the hit sequence
00204   Returntype : string
00205   Exceptions : none
00206   Caller     : general
00207   Status     : Stable
00208 
00209 =cut
00210 
00211 sub hseqname {
00212   my $self = shift;
00213   $self->{'hseqname'} = shift if(@_);
00214   return $self->{hseqname};
00215 }
00216 
00217 
00218 
00219 =head2 hstart
00220 
00221   Arg [1]    : string $hstart (optional)
00222   Example    : $hstart = $fp->hstart();
00223   Description: Getter/Setter for the start coordinate on the hit sequence
00224   Returntype : int
00225   Exceptions : none
00226   Caller     : general
00227   Status     : Stable
00228 
00229 =cut
00230 
00231 sub hstart{
00232   my $self = shift;
00233   $self->{'hstart'} = shift if(@_);
00234   return $self->{'hstart'};
00235 }
00236 
00237 
00238 =head2 hend
00239 
00240   Arg [1]    : string $hend (optional)
00241   Example    : $hend = $fp->hend();
00242   Description: Getter/Setter for the end coordinate on the hit sequence
00243   Returntype : int
00244   Exceptions : none
00245   Caller     : general
00246   Status     : Stable
00247 
00248 =cut
00249 
00250 sub hend{
00251   my $self = shift;
00252   $self->{'hend'} = shift if(@_);
00253   return $self->{'hend'};
00254 }
00255 
00256 
00257 
00258 =head2 hstrand
00259 
00260   Arg [1]    : int $hstrand (optional)
00261   Example    : $hstrand = $fp->hstrand
00262   Description: Getter/Setter for the orientation of the hit on the hit sequence
00263   Returntype : 0,1,-1
00264   Exceptions : thrown 
00265   Caller     : general
00266   Status     : Stable
00267 
00268 =cut
00269 
00270 sub hstrand{
00271   my $self = shift;
00272 
00273   if(@_) {
00274     my $hstrand = shift;
00275     if(defined($hstrand) && $hstrand != 1 && $hstrand != 0 && $hstrand != -1) {
00276       throw('hstrand must be one of (-1,0,1)');
00277     }
00278     $self->{'hstrand'} = $hstrand;
00279   }
00280 
00281   return $self->{'hstrand'};
00282 }
00283 
00284 =head2 hslice
00285 
00286   Arg [1]    : (optional) Bio::EnsEMBL::Slice $slice
00287   Example    : $hseqname = $featurepair->hslice()->seq_region_name();
00288   Description: Getter/Setter for the Slice that is associated with this 
00289                hit feature.  The slice represents the underlying sequence that this
00290                feature is on.  Note that this method call is analagous to the
00291                old SeqFeature methods contig(), entire_seq(), attach_seq(),
00292                etc.
00293   Returntype : Bio::EnsEMBL::Slice
00294   Exceptions : thrown if an invalid argument is passed
00295   Caller     : general
00296   Status     : Stable
00297 
00298 =cut
00299 
00300 sub hslice {
00301   my $self = shift;
00302 
00303   if(@_) {
00304     my $sl = shift;
00305     if(defined($sl) && (!ref($sl) || !($sl->isa('Bio::EnsEMBL::Slice') ) )) {
00306       throw('slice argument must be a Bio::EnsEMBL::Slice');
00307     }
00308 
00309     $self->{'hslice'} = $sl;
00310   }
00311 
00312   return $self->{'hslice'};
00313 }
00314 
00315 =head2 hseq_region_name
00316 
00317   Arg [1]    : none
00318   Example    : print $feature->hseq_region_name();
00319   Description: Gets the name of the hseq_region which this feature is on.
00320                Returns undef if this Feature is not on a hslice.
00321   Returntype : string or undef
00322   Exceptions : none
00323   Caller     : general
00324   Status     : Stable
00325 
00326 =cut
00327 
00328 sub hseq_region_name {
00329   my $self = shift;
00330   my $slice = $self->{'hslice'};
00331 
00332   return ($slice) ? $slice->seq_region_name() : undef;
00333 }
00334 
00335 
00336 =head2 hseq_region_strand
00337 
00338   Arg [1]    : none
00339   Example    : print $feature->hseq_region_strand();
00340   Description: Returns the strand of the hseq_region which this feature is on 
00341                (i.e. feature_strand * slice_strand)
00342                Returns undef if this Feature is not on a hslice.
00343   Returntype : 1,0,-1 or undef
00344   Exceptions : none
00345   Caller     : general
00346   Status     : Stable
00347 
00348 =cut
00349 
00350 
00351 sub hseq_region_strand {
00352   my $self = shift;
00353   my $slice = $self->{'hslice'};
00354 
00355   return ($slice) ? $slice->strand() * $self->{'hstrand'} : undef;
00356 }
00357 
00358 =head2 hseq_region_start
00359 
00360   Arg [1]    : none
00361   Example    : print $feature->hseq_region_start();
00362   Description: Convenience method which returns the absolute start of this
00363                feature on the hseq_region, as opposed to the relative (hslice) 
00364                position.
00365 
00366                Returns undef if this feature is not on a hslice.
00367   Returntype : int or undef
00368   Exceptions : none
00369   Caller     : general
00370   Status     : Stable
00371 
00372 =cut
00373 
00374 sub hseq_region_start {
00375   my $self = shift;
00376   my $slice = $self->{'hslice'};
00377 
00378   return undef if(!$slice);
00379 
00380   if($slice->strand == 1) {
00381     return undef if(!defined($self->{'hstart'}));
00382     return $slice->start() + $self->{'hstart'} - 1;
00383   } else {
00384     return undef if(!defined($self->{'hend'}));
00385     return $slice->end() - $self->{'hend'} + 1;
00386   }
00387 }
00388 
00389 
00390 =head2 hseq_region_end
00391 
00392   Arg [1]    : none
00393   Example    : print $feature->hseq_region_end();
00394   Description: Convenience method which returns the absolute end of this
00395                feature on the hseq_region, as opposed to the relative (hslice)
00396                position.
00397 
00398                Returns undef if this feature is not on a hslice.
00399   Returntype : int or undef
00400   Exceptions : none
00401   Caller     : general
00402   Status     : Stable
00403 
00404 =cut
00405 
00406 sub hseq_region_end {
00407   my $self = shift;
00408   my $slice = $self->{'hslice'};
00409 
00410   return undef if(!$slice);
00411 
00412   if($slice->strand == 1) {
00413     return undef if(!defined($self->{'hend'}));
00414     return $slice->start() + $self->{'hend'} - 1;
00415   } else {
00416     return undef if(!defined($self->{'hstart'}));
00417     return $slice->end() - $self->{'hstart'} + 1;
00418   }
00419 }
00420 
00421 =head2 score
00422 
00423   Arg [1]    : float $score (optional)
00424   Example    : $score = $fp->score();
00425   Description: Getter/Setter for the score of this feature pair
00426   Returntype : float
00427   Exceptions : none
00428   Caller     : general
00429   Status     : Stable
00430 
00431 =cut
00432 
00433 sub score{
00434   my $self = shift;
00435   $self->{'score'} = shift if(@_);
00436   return $self->{'score'};
00437 }
00438 
00439 
00440 
00441 =head2 percent_id
00442 
00443   Arg [1]    : float $percent_id (optional)
00444   Example    : $percent_id = $fp->percent_id();
00445   Description: Getter/Setter for the percentage identity of this feature pair
00446   Returntype : float
00447   Exceptions : none
00448   Caller     : general
00449   Status     : Stable
00450 
00451 =cut
00452 
00453 sub percent_id {
00454   my $self = shift;
00455   $self->{'percent_id'} = shift if(@_);
00456   return $self->{'percent_id'};
00457 }
00458 
00459 
00460 
00461 =head2 species
00462 
00463  Arg [1]    : string $genus_species_name (optional)
00464               e.g. Homo_sapiens or Mus_musculus
00465  Example    : $species = $fp->species();
00466  Description: get/set on the species of feature1
00467  Returntype : string
00468  Execeptions: none
00469  Caller     : general
00470  Status     : Stable
00471 
00472 =cut
00473 
00474 sub species{
00475   my $self = shift;
00476   $self->{'species'} = shift if(@_);
00477   return $self->{'species'};
00478 }
00479 
00480 
00481 =head2 hspecies
00482 
00483  Arg [1]    : string $genus_species_name (optional)
00484               e.g. Homo_sapiens or Mus_musculus
00485  Example    : $hspecies = $fp->hspecies
00486  Description: get/set on the species of feature2
00487  Returntype : string
00488  Execeptions: none
00489  Caller     : general
00490  Status     : Stable
00491 
00492 =cut
00493 
00494 sub hspecies{
00495   my $self = shift;
00496   $self->{'hspecies'} = shift if(@_);
00497   return $self->{'hspecies'};
00498 }
00499 
00500 
00501 =head2 coverage
00502 
00503   Arg [1]    : number (percentage) $coverage (optional)
00504   Example    : $cov = $fp->coverage();
00505   Description: Getter/Setter for the % of the query covered by the feature
00506   Returntype : string
00507   Exceptions : none
00508   Caller     : general
00509   Status     : Stable
00510 
00511 =cut
00512 
00513 sub coverage {
00514   my $self = shift;
00515   $self->{'coverage'} = shift if(@_);
00516   return $self->{'coverage'};
00517 }
00518 
00519 
00520 =head2 hcoverage
00521 
00522   Arg [1]    : number (percentage) $hcoverage (optional)
00523   Example    : $hcov = $fp->hcoverage();
00524   Description: Getter/Setter for the % of the target covered by the feature
00525   Returntype : string
00526   Exceptions : none
00527   Caller     : general
00528   Status     : Stable
00529 
00530 =cut
00531 
00532 sub hcoverage {
00533   my $self = shift;
00534   $self->{'hcoverage'} = shift if(@_);
00535   return $self->{'hcoverage'};
00536 }
00537 
00538 =head2 external_db_id
00539 
00540   Arg [1]    : int  $external_db_id (optional)
00541   Example    : $ex_db = $fp->external_db_id();
00542   Description: Getter/Setter for the external_db_id taregt source database feature
00543   Returntype : string
00544   Exceptions : none
00545   Caller     : general
00546   Status     : At Risk
00547 
00548 =cut
00549 
00550 sub external_db_id {
00551   my $self = shift;
00552   $self->{'external_db_id'} = shift if(@_);
00553   return $self->{'external_db_id'};
00554 }
00555 
00556 
00557 =head2 db_name
00558 
00559   Arg [1]    : string  $external_db_name (optional)
00560   Example    : $ex_db_name = $fp->dbname();
00561   Description: Getter/Setter for the external_db_name attribute, name of external database
00562   Returntype : string
00563   Exceptions : none
00564   Caller     : general
00565   Status     : At Risk
00566 
00567 =cut
00568 
00569 sub db_name {
00570   my $self = shift;
00571   $self->{'dbname'} = shift if(@_);
00572   return $self->{'dbname'};
00573 }
00574 
00575 =head2 db_display_name
00576 
00577   Arg [1]    : string  $db_display_name (optional)
00578   Example    : $ex_db_display_name = $fp->db_display_name();
00579   Description: Getter/Setter for the db_display_name attribute 
00580                The preferred display name for the external database. 
00581   Returntype : string
00582   Exceptions : none
00583   Caller     : general
00584   Status     : At Risk
00585 
00586 =cut
00587 
00588 sub db_display_name {
00589   my $self = shift;
00590   $self->{'db_display_name'} = shift if(@_);
00591   return $self->{'db_display_name'};
00592 }
00593 
00594 
00595 
00596 =head2 p_value
00597 
00598   Arg [1]    : float $p_value (optional)
00599   Example    : $eval = $fp->p_value
00600   Description: Getter Setter for the evalue / pvalue of this feature
00601   Returntype : float
00602   Exceptions : none
00603   Caller     : general
00604   Status     : Stable
00605 
00606 =cut
00607 
00608 sub p_value{
00609   my $self = shift;
00610   $self->{'p_value'} = shift if(@_);
00611   return $self->{'p_value'};
00612 }
00613 
00614 
00615 
00616 =head2 display_id
00617 
00618   Arg [1]    : none
00619   Example    : print $fp->display_id();
00620   Description: This method returns a string that is considered to be
00621                the 'display' identifier.  For feature pairs this is the 
00622                hseqname if it is available otherwise it is an empty string.
00623   Returntype : string
00624   Exceptions : none
00625   Caller     : web drawing code
00626   Status     : Stable
00627 
00628 =cut
00629 
00630 sub display_id {
00631   my $self = shift;
00632   return $self->{'hseqname'} || '';
00633 }
00634 
00635 
00636 =head2 identical_matches
00637 
00638  Arg [1]    : int $identical_matches (optional)
00639  Example    : 
00640  Description: get/set on the number of identical matches
00641  Returntype : int
00642  Execeptions: none
00643  Caller     : general
00644   Status     : Stable
00645 
00646 =cut
00647 
00648 sub identical_matches{
00649     my ($self,$arg) = @_;
00650 
00651     if (defined($arg)) {
00652         return $self->{'_identical_matches'} = $arg;
00653     } 
00654     return $self->{'_identical_matches'};
00655 }
00656 
00657 =head2 positive_matches
00658 
00659  Arg [1]    : int $positive_matches (optional)
00660  Example    : 
00661  Description: get/set on the number of positive matches
00662  Returntype : int
00663  Execeptions: none
00664  Caller     : general
00665   Status     : Stable
00666 
00667 =cut
00668 
00669 sub positive_matches{
00670     my ($self,$arg) = @_;
00671 
00672     if (defined($arg)) {
00673         return $self->{'_positive_matches'} = $arg;
00674     } 
00675     return $self->{'_positive_matches'};
00676 }
00677 
00678 =head2 group_id
00679  
00680   Arg [1]    : int $group_id
00681   Example    : none
00682   Description: get/set for attribute group_id
00683   Returntype : int
00684   Exceptions : none
00685   Caller     : general
00686   Status     : Stable
00687  
00688 =cut
00689 
00690 sub group_id {
00691    my ($self, $arg) = @_;
00692  
00693    if ( defined $arg ) {
00694       $self->{'group_id'} = $arg ;
00695    }
00696    return $self->{'group_id'};
00697 }
00698 
00699 =head2 level_id
00700  
00701   Arg [1]    : int $level_id
00702   Example    : none
00703   Description: get/set for attribute level_id
00704   Returntype : int
00705   Exceptions : none
00706   Caller     : general
00707   Status     : Stable
00708  
00709 =cut
00710 
00711 sub level_id {
00712    my ($self, $arg) = @_;
00713  
00714    if ( defined $arg ) {
00715       $self->{'level_id'} = $arg ;
00716    }
00717    return $self->{'level_id'};
00718 }
00719 
00720 
00721 
00722 
00723 
00724 
00725 =head1 DEPRECATED METHODS
00726 
00727 =cut
00728 
00729 
00730 =head2 feature1
00731 
00732   Description: DEPRECATED use start(), end(), strand(), slice(), etc.
00733                methods instead
00734 
00735 =cut
00736 
00737 sub feature1 {
00738   my ($self,$arg) = @_;
00739 
00740   deprecate('Use start(), end(), strand(), slice(), etc. methods instead.');
00741 
00742   if($arg) {
00743     $self->start($arg->start());
00744     $self->end($arg->end());
00745     $self->strand($arg->strand());
00746     $self->score($arg->score());
00747     $self->percent_id($arg->percent_id());
00748     $self->analysis($arg->analysis);
00749     if($arg->contig){
00750       $self->slice($arg->contig);
00751     }
00752   }
00753 
00754   return $self;
00755 }
00756 
00757 =head2 feature2
00758 
00759   Description: DEPRECATED use hstart(), hend(), hstrand() etc.
00760                methods instead
00761 
00762 =cut
00763 
00764 sub feature2 {
00765   my ($self,$arg) = @_;
00766 
00767   deprecate('Use hstart(),hend(),hstrand(),hseqname() methods instead.');
00768 
00769   if (defined($arg)) {
00770     $self->hstart($arg->start());
00771     $self->hend($arg->end());
00772     $self->hstrand($arg->strand());
00773     $self->hseqname($arg->seqname());
00774     return $arg;
00775   }
00776 
00777   return new Bio::EnsEMBL::Feature(
00778             -START      => $self->hstart(),
00779             -END        => $self->hend(),
00780         -STRAND     => $self->hstrand(),
00781             -SCORE      => $self->score(),
00782             -PERCENT_ID => $self->percent_id(),
00783             -ANALYSIS   => $self->analysis,
00784         -SEQNAME    => $self->hseqname());
00785 }
00786 
00787 
00788 
00789 
00790 =head2 invert
00791 
00792   Arg [1]    : (optional) Bio::EnsEMBL::Slice $newslice
00793   Example    : $feature->invert();
00794   Description: This method is used to swap the hit and query sides of this
00795                feature in place.  A new slice may optionally provided which
00796                this feature will be placed on.  If no slice is provided the
00797                feature slice will be set to undef.
00798   Returntype : none
00799   Exceptions : none
00800   Caller     : pipeline (BlastMiniGenewise)
00801 
00802 =cut
00803 
00804 sub invert {
00805     my ($self,$slice) = @_;
00806 
00807     if (! defined $slice && defined $self->hslice) {
00808       $slice = $self->hslice;
00809     }
00810 
00811     my $hstart   = $self->{'hstart'};
00812     my $hend     = $self->{'hend'};
00813     my $hstrand  = $self->{'hstrand'};
00814     my $hspecies = $self->{'hspecies'};
00815     my $hseqname = $self->{'hseqname'};
00816 
00817     my $start   = $self->{'start'};
00818     my $end     = $self->{'end'};
00819     my $strand  = $self->{'strand'};
00820     my $species = $self->{'species'};
00821     my $seqname = $self->seqname();
00822 
00823     $self->{'start'} = $hstart;
00824     $self->{'end'}   = $hend;
00825     $self->{'strand'} = $hstrand;
00826     $self->{'species'} = $hspecies;
00827     $self->{'seqname'} = $hseqname if(defined($hseqname));
00828 
00829     $self->{'hstart'}   = $start;
00830     $self->{'hend'}     = $end;
00831     $self->{'hstrand'}  = $strand;
00832     $self->{'hseqname'} = $seqname;
00833     $self->{'hspecies'} = $species;
00834 
00835     $self->{'hslice'} = $self->slice;
00836     $self->{'slice'} = $slice;
00837 }
00838 
00839 
00840 
00841 =head2 validate
00842 
00843   Description: DEPRECATED do not use
00844 
00845 =cut
00846 
00847 sub validate {
00848   my ($self) = @_;
00849 
00850   deprecate('This method does nothing and should not be used.');
00851 }
00852 
00853 =head2 validate_prot_feature
00854 
00855   Description: DEPRECATED do not use
00856 
00857 =cut
00858 
00859 sub validate_prot_feature{
00860   my ($self) = @_;
00861 
00862   deprecate('This method does nothing and should not be used.');
00863 }
00864 
00865 
00866 =head2 set_featurepair_fields
00867 
00868   Description: DEPRECATED do not use
00869 
00870 =cut
00871 
00872 sub set_featurepair_fields {
00873    my ($self, $start, $end, $strand, $score, $seqname, $hstart, $hend,
00874         $hstrand, $hseqname, $analysis, $e_value, $perc_id, 
00875         $phase, $end_phase) = @_;
00876 
00877    deprecate("Use individual Getter/Setters or Constructor arguments " .
00878              " instead.\nThere is no advantage to using this method.");
00879 
00880    throw('interface fault') if (@_ < 12 or @_ > 15);
00881 
00882    $self->start($start);
00883    $self->end($end);
00884    $self->strand($strand);
00885    $self->score($score);
00886    $self->seqname($seqname);
00887    $self->hstart($hstart);
00888    $self->hend($hend);
00889    $self->hstrand($hstrand);
00890    $self->hseqname($hseqname);
00891    $self->analysis($analysis);
00892    $self->p_value    ($e_value)   if (defined $e_value);
00893    $self->percent_id ($perc_id)   if (defined $perc_id);
00894    $self->phase      ($phase)     if (defined $phase);
00895    $self->end_phase  ($end_phase) if (defined $end_phase);
00896 }
00897 
00898 
00899 =head2 gffstring
00900 
00901   Description: DEPRECATED do not use
00902 
00903 =cut
00904 
00905 sub gffstring {
00906     my ($self) = @_;
00907 
00908     deprecate('Do not use');
00909 
00910     my $str .= (defined $self->slice) ?  $self->slice->name()."\t":  "\t";
00911     $str .=  "\t"; #source tag
00912     $str .=  "\t"; #primary tag
00913     $str .= (defined $self->start)    ?  $self->start."\t"        :  "\t";
00914     $str .= (defined $self->end)      ?  $self->end."\t"          :  "\t";
00915     $str .= (defined $self->score)    ?  $self->score."\t"        :  "\t";
00916     $str .= (defined $self->strand)   ?  $self->strand."\t"       :  ".\t";
00917     $str .=  ".\t"; #phase
00918     $str .=  ".\t"; #end phase
00919 
00920     my $hstrand = "+";
00921 
00922     if (($self->hstrand)&&($self->hstrand == -1)) {
00923       $hstrand = "-";
00924     }
00925 
00926     #Append a few FeaturePair specific things
00927     $str .= (defined $self->hseqname)   ?   $self->hseqname."\t"    :  "\t";
00928     $str .= (defined $self->hstart)     ?   $self->hstart."\t"      :  "\t";
00929     $str .= (defined $self->hend)       ?   $self->hend."\t"        :  "\t";
00930     $str .= (defined $self->hstrand)    ?   $hstrand."\t"           :  "\t";
00931     $str .= (defined $self->hphase)     ?   $self->hphase."\t"      :  ".\t";
00932 
00933     return $str;
00934 }
00935 
00936 
00937 
00938 
00939 =head2 hphase
00940 
00941   Description: DEPRECATED do not use
00942 
00943 =cut
00944 
00945 sub hphase {
00946   my ($self, $value) = @_;
00947 
00948   deprecate('This method does nothing useful.');
00949 
00950   if (defined($value)) {
00951     $self->{_hphase} = $value;
00952   }
00953 
00954   return $self->{_hphase};
00955 }
00956 
00957 
00958 =head2 hend_phase
00959 
00960   Description: DEPRECATED do not use
00961 
00962 =cut
00963 
00964 sub hend_phase {
00965   my ($self, $value) = @_;
00966 
00967   deprecate('This method does nothing useful.');
00968 
00969   if (defined($value)) {
00970     $self->{_hend_phase} = $value;
00971   }
00972   return $self->{_hend_phase};
00973 }
00974 
00975 sub extra_data {
00976   my $self = shift;
00977   $self->{'extra_data'} = shift if(@_);
00978   return $self->{'extra_data'};
00979 }
00980 
00981 sub type {
00982   my $self = shift;
00983   $self->{'extra_data'}->{'type'} = shift if(@_);
00984   if (exists $self->{'extra_data'}) {
00985       return $self->{'extra_data'}->{'type'};
00986   }
00987   return;
00988 }
00989 
00990 1;