Bio::EnsEMBL IdentityXref
SummaryIncluded librariesPackage variablesSynopsisGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::IdentityXref
Package variables
Privates (from "my" definitions)
$error_shown = 0
Included modules
Bio::EnsEMBL::Utils::Argument qw ( rearrange )
Bio::EnsEMBL::Utils::Exception qw ( deprecate )
Inherit
Bio::EnsEMBL::DBEntry
Synopsis
  my $xref = Bio::EnsEMBL::IdentityXref->new(
-XREF_IDENTITY => 80.4,
-ENSEMBL_IDENTITY => 90.1,
-SCORE => 90,
-EVALUE => 12,
-CIGAR_LINE => '23MD3M2I40M',
-XREF_START => 1,
-XREF_END => 68,
-ENSEMBL_START => 10,
-ENSEMBL_END => 77,
-ADAPTOR => $adaptor,
-PRIMARY_ID => $primary_id,
-DBNAME => 'SwissProt'
);
Description
No description!
Methods
cigar_lineDescriptionCode
ensembl_endDescriptionCode
ensembl_identityDescriptionCode
ensembl_startDescriptionCode
evalueDescriptionCode
get_mapperDescriptionCode
map_featureDescriptionCode
newDescriptionCode
query_endDescriptionCode
query_identityDescriptionCode
query_startDescriptionCode
scoreDescriptionCode
target_identityDescriptionCode
transform_featureDescriptionCode
translation_endDescriptionCode
translation_startDescriptionCode
xref_endDescriptionCode
xref_identityDescriptionCode
xref_startDescriptionCode
Methods description
cigar_linecode    nextTop
  Arg [1]    : string $cigar_line
Example : none
Description: get/set for attribute cigar_line
Returntype : string
Exceptions : none
Caller : general
Status : Stable
ensembl_endcodeprevnextTop
  Arg [1]    : string $ensembl_end
Example : none
Description: get/set for attribute ensembl_end
Returntype : string
Exceptions : none
Caller : general
Status : Stable
ensembl_identitycodeprevnextTop
  Arg [1]    : (optional) string $value
Example : $ensembl_identity = $id_xref->ensembl_identity;
Description: Getter/Setter for ensembl identity
Returntype : string
Exceptions : none
Caller : general
Status : Stable
ensembl_startcodeprevnextTop
  Arg [1]    : string $ensembl_start
Example : none
Description: get/set for attribute ensembl_start
Returntype : string
Exceptions : none
Caller : general
Status : Stable
evaluecodeprevnextTop
  Arg [1]    : string $evalue
Example : none
Description: get/set for attribute evalue
Returntype : string
Exceptions : none
Caller : general
Status : Stable
get_mappercodeprevnextTop
  Args       : none
Example : none
Description: produces a mapper object that takes coordinates from one side
of the alignment to the other side. "ensembl" and "external"
are the two coordinate systems contained.
Returntype : Bio::EnsEMBL::Mapper
Exceptions : none
Caller : general, ProteinDAS subsystem
Status : Stable
map_featurecodeprevnextTop
  Arg [1]    : a start,end capable feature object
Example : none
Description:
Returntype : list of Coordinates/Gaps which represents the mapping
Exceptions : none
Caller : another way of doing ProteinDAS
Status : Stable
newcodeprevnextTop
  Arg [...]  : XREF_IDENTITY ENSEMBL_IDENTITY SCORE EVALUE CIGAR_LINE
: XREF_START XREF_END ENSEMBL_START ENSEMBL_END
: ANALYSIS pairs
Example : see synopsis
Description: Create a new Bio::EnsEMBL::IdentityXref object
Returntype : Bio::EnsEMBL::IdentityXref
Exceptions : none
Caller : general
Status : Stable
query_endcodeprevnextTop
  Description: DEPRECATED. Use xref_end() instead.
Status : At Risk
query_identitycodeprevnextTop
  Description: DEPRECATED. Use xref_identity() instead.
Status : At Risk
query_startcodeprevnextTop
  Description: DEPRECATED. Use xref_start() instead.
Status : At Risk
scorecodeprevnextTop
  Arg [1]    : string $score
Example : none
Description: get/set for attribute score
Returntype : string
Exceptions : none
Caller : general
Status : Stable
target_identitycodeprevnextTop
  Description: DEPRECATED. Use ensembl_identity() instead.
Status : At Risk
transform_featurecodeprevnextTop
  Arg [1]    : a feature type with start and end $feature
This doesnt need to be a Bio::EnsEMBL::Feature as it doesnt
need an attached slice. We may have to introduce an appropriate
object type.
Example : my $ens_prot_feature_list =
$ident_xref->transform_feature( $swiss_prot_feature );
Description: a list of potential partial features which represent all
mappable places
of the original feature in ensembl translation coordinates.
Returntype : listref of whatever was put in
Exceptions : none
Caller : general, ProteinDAS subsystem
Status : Stable
translation_endcodeprevnextTop
  Description: DEPRECATED. Use ensembl_end() instead.
Status : At Risk
translation_startcodeprevnextTop
  Description: DEPRECATED. Use ensembl_start() instead.
Status : At Risk
xref_endcodeprevnextTop
  Arg [1]    : string $xref_end
Example : none
Description: get/set for attribute xref_end
Returntype : string
Exceptions : none
Caller : general
Status : Stable
xref_identitycodeprevnextTop
  Arg [1]    : (optional) string $value
Example : $xref_identity = $id_xref->xref_identity;
Description: Getter/Setter for xref identity
Returntype : string
Exceptions : none
Caller : general
Status : Stable
xref_startcodeprevnextTop
  Arg [1]    : string $xref_start
Example : none
Description: get/set for attribute xref_start
Returntype : string
Exceptions : none
Caller : general
Status : Stable
Methods code
cigar_linedescriptionprevnextTop
sub cigar_line {
  my $self = shift;
  $self->{'cigar_line'} = shift if( @_ );
  return $self->{'cigar_line'};
}
ensembl_enddescriptionprevnextTop
sub ensembl_end {
   my $self = shift;
  $self->{'ensembl_end'} = shift if( @_ );
  return $self->{'ensembl_end'};
}
ensembl_identitydescriptionprevnextTop
sub ensembl_identity {
   my $obj = shift;
   if( @_ ) {
      my $value = shift;
      $obj->{'ensembl_identity'} = $value;
    }
    return $obj->{'ensembl_identity'};
}
ensembl_startdescriptionprevnextTop
sub ensembl_start {
   my $self = shift;
  $self->{'ensembl_start'} = shift if( @_ );
  return $self->{'ensembl_start'};
}
evaluedescriptionprevnextTop
sub evalue {
   my $self = shift;
  $self->{'evalue'} = shift if( @_ );
  return $self->{'evalue'};
}
get_mapperdescriptionprevnextTop
sub get_mapper {
  my ( $self ) = @_;
  # parse the cigar_line and create a mapper ...
if( exists $self->{'_cached_mapper'} ) { return $self->{'_cached_mapper'}; } my ( @lens, @chars ); # if there is no cigar line, nothing is going to be loaded
if( $self->cigar_line() ) { my @pre_lens = split( '[DMI]', $self->cigar_line() ); @lens = map { if( ! $_ ) { 1 } else { $_ }} @pre_lens; @chars = grep { /[DMI]/ } split( //, $self->cigar_line() ); } my $translation_start = $self->ensembl_start(); my $translation_end = $self->ensembl_end(); my $query_start = $self->xref_start(); my $query_end = $self->xref_end(); # my $hit_id = $self->display_id();
my $ensembl_id = "ensembl_id"; my $external_id = "external_id"; # now build the mapper
my $mapper = Bio::EnsEMBL::Mapper->new( "external", "ensembl" ); for( my $i=0; $i<=$#lens; $i++ ) { my $length = $lens[$i]; my $char = $chars[$i]; if( $char eq "M" ) { $mapper->add_map_coordinates( $external_id, $query_start, $query_start + $length - 1, 1, $ensembl_id, $translation_start, $translation_start + $length - 1); $query_start += $length; $translation_start += $length; } elsif( $char eq "D" ) { $translation_start += $length; } elsif( $char eq "I" ) { $query_start += $length; } } $self->{'_cached_mapper'} = $mapper; return $mapper;
}
map_featuredescriptionprevnextTop
sub map_feature {
  my $self = shift;
  my $feature = shift;


  my $fstart = $feature->start();
  my $fend = $feature->end();

  my $mapper = $self->get_mapper();
  my @coords = $mapper->map_coordinates( "external_id", $fstart, $fend, 1,
                                         "external" );

  return @coords;
}


###########################
# DEPRECATED METHODS FOLLOW
###########################
}
newdescriptionprevnextTop
sub new {
    my ($class, @args) = @_;
    my $self = $class->SUPER::new(@args);
    my ($query_identity, $target_identity, $score, $evalue, 
        $cigar_line, $query_start, $query_end, $translation_start,
        $translation_end, $analysis, $xref_identity, $ensembl_identity, 
        $xref_start, $xref_end, $ensembl_start, $ensembl_end) = rearrange(
        [qw(QUERY_IDENTITY TARGET_IDENTITY SCORE EVALUE CIGAR_LINE 
            QUERY_START QUERY_END TRANSLATION_START TRANSLATION_END
            ANALYSIS XREF_IDENTITY ENSEMBL_IDENTITY XREF_START XREF_END ENSEMBL_START ENSEMBL_END)], @args);

    if((defined($query_identity) or defined($target_identity) or defined($query_start) or defined ($query_end) or
       defined($translation_start) or defined($translation_end)) and !$error_shown){
      print STDERR "Arguments have now been changed to stop confusion so please replace the following\n";
      print STDERR "\tQUERY_IDENTITY\t->\tXREF_IDENTITY\n";
      print STDERR "\tTARGET_IDENTITY\t->\tENSEMBL_IDENTITY\n";
      print STDERR "\tQUERY_START\t->\tXREF_START\n";
      print STDERR "\tQUERY_END\t->\tXREF_END\n";
      print STDERR "\tTRANSLATION_START\t->\tENSEMBL_START\n";
      print STDERR "\tTRANSLATION_END\t->\tENSEMBL_END\n";
      print STDERR "The old arguments will be removed in a futute release so please change your code to the new names\n";
      $error_shown = 1;
    }
    $self->{'xref_identity'} = $query_identity || $xref_identity;
    $self->{'ensembl_identity'} = $target_identity || $ensembl_identity;
    $self->{'score'} = $score;
    $self->{'evalue'} = $evalue;
    $self->{'cigar_line'} = $cigar_line;
    $self->{'xref_start'} = $query_start || $xref_start;
    $self->{'xref_end'} = $query_end || $xref_start;
    $self->{'ensembl_start'} = $translation_start || $ensembl_start;
    $self->{'ensembl_end'} = $translation_end || $ensembl_end;
    $self->{'analysis'} = $analysis;

    return $self;
}
query_enddescriptionprevnextTop
sub query_end {
  deprecate("Use xref_end instead");
  xref_end(@_);

}


1;
}
query_identitydescriptionprevnextTop
sub query_identity {
  deprecate("Use xref_identity instead");
  xref_identity(@_);
}
query_startdescriptionprevnextTop
sub query_start {
  deprecate("Use xref_start instead");
  xref_start(@_);
}
scoredescriptionprevnextTop
sub score {
   my $self = shift;
  $self->{'score'} = shift if( @_ );
  return $self->{'score'};
}
target_identitydescriptionprevnextTop
sub target_identity {
  deprecate("Use ensembl_identity instead");
  ensembl_identity(@_);
}
transform_featuredescriptionprevnextTop
sub transform_feature {
  my $self= shift;
  my $feature = shift;

  my $fstart = $feature->start();
  my $fend = $feature->end();

  my $mapper = $self->get_mapper();
  my @result;

  my @coords = $mapper->map_coordinates( "external_id", $fstart, $fend, 
                                           1, "external" );

  for my $coord ( @coords ) {
    if( $coord->isa( "Bio::EnsEMBL::Mapper::Coordinate" )) {
      my $new_feature;
      %{$new_feature} = %$feature;
      bless $new_feature, ref( $feature );
      $new_feature->start( $coord->start() );
      $new_feature->end( $coord->end() );

      push( @result, $new_feature );
    }
  }

  return\@ result;
}
translation_enddescriptionprevnextTop
sub translation_end {
  deprecate("Use ensembl_end instead");
  ensembl_end(@_);
}
translation_startdescriptionprevnextTop
sub translation_start {
  deprecate("Use ensembl_start instead");
  ensembl_start(@_);
}
xref_enddescriptionprevnextTop
sub xref_end {
   my $self = shift;
  $self->{'xref_end'} = shift if( @_ );
  return $self->{'xref_end'};
}
xref_identitydescriptionprevnextTop
sub xref_identity {
   my $obj = shift;
   if( @_ ) {
       my $value = shift;
       $obj->{'xref_identity'} = $value;
   }
   return $obj->{'xref_identity'};
}
xref_startdescriptionprevnextTop
sub xref_start {
   my $self = shift;
  $self->{'xref_start'} = shift if( @_ );
  return $self->{'xref_start'};
}
General documentation
LICENSETop
  Copyright (c) 1999-2009 The European Bioinformatics Institute and
Genome Research Limited. All rights reserved.
This software is distributed under a modified Apache license. For license details, please see /info/about/code_licence.html
CONTACTTop
  Please email comments or questions to the public Ensembl
developers list at <ensembl-dev@ebi.ac.uk>.
Questions may also be sent to the Ensembl help desk at <helpdesk@ensembl.org>.