eweitz / ideogram

Chromosome visualization for the web
https://eweitz.github.io/ideogram
Other
294 stars 71 forks source link

Further speed up and polish UI in Related Genes #244

Closed eweitz closed 4 years ago

eweitz commented 4 years ago

This improves performance and user interface in the "Related genes" kit and example.

Performance

Building on #243, which parallelized requests, these changes optimize performance through fewer requests and faster APIs.

Fewer requests

Defining content-type in a URL parameter instead of an HTTP header cuts out an extraneous preflight CORS OPTIONS request in a GET to fetch paralogs from Ensembl REST API.

Faster APIs

Replacing Ensembl REST API with MyGene.info's REST API made gene position lookups much faster.

Ensembl REST API requires using a POST to lookup/id to fetch multiple gene positions. These can be quite slow: sometimes taking 2 seconds, other times 15 seconds or more for the same parameters.

The POSTs also lack ways to omit preflight requests, because, as documented, Ensembl REST API only supports defining POST Content-Type in HTTP headers. This makes POSTs for JSON not simple requests, which means each POST to Ensembl must have an additional preceding OPTIONS request.

MyGene.info has a comparable API that is much faster. Swapping it in yields snappy lookups for gene positions, typically less than 0.5 seconds -- between 4x and 30x faster than Ensembl.

User interface

Suggested UI refinements are included:

Also, clickable gene search examples have been added below the search box, and coloring options for chrBorderColor and chrLabelColor are now available as Ideogram API options.

Screenshots

Screenshots below show these performance and UI enhancements.

Before

related_genes_before_refinement_ideogram_2020-10-12

After

related_genes_after_refinement_ideogram_2020-10-12
coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.02%) to 89.469% when pulling 9b2c995f28bb7cf6621f70f3b54fc70d63eaa2b1 on hone-related-genes into 3a1fd22e8460541297cb0fa9e0c7a786b3e1a95b on master.