Skip to content
Snippets Groups Projects
Commit ac8e396b authored by Graham McVicker's avatar Graham McVicker
Browse files

throw if undefined coord systems are used for transform/project calls

parent 9d547f80
No related branches found
No related tags found
No related merge requests found
......@@ -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 &&
......
......@@ -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)) {
......
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