jbrowse-components
jbrowse-components copied to clipboard
Allow using color encoded in an attribute
The itemRgb/reserved field in bigbed is an example
It would be nice to have this functionality baked in for some cases, since it is difficult to make a color callback to properly express this.
Note that BAM also has this, and is not currently supported by our color by tag system (example YC:Z:255,0,0)
Was mentioned on jb1 forum. Still probably a good thing to do in jb2
this was brought up by a user at pag2024, how they had a hard time figuring out how to get the 'standard' BED itemRgb field to be used by a color callback
ended up being in a field called field8 instead of itemRgb also, which i suppose if it was changed, would be a breaking change
It would be great to support itemRgb natively in jbrowse for BED files, but here is a hack I used cobbled from other info I've gathered here in the meantime:
{
type: 'FeatureTrack',
trackId: 'trackID_1',
name: 'trackID_1',
assemblyNames: ['GRCh38'],
adapter: {
type: 'BedTabixAdapter',
bedGzLocation: {
uri: 'data/trackID_1.bed.gz'
},
index: {
location: {
uri: 'data/trackID_1.bed.gz.tbi'
}
}
},
displays: [
{
type: "LinearBasicDisplay",
displayId: "SetRGBColor_filt01",
renderer: {
type: "SvgFeatureRenderer",
color1: "jexl:get(feature,'field8')"
}
}
]
},
yep thats the code to use, glad you got that example posted @sfederman
it could be that the field8 (just auto-named fields by column number...) gets renamed to itemRgb, and then we can make code so that any feature that has an itemRgb uses that value.