From 7cf91f59f5ecf326dc0f5d0bce50f8c1d57be3f1 Mon Sep 17 00:00:00 2001 From: Andrew Yates <ayates@ebi.ac.uk> Date: Fri, 28 Sep 2012 12:54:20 +0000 Subject: [PATCH] [ENSCORESW-264] Can now handle odd sequence region names involving . - _ now. The supercontig names seemed to be a good source of these --- modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm | 2 +- modules/t/sliceAdaptor.t | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm index 8faa1c6306..5f2dc2227c 100644 --- a/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm @@ -531,7 +531,7 @@ sub parse_location_to_values { my $number_regex = qr/[0-9,_ E]+/xms; my $strand_regex = qr/[+-1]|-1/xms; - my $regex = qr/^(\w+) \s* :? \s* ($number_regex)? $separator_regex ($number_regex)? $separator_regex ($strand_regex)? $/xms; + my $regex = qr/^((?:\w|\.|_|-)+) \s* :? \s* ($number_regex)? $separator_regex ($number_regex)? $separator_regex ($strand_regex)? $/xms; my ($seq_region_name, $start, $end, $strand); if(($seq_region_name, $start, $end, $strand) = $location =~ $regex) { diff --git a/modules/t/sliceAdaptor.t b/modules/t/sliceAdaptor.t index 92d2f6ecc7..05061da103 100644 --- a/modules/t/sliceAdaptor.t +++ b/modules/t/sliceAdaptor.t @@ -482,6 +482,15 @@ dies_ok { $slice_adaptor->fetch_by_toplevel_location('1:1_000_000_000..100', 1); ok(!defined $slice_adaptor->fetch_by_toplevel_location('wibble', 1), 'Checking with a bogus region returns undef'); ok(!defined $slice_adaptor->fetch_by_toplevel_location('1:-100--50', 1), 'Checking with a bogus region with negative coords returns undef'); +{ + #Non standard name check + my ($name, $start, $end, $strand) = $slice_adaptor->parse_location_to_values('GL21446.1'); + is($name, 'GL21446.1', 'Name parses out'); + ok(!defined $start, 'Start is undefined'); + ok(!defined $end, 'End is undefined'); + ok(!defined $strand, 'Strand is undefined'); +} + sub test_toplevel_location { my ($location, $cs_name, $seq_region_name, $start, $end, $strand) = @_; $strand ||= 1; -- GitLab