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
-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
# 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];
}