Skip to content

Commit

Permalink
make gene order in search deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
hanars committed Dec 19, 2024
1 parent bfe53b7 commit 8846583
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hail_search/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@
}

LOCATION_SEARCH = {
'gene_ids': ['ENSG00000177000', 'ENSG00000097046'],
'gene_ids': ['ENSG00000097046', 'ENSG00000177000'],
'intervals': [['2', 1234, 5678], ['7', 1, 11100], ['1', 11785723, 11806455], ['1', 91500851, 91525764]],
}
EXCLUDE_LOCATION_SEARCH = {'intervals': LOCATION_SEARCH['intervals'], 'exclude_intervals': True}
Expand Down
6 changes: 3 additions & 3 deletions seqr/utils/search/hail_search_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ def _parse_location_search(search):
{field: gene[f'{field}{search["genome_version"].title()}'] for field in ['chrom', 'start', 'end']}
for gene in genes.values()
]
parsed_intervals = [_format_interval(**interval) for interval in intervals or []] + [
[gene['chrom'], gene['start'], gene['end']] for gene in gene_coords]
parsed_intervals = [_format_interval(**interval) for interval in intervals or []] + sorted([
[gene['chrom'], gene['start'], gene['end']] for gene in gene_coords])
if Sample.DATASET_TYPE_MITO_CALLS in search['sample_data'] and not exclude_locations:
chromosomes = {gene['chrom'] for gene in gene_coords + (intervals or [])}
if 'M' not in chromosomes:
Expand All @@ -202,7 +202,7 @@ def _parse_location_search(search):
search.update({
'intervals': parsed_intervals,
'exclude_intervals': exclude_locations,
'gene_ids': None if (exclude_locations or not genes) else list(genes.keys()),
'gene_ids': None if (exclude_locations or not genes) else sorted(genes.keys()),
'variant_ids': parsed_locus.get('parsed_variant_ids'),
'rs_ids': parsed_locus.get('rs_ids'),
})
Expand Down

0 comments on commit 8846583

Please sign in to comment.