Skip to content

Commit

Permalink
handle empty fre filters
Browse files Browse the repository at this point in the history
  • Loading branch information
hanars committed Aug 2, 2023
1 parent ddacdfa commit 7c7177f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hail_search/hail_search_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def _filter_by_frequency(self, frequencies):
if hemi_field:
pop_filters.append(pop_expr[hemi_field] <= freqs['hh'])

if pop_filters is not None:
if pop_filters:
pop_filter = pop_filters[0]
for pf in pop_filters[1:]:
pop_filter &= pf
Expand Down
5 changes: 5 additions & 0 deletions hail_search/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ async def test_frequency_filter(self):
omit_sample_type='SV_WES',
)

await self._assert_expected_search(
[VARIANT1, VARIANT2, MULTI_FAMILY_VARIANT, VARIANT4], frequencies={'seqr': {}, 'gnomad_genomes': {'af': None}},
omit_sample_type='SV_WES',
)

async def test_search_missing_data(self):
search_body = get_hail_search_body(sample_data=FAMILY_2_MISSING_SAMPLE_DATA)
async with self.client.request('POST', '/search', json=search_body) as resp:
Expand Down

0 comments on commit 7c7177f

Please sign in to comment.