Bio::EnsEMBL MappedSlice
SummaryPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::MappedSlice - an object representing a mapped slice
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::Mapper
Bio::EnsEMBL::Utils::Argument qw ( rearrange )
Bio::EnsEMBL::Utils::Exception qw ( throw warning )
Scalar::Util qw ( weaken )
Synopsis
  # get a reference slice
my $slice =
$slice_adaptor->fetch_by_region( 'chromosome', 14, 900000, 950000 );
# create MappedSliceContainer based on the reference slice my $msc = Bio::EnsEMBL::MappedSliceContainer->new( -SLICE => $slice ); # set the adaptor for fetching AssemblySlices my $asa = $slice->adaptor->db->get_AssemblySliceAdaptor; $msc->set_AssemblySliceAdaptor($asa); # add an AssemblySlice to your MappedSliceContainer $msc->attach_AssemblySlice('NCBIM36'); foreach my $mapped_slice ( @{ $msc->get_all_MappedSlices } ) { print $mapped_slice->name, "\n"; foreach my $sf ( @{ $mapped_slice->get_all_SimpleFeatures } ) { print " ", &to_string($sf), "\n"; } }
Description
NOTE: this code is under development and not fully functional nor tested
yet. Use only for development.
This object represents a mapped slice, i.e. a slice that's attached
to a reference slice and a mapper to convert coordinates to/from the
reference. The attachment is done via a MappedSliceContainer which
has the reference slice and the "container slice" defining the common
coordinate system for all MappedSlices.
A MappedSlice is supposed to behave as close to a Bio::EnsEMBL::Slice
as possible. Most Slice methods are implemented in MappedSlice and will
return an equivalent value to what Slice does. There are some exceptions
of unimplemented methods, either because there is no useful equivalent
for a MappedSlice to do, or they are too complicated.
Not supported Bio::EnsEMBL::Slice methods:
  All deprecated methods
All Bio::PrimarySeqI compliance methods
expand
get_generic_features
get_seq_region_id
seq_region_Slice
Not currently supported but maybe should/could:
  calculate_pi
calculate_theta
get_base_count
get_by_Individual
get_by_strain
invert
Internally, a MappedSlice is a collection of Bio::EnsEMBL::Slices and
associated Bio::EnsEMBL::Mappers which map the slices to the common
container coordinate system.
MappedSlices are usually created and attached to a MappedSliceContainer
by an adaptor/factory.
Methods
AUTOLOADDescriptionCode
adaptorDescriptionCode
add_Slice_Mapper_pairDescriptionCode
centrepointDescriptionCode
containerDescriptionCode
coord_systemDescriptionCode
coord_system_nameDescriptionCode
endDescriptionCode
get_all_Slice_Mapper_pairsDescriptionCode
get_repeatmasked_seq
No description
Code
is_toplevelDescriptionCode
lengthDescriptionCode
nameDescriptionCode
newDescriptionCode
project
No description
Code
seq
No description
Code
seq_region_lengthDescriptionCode
seq_region_nameDescriptionCode
startDescriptionCode
strandDescriptionCode
sub_MappedSlice
No description
Code
subseq
No description
Code
Methods description
AUTOLOADcode    nextTop
  Arg[1..N]   : Arguments passed on to the calls on the underlying slices.
Example : my @simple_features = @{ $mapped_slice->get_all_SimpleFeatures };
Description : Aggregate data gathered from composing Slices.
This will call Slice->get_all_* and combine the results.
Coordinates will be transformed to be on the container slice
coordinate system.
Calls involving DAS features are skipped since the DAS adaptor handles coordinate conversions natively. Return type : listref of features (same type as corresponding Slice method) Exceptions : none Caller : general Status : At Risk : under development
adaptorcodeprevnextTop
  Arg[1]      : (optional) Adaptor $adaptor - the adaptor/factory for this
object
Example : $mapped_slice->adaptor($assembly_slice_adaptor);
Description : Getter/setter for the adaptor/factory for this object.
Return type : Adaptor of appropriate type
Exceptions : none
Caller : general
Status : At Risk
: under development
add_Slice_Mapper_pair codeprevnextTop
  Arg[1]      : Bio::EnsEMBL::Slice $slice - slice to add
Arg[2] : Bio::EnsEMBL::Mapper $mapper - the mapper for this slice
Example : $mapped_slice->add_Slice_Mapper_pair($slice, $mapper);
Description : Adds a native slice and a corresponding mapper to map to/from
the artificial container coord system.
Return type : listref of Bio::EnsEMBL::MappedSlice
Exceptions : thrown on wrong or missing arguments
Caller : general, MappedSlice adaptors
Status : At Risk
: under development
centrepointcodeprevnextTop
  Example     : my $centrepoint = $mapped_slice->centrepoint;
Description : Returns the centrepoint of the container slice.
Return type : Int
Exceptions : none
Caller : general
Status : At Risk
: under development
containercodeprevnextTop
  Arg[1]      : (optional) Bio::EnsEMBL::MappedSliceContainer - the container
this object is attached to
Example : my $container = $mapped_slice->container;
print $container->ref_slice->name, "\n";
Description : Getter/setter for the container this object is attached to. The
container will give you access to the reference slice, a common
artificial container slice, and a mapper to map to it from the
container coord system.
The implementation uses a weak reference to attach the container since the container holds a list of MappedSlices itself. Return type : Bio::EnsEMBL::MappedSliceContainer Exceptions : none Caller : general Status : At Risk : under development
coord_systemcodeprevnextTop
  Example     : my $cs = $mapped_slice->coord_system;
Description : Returns the coord system of the container slice.
Return type : Bio::EnsEMBL::CoordSystem
Exceptions : none
Caller : general
Status : At Risk
: under development
coord_system_namecodeprevnextTop
  Example     : my $cs_name = $mapped_slice->coord_system_name;
Description : Returns the coord system name of the container slice.
Return type : Int
Exceptions : none
Caller : general
Status : At Risk
: under development
endcodeprevnextTop
  Example     : my $end = $mapped_slice->end;
Description : Returns the end of the container slice.
Return type : Int
Exceptions : none
Caller : general
Status : At Risk
: under development
get_all_Slice_Mapper_pairs codeprevnextTop
  Example     : foreach my $pair (@{ $self->get_all_Slice_Mapper_pairs }) {
my ($slice, $mapper) = @$pair;
# get container coordinates my @coords = $mapper->map_coordinates( $slice->seq_region_name, $slice->start, $slice->end, $slice->strand, 'mapped_slice' ); # .... } Description : Gets all Slice/Mapper pairs this MappedSlice is composed of. Each slice (and features on it) can be mapped onto the artificial container coord system using the mapper. Return type : listref of listref of a Bio::EnsEMBL::Slice and Bio::EnsEMBL::Mapper pair Exceptions : none Caller : general Status : At Risk : under development
is_toplevelcodeprevnextTop
  Example     : my $toplevel_flag = $mapped_slice->is_toplevel;
Description : Returns weather the container slice is toplevel.
Return type : Int
Exceptions : none
Caller : general
Status : At Risk
: under development
lengthcodeprevnextTop
  Example     : my $length = $mapped_slice->length;
Description : Returns the length of the container slice
Return type : Int
Exceptions : none
Caller : general
Status : At Risk
: under development
namecodeprevnextTop
  Arg[1]      : String - the name of this object
Example : my $name = $mapped_slice->container->ref_slice->name .
":mapped_" . $ident_string;
$mapped_slice->name($name);
Description : Getter/setter for this object's name
Return type : String
Exceptions : none
Caller : general
Status : At Risk
: under development
newcodeprevnextTop
  Arg [ADAPTOR]   : Adaptor $adaptor - an adaptor of the appropriate type
Arg [CONTAINER] : Bio::EnsEMBL::MappedSliceContainer $container - the
container this MappedSlice is attached to
Arg [NAME] : String $name - name
Example : my $mapped_slice = Bio::EnsEMBL::MappedSlice->new(
-ADAPTOR => $adaptor,
-CONTAINER => $container,
-NAME => $name,
);
Description : Constructor. Usually you won't call this method manually, but
the MappedSlice will be constructed by an adaptor/factory.
Return type : Bio::EnsEMBL::MappedSlice
Exceptions : thrown on wrong or missing arguments
Caller : general, MappedSlice adaptors
Status : At Risk
: under development
seq_region_lengthcodeprevnextTop
  Example     : my $sr_length = $mapped_slice->seq_region_length;
Description : Returns the seq_region length of the reference slice.
Return type : Int
Exceptions : none
Caller : general
Status : At Risk
: under development
seq_region_namecodeprevnextTop
  Example     : my $sr_name = $mapped_slice->seq_region_name;
Description : Returns the seq_region name of the reference slice.
Return type : String
Exceptions : none
Caller : general
Status : At Risk
: under development
startcodeprevnextTop
  Example     : my $start = $mapped_slice->start;
Description : Returns the start of the container slice.
Return type : Int
Exceptions : none
Caller : general
Status : At Risk
: under development
strandcodeprevnextTop
  Example     : my $strand = $mapped_slice->strand;
Description : Returns the strand of the container slice.
Return type : Int
Exceptions : none
Caller : general
Status : At Risk
: under development
Methods code
AUTOLOADdescriptionprevnextTop
sub AUTOLOAD {
  my $self = shift;
  
  my $method = $AUTOLOAD;
  $method =~ s/.*:://;
  
  # AUTOLOAD should only deal with get_all_* methods
return unless ($method =~ /^get_all_/); # skip DAS methods
return if ($method =~ /DAS/); my @mapped_features = (); foreach my $pair (@{ $self->get_all_Slice_Mapper_pairs }) { my ($slice, $mapper) = @$pair; #warn $slice->name;
# call $method on each native slice composing the MappedSlice
my @features = @{ $slice->$method(@_) }; # map features onto the artificial container coordinate system
foreach my $f (@features) { my @coords = $mapper->map_coordinates( $f->slice->seq_region_name, $f->start, $f->end, $f->strand, 'mapped_slice' ); # sanity check
if (scalar(@coords) > 1) { warning("Got more than one Coordinate returned, expected only one!\n"); } $f->start($coords[0]->start); $f->end($coords[0]->end); $f->strand($coords[0]->strand); $f->slice($self->container->container_slice); push @mapped_features, $f; } } return\@ mapped_features; } 1;
}
adaptordescriptionprevnextTop
sub adaptor {
  my $self = shift;
  $self->{'adaptor'} = shift if (@_);
  return $self->{'adaptor'};
}
add_Slice_Mapper_pairdescriptionprevnextTop
sub add_Slice_Mapper_pair {
  my $self = shift;
  my $slice = shift;
  my $mapper = shift;

  # argument check
unless ($slice and ref($slice) and $slice->isa('Bio::EnsEMBL::Slice')) { throw("You must provide a slice."); } unless ($mapper and ref($mapper) and $mapper->isa('Bio::EnsEMBL::Mapper')) { throw("You must provide a mapper."); } push @{ $self->{'slice_mapper_pairs'} }, [ $slice, $mapper ]; return $self->{'slice_mapper_pairs'};
}
centrepointdescriptionprevnextTop
sub centrepoint {
  my $self = shift;
  return $self->container->container_slice->centrepoint;
}
containerdescriptionprevnextTop
sub container {
  my $self = shift;
  weaken($self->{'container'} = shift) if (@_);
  return $self->{'container'};
}
coord_systemdescriptionprevnextTop
sub coord_system {
  my $self = shift;
  return $self->container->container_slice->coord_system;
}
coord_system_namedescriptionprevnextTop
sub coord_system_name {
  my $self = shift;
  return $self->container->container_slice->coord_system_name;
}
enddescriptionprevnextTop
sub end {
  my $self = shift;
  return $self->container->container_slice->end;
}
get_all_Slice_Mapper_pairsdescriptionprevnextTop
sub get_all_Slice_Mapper_pairs {
  my $self = shift;
  return $self->{'slice_mapper_pairs'};
}
get_repeatmasked_seqdescriptionprevnextTop
sub get_repeatmasked_seq {}
is_topleveldescriptionprevnextTop
sub is_toplevel {
  my $self = shift;
  return $self->container->container_slice->is_toplevel;
}
lengthdescriptionprevnextTop
sub length {
  my $self = shift;
  return $self->container->container_slice->length;
}
namedescriptionprevnextTop
sub name {
  my $self = shift;
  $self->{'name'} = shift if (@_);
  return $self->{'name'};
}
newdescriptionprevnextTop
sub new {
  my $caller = shift;
  my $class = ref($caller) || $caller;

  my ($adaptor, $container, $name) =
    rearrange([qw(ADAPTOR CONTAINER NAME)], @_);

  # arguement check
unless ($container and ref($container) and $container->isa('Bio::EnsEMBL::MappedSliceContainer')) { throw("Need a MappedSliceContainer."); } my $self = {}; bless ($self, $class); #
# initialise object
#
# need to weaken reference to prevent circular reference
weaken($self->{'container'} = $container); $self->{'adaptor'} = $adaptor if (defined($adaptor)); $self->{'name'} = $name if (defined($name)); $self->{'slice_mapper_pairs'} = []; return $self;
}
projectdescriptionprevnextTop
sub project {}
seqdescriptionprevnextTop
sub seq {}
seq_region_lengthdescriptionprevnextTop
sub seq_region_length {
  my $self = shift;
  return $self->container->ref_slice->seq_region_length;
}
seq_region_namedescriptionprevnextTop
sub seq_region_name {
  my $self = shift;
  return $self->container->ref_slice->seq_region_name;
}
startdescriptionprevnextTop
sub start {
  my $self = shift;
  return $self->container->container_slice->start;
}
stranddescriptionprevnextTop
sub strand {
  my $self = shift;
  return $self->container->container_slice->strand;
}
sub_MappedSlicedescriptionprevnextTop
sub sub_MappedSlice {}
subseqdescriptionprevnextTop
sub subseq {}
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>.
RELATED MODULESTop
  Bio::EnsEMBL::MappedSlice
Bio::EnsEMBL::DBSQL::AssemblySliceAdaptor
Bio::EnsEMBL::Compara::AlignSlice
Bio::EnsEMBL::Compara::AlignSlice::Slice
Bio::EnsEMBL::AlignStrainSlice
Bio::EnsEMBL::StrainSlice