diff --git a/modules/Bio/EnsEMBL/Feature.pm b/modules/Bio/EnsEMBL/Feature.pm index fe286a8fbabf3dcc97bf35c211c63296258a0fc2..50db11278f8bcf63cb7976a4078cb012964f927a 100644 --- a/modules/Bio/EnsEMBL/Feature.pm +++ b/modules/Bio/EnsEMBL/Feature.pm @@ -386,12 +386,16 @@ sub transform { throw('Feature is not associated with a slice and may not be transformed'); } - #use db from slice since this feature may not yet be stored in a database my $db = $slice->adaptor->db(); my $cs = $db->get_CoordSystemAdaptor->fetch_by_name($cs_name, $cs_version); my $current_cs = $slice->coord_system(); + if(!$cs) { + throw("Cannot transform to unknown coordinate system " . + "[$cs_name $cs_version]\n"); + } + # if feature is already in the requested coordinate system, we can just # return a copy if( $cs->equals( $current_cs ) && $slice->start() == 1 && diff --git a/modules/Bio/EnsEMBL/Slice.pm b/modules/Bio/EnsEMBL/Slice.pm index b1115e00e1ac977e9d8a2674a37f037bcc720d0d..f9c70cda5dd6e36d947e7b62f7ec0caf8eb1adf0 100644 --- a/modules/Bio/EnsEMBL/Slice.pm +++ b/modules/Bio/EnsEMBL/Slice.pm @@ -606,6 +606,11 @@ sub project { my $cs = $csa->fetch_by_name($cs_name, $cs_version); my $slice_cs = $self->coord_system(); + if(!$cs) { + throw("Cannot project to unknown coordinate system " . + "[$cs_name $cs_version]"); + } + #no mapping is needed if the requested coord system is the one we are in #but we do need to check if some of the slice is outside of defined regions if($slice_cs->equals($cs)) {