Colorize contigs by non-numeric attributes
fedarko opened this issue · 1 comments
fedarko commented
e.g. an assigned species
attribute or something.
Something like this project, a JS library which supports the generation of arbitrary-length sequences of visually distinct colors, would make this fairly simple. Pseudocode for implementing this feature:
- Identify the number of unique values of the given attribute (depending on the situation, we should probably do this with a case insensitive search). Let's call this value
c
. We should probably define a default value, if it's not guaranteed that every node will have the attribute in question defined. - Save all unique values as an array or something.
var colorList = distinctColors({count: c});
- Next, iterate over the array of unique values to create an Object mapping of unique value to a distinct color. Might wanna define a helper function to convert
Color
objects to hex color strings. This mapping should probably be a global variable, so it can be accessed multiple times. - At this point we can just modify
getNodeColorization()
or something accordingly, using the mapping as a guide.