dasmoth / dalliance

Interactive web-based genome browser.
http://www.biodalliance.org/
BSD 2-Clause "Simplified" License
226 stars 68 forks source link

Colors in BED format are ignored #214

Open max-l opened 7 years ago

max-l commented 7 years ago

I am using this stylesheet to display bed tracks : https://www.biodalliance.org/stylesheets/gencode.xml

The rows in the bed tracks have colors that are not honored by the browser, I suspect that the stylesheet is designed override the color.

Here is a sample line in my bed track :

10  14521189    14530459    NP_001269626.1  500 -   14521189    14530459    20,50,0 3   117,151,128 0,679,9142

It displayed as red boxes.I suppose the browser assigns the stylesheet type "translation" or "bb-translation" from the genecode.xml stylesheet, but I don't see how, there is nothing in the row that "says" they are a translation or a "bb-translation".

The genecode.xml stylesheet does exactly what I need (display the tracks as boxes against a genome), except for the color, would love to know how to control the color from the stylesheet or get it to honor the RGB color in bedtracks....

If there was a JSON version of the gencode.xml stylesheet it would be pure pleasure to use it (instead of genecode.xml)...

Oh, and thanks for this great project ! ;-)

dasmoth commented 7 years ago

Colours in BED and bigBed files are supported, but need to be explicitly enabled (which is necessary in order to match UCSC track-hub behaviour).

You can do this with the BGITEM stylesheet property: http://www.biodalliance.org/stylesheets.html

To get a well-behaved gene track with gene bodies coloured according to the itemRgb field of a bigBed file, you probably want (using your preferred JSON format):


       {
             name: 'Colourful gene track',
             bwgURI: '/path/to/genes.bw',
             style: [
                   {type: 'transcript',
                    style: {
                        glyph: 'BOX',
                        HEIGHT: 10,
                        FGCOLOR: 'black'
                        BGCOLOR: 'white',
                        BUMP: 'yes',
                        LABEL: 'yes'
                    }
                 },
                 {type: 'translation',
                  style: {
                         glyph: 'BOX',
                         HEIGHT: 10,
                         FGCOLOR: 'black',
                         BGITEM: 'yes'
                 }}]
       }
max-l commented 7 years ago

It works wonderfully, thanks !