aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2023-01-18 19:18:37 +0000
committerArun Isaac2023-01-18 19:18:37 +0000
commitbf7a51087acfb3cf6706e18c028cc7ada5cebac9 (patch)
treea70b5326139bd2c3678245cc648cddbfc788c8e9
parentfaba68fbfa096117d09d54928b1d55a2a676a60e (diff)
downloadgenenetwork3-bf7a51087acfb3cf6706e18c028cc7ada5cebac9.tar.gz
search: Ensure limits of chromosomal interval is non-negative.
* gn3/api/search.py (parse_location_field): Ensure limits of chromosomal interval is non-negative.
-rw-r--r--gn3/api/search.py2
1 files changed, 1 insertions, 1 deletions
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: