Commit 3eacfbc0 authored by Arne Stabenau's avatar Arne Stabenau
Browse files

allow for undef returned as mapper from AssemblyMapperAdaptor

parent df3df556
......@@ -127,7 +127,7 @@ sub new {
$mapper = $asma->fetch_by_CoordSystems($cs1,$cs2);
$mapper = $asma->fetch_by_CoordSystems($cs2,$cs1);
Returntype : Bio::EnsEMBL::AssemblyMapper
Exceptions : none
Exceptions : wrong argument types
Caller : general
=cut
......@@ -162,9 +162,10 @@ sub fetch_by_CoordSystems {
my @mapping_path = @{$csa->get_mapping_path($cs1,$cs2)};
if(!@mapping_path) {
throw("There is no mapping defined between these coord systems:\n" .
warn("There is no mapping defined between these coord systems:\n" .
$cs1->name() . " " . $cs1->version() . " and " . $cs2->name() . " " .
$cs2->version());
return undef;
}
my $key = join(':', map({defined($_)?$_->dbID():"-"} @mapping_path));
......
......@@ -316,6 +316,8 @@ sub _slice_fetch {
} else {
$mapper = $asma->fetch_by_CoordSystems($slice_cs, $feat_cs);
next unless defined $mapper;
# Get list of coordinates and corresponding internal ids for
# regions the slice spans
@coords = $mapper->map($slice_seq_region, $slice_start, $slice_end,
......
......@@ -693,11 +693,18 @@ sub project {
my $asm_mapper = $asma->fetch_by_CoordSystems($slice_cs, $cs);
# perform the mapping between this slice and the requested system
my @coords = $asm_mapper->map($normal_slice->seq_region_name(),
$normal_slice->start(),
$normal_slice->end(),
$normal_slice->strand(),
$slice_cs);
my @coords;
if( defined $asm_mapper ) {
@coords = $asm_mapper->map($normal_slice->seq_region_name(),
$normal_slice->start(),
$normal_slice->end(),
$normal_slice->strand(),
$slice_cs);
} else {
$coords[0] = Bio::EnsEMBL::Mapper::Gap->new( $normal_slice->start(),
$normal_slice->end());
}
#construct a projection from the mapping results and return it
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment