Bio::EnsEMBL::DBSQL AssemblySliceAdaptor
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::DBSQL::AssemblySliceAdaptor - adaptor/factory for MappedSlices
representing alternative assemblies
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::DBSQL::BaseAdaptor
Bio::EnsEMBL::MappedSlice
Bio::EnsEMBL::Mapper
Bio::EnsEMBL::Utils::Argument qw ( rearrange )
Bio::EnsEMBL::Utils::Exception qw ( throw warning )
Inherit
Bio::EnsEMBL::DBSQL::BaseAdaptor
Synopsis
  my $slice =
$slice_adaptor->fetch_by_region( 'chromosome', 14, 900000, 950000 );
my $msc = Bio::EnsEMBL::MappedSliceContainer->new( -SLICE => $slice ); my $asa = Bio::EnsEMBL::DBSQL::AssemblySliceAdaptor->new; my ($mapped_slice) = @{ $asa->fetch_by_version( $msc, 'NCBIM36' ) };
Description
NOTE: this code is under development and not fully functional nor tested
yet. Use only for development.
This adaptor is a factory for creating MappedSlices representing
alternative assemblies and attaching them to a MappedSliceContainer. A
mapper will be created to map between the reference slice and the common
container slice coordinate system.
Methods
fetch_by_nameDescriptionCode
fetch_by_versionDescriptionCode
newDescriptionCode
Methods description
fetch_by_namecode    nextTop
  Arg[1]      : Bio::EnsEMBL::MappedSliceContainer $container - the container
to attach MappedSlices to
Arg[2] : String $name - the assembly name to fetch
Arg[3] : (optional) String $version -- the version for the new assembly
Example : my ($mapped_slice) = @{ $msc->fetch_by_name('LRG1','1') };
Description : Creates a MappedSlice representing an alternative assembly
version of the container's reference slice.
Return type : listref of Bio::EnsEMBL::MappedSlice
Exceptions : thrown on wrong or missing arguments
Caller : general, Bio::EnsEMBL::MappedSliceContainer
Status : At Risk
: under development
fetch_by_versioncodeprevnextTop
  Arg[1]      : Bio::EnsEMBL::MappedSliceContainer $container - the container
to attach MappedSlices to
Arg[2] : String $version - the assembly version to fetch
Example : my ($mapped_slice) = @{ $msc->fetch_by_version('NCBIM36') };
Description : Creates a MappedSlice representing an alternative assembly
version of the container's reference slice.
Return type : listref of Bio::EnsEMBL::MappedSlice
Exceptions : thrown on wrong or missing arguments
Caller : general, Bio::EnsEMBL::MappedSliceContainer
Status : At Risk
: under development
newcodeprevnextTop
  Example     : my $assembly_slice_adaptor =
Bio::EnsEMBL::DBSQL::AssemblySliceAdaptor->new;
Description : Constructor.
Return type : Bio::EnsEMBL::DBSQL::AssemblySliceAdaptor
Exceptions : none
Caller : general
Status : At Risk
: under development
Methods code
fetch_by_namedescriptionprevnextTop
sub fetch_by_name {
  my $self = shift;
  my $container = shift;
  my $name = shift;
  my $version = shift; 

  # arguement check
unless ($container and ref($container) and $container->isa('Bio::EnsEMBL::MappedSliceContainer')) { throw("Need a MappedSliceContainer."); } unless ($name) { throw("Need an assembly name."); } $version ||= ''; my $slice = $container->ref_slice; # project slice onto other assembly and construct MappedSlice for result
my $mapped_slice = Bio::EnsEMBL::MappedSlice->new( -ADAPTOR => $self, -CONTAINER => $container, -NAME => $slice->name."\#mapped_$name:$version", ); foreach my $seg (@{ $slice->project($name, $version) }) { my $proj_slice = $seg->to_Slice; # create a Mapper to map to/from the mapped_slice artificial coord system
my $mapper = Bio::EnsEMBL::Mapper->new('mapped_slice', 'native_slice'); # tell the mapper how to map this segment
$mapper->add_map_coordinates( 'mapped_slice', $seg->from_start, $seg->from_end, ($slice->strand * $proj_slice->strand), $proj_slice->seq_region_name, $proj_slice->start, $proj_slice->end ); # add the Slice/Mapper pair to the MappedSlice
$mapped_slice->add_Slice_Mapper_pair($proj_slice, $mapper); } return [$mapped_slice]; } 1;
}
fetch_by_versiondescriptionprevnextTop
sub fetch_by_version {
  my $self = shift;
  my $container = shift;
  my $version = shift;

  # arguement check
unless ($container and ref($container) and $container->isa('Bio::EnsEMBL::MappedSliceContainer')) { throw("Need a MappedSliceContainer."); } unless ($version) { throw("Need an assembly version."); } my $slice = $container->ref_slice; # project slice onto other assembly and construct MappedSlice for result
my $mapped_slice = Bio::EnsEMBL::MappedSlice->new( -ADAPTOR => $self, -CONTAINER => $container, -NAME => $slice->name."\#mapped_$version", ); my $cs_name = $slice->coord_system_name; foreach my $seg (@{ $slice->project($cs_name, $version) }) { my $proj_slice = $seg->to_Slice; # create a Mapper to map to/from the mapped_slice artificial coord system
my $mapper = Bio::EnsEMBL::Mapper->new('mapped_slice', 'native_slice'); # tell the mapper how to map this segment
$mapper->add_map_coordinates( 'mapped_slice', $seg->from_start, $seg->from_end, ($slice->strand * $proj_slice->strand), $proj_slice->seq_region_name, $proj_slice->start, $proj_slice->end ); # add the Slice/Mapper pair to the MappedSlice
$mapped_slice->add_Slice_Mapper_pair($proj_slice, $mapper); } return [$mapped_slice];
}
newdescriptionprevnextTop
sub new {
  my $caller = shift;

  my $class = ref($caller) || $caller;
  my $self = $class->SUPER::new(@_);
  
  return $self;
}
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>.
REALTED MODULESTop
  Bio::EnsEMBL::MappedSlice
Bio::EnsEMBL::MappedSliceContainer
Bio::EnsEMBL::Compara::AlignSlice
Bio::EnsEMBL::Compara::AlignSlice::Slice
Bio::EnsEMBL::AlignStrainSlice
Bio::EnsEMBL::StrainSlice