[ensembl-dev] AlignSlice::Slice question

Javier Herrero jherrero at ebi.ac.uk
Thu Apr 19 09:21:58 BST 2012

Hi Marc

Yes, please refer to the documentation for a longer explanation.

In short, the AlignSlice is a container of AlignSlice::Slices, which in 
turn are a container of Bio::EnsEMBL::Slice objects (with a 
Bio::EnsEMBL::Mapper object each). They are not real slices. They can be 
made of many smaller slices with gaps between and within them. However, 
they try to behave like genuine Slices for most of the functionality 
(with some twists).

It wouldn't make much sense to return the chromosome name as you can 
have an AlignSlice::Slice made of different slices from different 
chromosomes. For the cases where there is just one underlying slice, you 
may argue that we could return the actual chromosome name but there are 
two main reasons for not doing this:
- for the sake of consistency between AlignSlice::Slices with one 
underlying Slice and the ones with several underlying Slices
- because of the gap within that Slice, the coordinates are not the 
same. Returning a chromosome name with the wrong start and end would be 
very confusing

In order to get the chromosome names, start and end locations of the 
underlying Slices, you have to use:

my $align_slice_slices = $align_slice->get_all_Slices();
foreach my $this_as_slice (@$align_slice_slices) {
   my $underlying_slices = $this_as_slice->get_all_underlying_Slices();
   foreach my $this_slice (@$underlying_slices) {
     print $this_slice->seq_region_name, "\n";
     print $this_slice->start, "\n";
     print $this_slice->end, "\n";
     print $this_slice->strand, "\n";

Kind regards


On 19/04/12 08:36, Marc P. Hoeppner wrote:
> Hi,
> For an AlignSlice object, using using 
> AlignSlice::Slice->seq_region_name on the individual aligned regions 
> returns the species name, not the actual name of e.g. the underlying 
> chromosome. Is this behavior intended?
> /Marc
> _______________________________________________
> Dev mailing list    Dev at ensembl.org
> List admin (including subscribe/unsubscribe): 
> http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/

Javier Herrero, PhD
Ensembl Coordinator and Ensembl Compara Project Leader
European Bioinformatics Institute (EMBL-EBI)
Wellcome Trust Genome Campus, Hinxton
Cambridge - CB10 1SD - UK

More information about the Dev mailing list