Skip to content

Commit

Permalink
Merge pull request #3503 from broadinstitute/fix-sv-location-filter-bug
Browse files Browse the repository at this point in the history
Fix SV localtion interval filter bug.
  • Loading branch information
ShifaSZ authored Jul 21, 2023
2 parents d41f2d3 + 929dde6 commit 8a5f227
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion seqr/utils/search/elasticsearch/es_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,9 @@ def _location_filter(genes, intervals, exclude_locations):
}
} for key in ['xpos', 'xstop']]
interval_q = _build_or_filter('range', range_filters)
interval_q |= Q('range', xpos={'lte': xstart}) & Q('range', xstop={'gte': xstop})
interval_q |= Q('range', xpos={'lte': xstart}) & Q('range', xstop={'gte': xstop}) & \
Q('range', xpos={'gte': get_xpos(interval['chrom'], MIN_POS)}) & \
Q('range', xstop={'lte': get_xpos(interval['chrom'], MAX_POS)})

if q:
q |= interval_q
Expand Down
5 changes: 4 additions & 1 deletion seqr/utils/search/elasticsearch/es_utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,10 @@ def test_filtered_get_es_variants(self):
{'range': {'xstop': {'gte': 2000001234, 'lte': 2000005678}}},
{'bool': {'must': [
{'range': {'xpos': {'lte': 2000001234}}},
{'range': {'xstop': {'gte': 2000005678}}}]}},
{'range': {'xstop': {'gte': 2000005678}}},
{'range': {'xpos': {'gte': 2000000001}}},
{'range': {'xstop': {'lte': 2300000000}}},
]}},
{'terms': {'geneIds': ['ENSG00000223972']}},
{'bool': {'must': [
{'range': {'xpos': {'gte': 7000000001, 'lte': 7000001100}}},
Expand Down

0 comments on commit 8a5f227

Please sign in to comment.