vector-engineering / covidcg

A COVID-19 CoV Genetics (CG) browser to inform therapeutics development
https://covidcg.org
MIT License
26 stars 5 forks source link

Consistent SNV colors #222

Open atc3 opened 4 years ago

atc3 commented 4 years ago

SNV colors are updating as new SNVs are added, so the colors are changing since they're based on list indices

Maybe calculate a hash based on the SNV string, and then assign based on that?

atc3 commented 3 years ago

SNV colors are assigned on an iterative basis (for all SNVs) on the client-side in src/stores/snvData.js. Instead, we could hash the SNV into an integer (string hash -> hex string -> convert to base 10 integer), then use the hash integer as an wrapped index (modulo) for the color array (i.e., hash int of 16 in a list of 10 colors would resolve to 16 % 10 = 6).