Pages

Sunday, 11 October 2015

KEGG map colo(u)rs

KEGG has a handy map colouring feature, where one can feed it a list of KEGG IDs from whatever database of theirs and a colour, which it will use to colour the image of the pathway. KOBAS and other severs offer similar features, but this is the original.
Two things are frustrating. One is the classic strangeness of the maps that seem to have everything and more, except when you want a certain reaction, which inexplicably is not annotated on that map. The other are the colours, which are annoying but strangely addictive.
Basically, the colours can be RGB codes or names. The former scheme is fine, except the latter is more human readable and trying to figure out what is okay or not is rather addictive. Colours, or more correctly colors as the web is written in US English, can be described in many ways.
The code system ("hex triplet") is formed of three consecutive hexadecimal double-digit numerals prefixed with a hashtag (e.g. #c3a0d2), where each pair corresponds to Red, Green or Blue (RGB). KEGG accepts these fine.
In HTML and CSS colors have proper names —the most official source of the exact names of colours is Pantone, but this comes close. KEGG implements some single word ones, e.g. gray —not grey: an HTML mistake I always make—, red, blue, green, yellow, orange and gainsboro —a handy colour for padded div boxes, which seems like a mispelt Gainsborough—. Puce is not an HTML colour, so I am not surprised it does not like it, however, aqua is but it does not like it. It also accepts some of the two word names, like GreenYellow, but not others, like DarkGray. Funnily the capitalisation seems to matter: lower-case only for single word names, while CamelCase for the compound ones —HTML and CSS are case insensitive. "Brewer colors" can be excluded as dgray or lgray don't seem to work either. This all seems to point to the fact that some poor chap had to write the dictionary server side to covert the names to hex=triplets
One curious thing is that several names collapse into one colour. lavender is the same as gainsboro and lightgray.
All in all the hex-triplets and the smattering of names fulfil all needs, but the strange quirkiness is fun to unpick...
Here is a wee series of Reaction identifiers to colour down the glycolysis pathway if you want to try your luck at colour picking:

R00959 gray
R02740 purple
R02738 GreenYellow
R09084 orange
R04779 green
R01070 red
R01061 gray
R01512 gainsboro
R01518 #ddeedd

No comments:

Post a Comment