diff --git a/hail_search/queries/mito.py b/hail_search/queries/mito.py index c963aaa401..d0c3830bd5 100644 --- a/hail_search/queries/mito.py +++ b/hail_search/queries/mito.py @@ -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 ] diff --git a/hail_search/test_search.py b/hail_search/test_search.py index 8964001c2f..2bc9337fbe 100644 --- a/hail_search/test_search.py +++ b/hail_search/test_search.py @@ -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()