gosling-lang / gosling.js

Grammar of Scalable Linked Interactive Nucleotide Graphics
https://gosling.js.org
MIT License
164 stars 27 forks source link

improve HiGlass packaging / types #702

Open manzt opened 2 years ago

manzt commented 2 years ago

Motivation

HiGlass is well implemented and a core dependency of Gosling. However, it is untyped and packaged as a pre-bundled UMD JavaScript file. (pre-bundled meaning all dependencies except react, react-dom and pixi.js are included in hglib.js. This has lead to workarounds and inconsistencies in this repo, which could likely be solved all together by spending some time on improving how HiGlass is packaged.

Examples

Conclusion

I'm not sure if any of this is on the Gosling roadmap, but as we continue to add features I think it's important to consider how we could improve its foundation for greater long-term stability. We have come up with a lot of ad-hoc solutions in this repo for using higlass more like a module, but many of those solutions would be eliminated and improved if we spent some time cleaning up higlass for our use case.

sehilyi commented 2 years ago

💯 agreed.

Some additional thoughts:

  1. Another related example is that we use higlass.schema.ts which was semi-automatically generated at some point based on higlass.schema.json of the HiGlass core repo. We are using this ts file for constructing compiled HiGlass viewconfigs.

  2. Regarding the duplicated codes of data fetchers between Gosling and HiGlass, I wonder if we can find a unified method, e.g., if a new data fetcher is implemented in one library (say Gosling), the other library (i.e., HiGlass) can also use the data fetcher, and vice versa. The current challenge is due to different use cases between Gosling and HiGlass. (1) Gosling primarily uses a tabular data format to use the concept of the visualization grammar while HiGlass data fetchers use varying data formats (e.g., data generated by a vcf data-fetcher is only interpretable in an sv track). (2) HiGlass data fetchers sometimes manage the render parts as well (e.g., BAM and VCF fetchers) while Gosling data fetchers do not care about rendering.