From bf7a51087acfb3cf6706e18c028cc7ada5cebac9 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 18 Jan 2023 19:18:37 +0000 Subject: search: Ensure limits of chromosomal interval is non-negative. * gn3/api/search.py (parse_location_field): Ensure limits of chromosomal interval is non-negative. --- gn3/api/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3/api') diff --git a/gn3/api/search.py b/gn3/api/search.py index 2038a14..3846aa7 100644 --- a/gn3/api/search.py +++ b/gn3/api/search.py @@ -174,7 +174,7 @@ def parse_location_field(species_query: xapian.Query, else: width = 50*10**3 point = apply_si_suffix(location_str) - location = Just(point - width), Just(point + width) + location = Just(max(0, point - width)), Just(point + width) return ChromosomalInterval(chromosome.removeprefix("chr"), *location) def make_query(interval: ChromosomalInterval) -> xapian.Query: -- cgit v1.2.3