similar_alleles not being returned in correct order
Background
Results from workflows/similar_alleles/...
should be returned in order based on proximity to the reference allele. This is not happening, and the order of alleles listed in the REGION VARDB SNV card appears to be random. For example, in an analysis with BRCA2 c.2883G>A (all listed variants are within the same exon):
How to reproduce
# fill in vars appropriately
# jq v1.6 required for `fabs`
curl -H 'Cookie: AuthenticationToken=$token' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
"http://localhost:5000/api/v1/workflows/similar_alleles/$genepanel/$genepanel_version?allele_ids=$allele_id" \
| jq '.[] | map({"id": .id, "hgvsc": .annotation.transcripts[0].HGVSc, "start": .start_position, "end": .open_end_position, "distance": ($refAlleleMidpoint - (.start_position + .open_end_position)/2 | fabs)})'
Implementation
Fix sorting in backend python, either in the sqlalchemy statement or just before returning the API response.
Edited by Morten C. Eike