dasmoth / dalliance

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

BGITEM did not work #197

Closed mdphan closed 7 years ago

mdphan commented 7 years ago

Hi,

I am trying to colour my features in bigBed file using the itemRgb column and BGITEM option in the style sheet but it did not work.

My bed file looks like this (bacterial genome):

chr 336 2798    thrA    0   +   336 2798    255,0,0 fused aspartokinase I and homoserine dehydrogenase I    
chr 2800    3732    thrB    0   +   2800    3732    0,0,255 homoserine kinase
chr 3733    5019    thrC    0   +   3733    5019    255,0,0 threonine synthase  
chr 5233    5529    yaaX    0   +   5233    5529    0,0,255 hypothetical protein

and my tier set up:

{name:        'Annotation',
                desc:        'CDS annotation',
                   bwgURI:      'data/chr.annotation.bb',
                   trixURI:     'data/chr.annotation.ix',
                   collapseSuperGroups: true,
               style: [{type: 'default',
                            style: {glyph: 'ANCHORED_ARROW',
                                    HEIGHT: 10,
                                    FGCOLOR: 'black',
                                    BGITEM: 'yes',
                                    PARALLEL: 'yes',
                                    LABEL: 'no',
                                    BUMP: 'no', 
                                    }
                            }],
},

Am I doing something wrong? All my features have green colour.

Thanks,

mdphan

mdphan commented 7 years ago

Hi,

I found a solution for it by adding:

if (style.BGITEM && feature.itemRgb) fill = feature.itemRgb;

in to here in the dalliance-all.js:

else if (gtype === 'ANCHORED_ARROW') {
        var stroke = style.FGCOLOR || 'none';
        var fill = style.BGCOLOR || 'green';
        if (style.BGITEM && feature.itemRgb)
            fill = feature.itemRgb;
        gg = new AArrowGlyph(minPos, maxPos, height, fill, stroke, strand);
        gg.bump = true;

Cheers,

mdphan