diff options
author | Arun Isaac | 2023-01-18 19:18:37 +0000 |
---|---|---|
committer | Arun Isaac | 2023-01-18 19:18:37 +0000 |
commit | bf7a51087acfb3cf6706e18c028cc7ada5cebac9 (patch) | |
tree | a70b5326139bd2c3678245cc648cddbfc788c8e9 /gn3/api/search.py | |
parent | faba68fbfa096117d09d54928b1d55a2a676a60e (diff) | |
download | genenetwork3-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.
Diffstat (limited to 'gn3/api/search.py')
-rw-r--r-- | gn3/api/search.py | 2 |
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: |