Skip to content

Commit

Permalink
Merge pull request #3845 from broadinstitute/grch37-variant-search
Browse files Browse the repository at this point in the history
properly handle 37 variant ids
  • Loading branch information
hanars authored Jan 30, 2024
2 parents 8b1e49e + 54776fb commit a300f5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hail_search/queries/mito.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def _parse_variant_keys(self, variant_ids=None, **kwargs):

return [
hl.struct(
locus=hl.locus(f'chr{chrom}', pos, reference_genome=self.GENOME_VERSION),
locus=hl.locus(f'chr{chrom}' if self._should_add_chr_prefix() else chrom, pos, reference_genome=self.GENOME_VERSION),
alleles=[ref, alt],
) for chrom, pos, ref, alt in variant_ids
]
Expand Down
8 changes: 7 additions & 1 deletion hail_search/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,13 @@ async def test_variant_lookup(self):
async with self.client.request('POST', '/lookup', json=body) as resp:
self.assertEqual(resp.status, 404)

body.update({'variant_id': ['M', 4429, 'G', 'A'], 'data_type': 'MITO'})
body.update({'genome_version': 'GRCh37', 'variant_id': ['7', 143270172, 'A', 'G']})
async with self.client.request('POST', '/lookup', json=body) as resp:
self.assertEqual(resp.status, 200)
resp_json = await resp.json()
self.assertDictEqual(resp_json, {**GRCH37_VARIANT, 'familyGuids': [], 'genotypes': {}, 'genotypeFilters': ''})

body.update({'variant_id': ['M', 4429, 'G', 'A'], 'data_type': 'MITO', 'genome_version': 'GRCh38'})
async with self.client.request('POST', '/lookup', json=body) as resp:
self.assertEqual(resp.status, 200)
resp_json = await resp.json()
Expand Down

0 comments on commit a300f5b

Please sign in to comment.