marbl / Krona

Interactively explore metagenomes and more from a web browser.
https://github.com/marbl/Krona/wiki
463 stars 102 forks source link

Coloring by categorical attribute & Krona 2.0 XML Specification #31

Open DWgit opened 7 years ago

DWgit commented 7 years ago

The 2011 Ondov et al. BMC Bioinformatics paper says, For categorical variables, users may define the color of every node in the XML, but it's not clear how to express that in the xml file.

The Krona 2.0 XML Specification describes color gradients but there's no mention of discrete colors for categorical attributes.

Thanks very much for any info.

ondovb commented 7 years ago

It's a little roundabout, but you can attach the gradient to a dummy attribute (e.g. "color") and use that to directly specify hues like so:

<attributes ...>
    ...
    <attribute>color</attribute>
</attributes>
<color attribute="color" valueStart="0" valueEnd="360" hueStart="0" hueEnd="360" default="true"></color>
...
    <node ...>
        ...
        <color><val>60</val><val>120</val></color>
    </node>
DWgit commented 7 years ago

Makes sense, thanks very much.

Is there any way to place the category labels into the gradient legend?

Best regards

ondovb commented 7 years ago

Not at the moment, but this would be useful.

caravinden commented 7 years ago

This query intention to get clarification on coloring part. I need to give some custom color to the application. May I know the best way of doing it and my color hue in like hueStopHsl = ['rgb(255,204,204)','rgb(255,153,153)', 'rgb(179,0,0)'];

Artur0901 commented 6 years ago

It's a little roundabout, but you can attach the gradient to a dummy attribute (e.g. "color") and use that to directly specify hues like.......

Unfortunately, I can't do it. Could you explain where I have to put it? I will be very grateful.

Best regards!

KewinOgink commented 4 years ago

The 2011 Ondov et al. BMC Bioinformatics paper says, For categorical variables, users may define the color of every node in the XML, but it's not clear how to express that in the xml file.

The Krona 2.0 XML Specification describes color gradients but there's no mention of discrete colors for categorical attributes.

Thanks very much for any info.

Hello, I was wondering if this has been fixed. Currently I have a text file (see below) that gives me a nice figure, but I want to add coloring based on categorical variables (ie phenotypes, in this case gram+ gram-). Does anyone have tips how to convert this text file to the xml format? I can do python and R, but am new to xml parsing.

Gram+ cellular organisms Bacteria PVC group Planctomycetes Planctomycetia Planctomycetales Planctomycetaceae Rubinisphaera Rubinisphaera brasiliensis Gram- cellular organisms Bacteria Terrabacteria group Cyanobacteria/Melainabacteria group Cyanobacteria Synechococcales Merismopediaceae Synechocystis unclassified Synechocystis Synechocystis sp. Gram+ cellular organisms Bacteria Terrabacteria group Actinobacteria Actinobacteria Actinopolysporales Actinopolysporaceae Actinopolyspora Actinopolyspora halophila Gram- cellular organisms Bacteria Terrabacteria group Firmicutes Clostridia Halanaerobiales Halanaerobiaceae Halanaerobium Halanaerobium praevalens

Thanks,

Kewin