marbl/MetagenomeScope

Colorize contigs by non-numeric attributes

fedarko opened this issue · 1 comments

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:

  1. 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.
  2. Save all unique values as an array or something.
  3. var colorList = distinctColors({count: c});
  4. 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.
  5. At this point we can just modify getNodeColorization() or something accordingly, using the mapping as a guide.

Closing in favor of #243.