FeatureColor
Auto-generated from the config schema in the source — see the config guide for concepts. Built into JBrowse core. View source.
The canvas feature displays' encoding.color: a CSS color or jexl:
callback in value, or a field whose values each take a range color, whose
numbers each take the color of the interval between cut points they fall
in, or whose numbers run along a color ramp, with a key. A string is the
field; a written field always paints. scale.type: "identity" keeps each
feature's color, whether a file's itemRgb or what a value callback
returns, and names the colors scale.domain lists in the key. Like UCSC's
itemRgb on, it paints an itemRgb of 0,0,0 or 0 black, which otherwise
reads as no color, and reads a comma-free itemRgb as a packed integer.
Example usage
{ type: 'LinearBasicDisplay', encoding: { color: { value: 'goldenrod' } } }{
type: 'LinearBasicDisplay',
encoding: {
color: { field: 'gene_biotype', scale: { range: ['#1f77b4', '#ff7f0e'] } },
},
}{
type: 'LinearBasicDisplay',
encoding: {
color: {
field: 'type',
scale: {
domain: ['prophage', 'plasmid'],
range: ['#d95f02', '#1b9e77'],
unknown: '#cccccc',
},
},
},
}{
type: 'LinearBasicDisplay',
encoding: {
color: {
field: 'score',
scale: {
type: 'threshold',
domain: [0.5, 0.9],
range: ['#c6dbef', '#6baed6', '#08519c'],
},
},
},
}{
type: 'LinearBasicDisplay',
encoding: { color: { field: 'score', scale: { scheme: 'viridis', domainMin: 0 } } },
}{
type: 'LinearMultiRowFeatureDisplay',
encoding: {
color: {
scale: {
type: 'identity',
domain: ['rgb(255,0,0)', 'rgb(0,128,0)'],
names: ['Active TSS', 'Strong transcription'],
},
},
},
}Config slots
A setting written to it replaces it whole, since its members are alternatives: a member left out returns to its default. Slot types (fileLocation, frozen, ...) are explained in the config slot types reference. Slots a base configuration contributes are listed here too, so this table is the whole surface.
| Slot | Description |
|---|---|
titlemaybeString | The heading of the key this scale draws, naming what the color measures. Three states: unset, the key keeps the display's own heading, usually the field's name; some text is that text; "" is a key with no title, and the only spelling of one. null reads as unset, as it does in every slot. |
valuemaybeColor | A CSS color, or a jexl callback over feature returning one. Unset, a feature's own BED itemRgb paints it if it has one, else goldenrod.callback args: feature |
| scale FeatureColorScale sub-schema | How the field's values map to colors, Vega-Lite's scale object. |
| legend FeatureColorLegend sub-schema | The key this channel draws. |
fieldfeatureField = '' | a feature field, or a jexl expression over feature, whose values each take one range color, with a key; a transcript and its parts paint the transcript's value, or its gene's where the transcript has none; strand paints forward tomato and reverse cornflowerblue unless scale.domain or scale.range says otherwise |
scale.typemaybeStringEnum | ordinal a range color per value of field; threshold a range color per interval between the cut points in domain; linear or log a color along a ramp from domainMin to domainMax; identity paints each feature's own color, as a channel with no field does, except that an itemRgb of 0,0,0 or 0 paints black and a comma-free one reads as a packed integer, and the key names the colors in domain; unset is linear for score and ordinal for any other field |
scale.domainstringArray = [] | the values that take the range first, in order; a value left out takes a color no listed value or value met before it paints, the first time the track shows it, and keeps it. Under threshold, the ascending cut points, a value on a cut taking the interval above it. Under identity, the CSS colors the key names, in order |
scale.rangecolorArray = [] | CSS colors the domain takes, in order, continuing into the default palette past its end; under threshold one per interval, one more than the cuts; under linear or log the ramp's stops, winning over scheme |
scale.unknownmaybeColor | color for a value missing from domain: unset takes the next palette color where the display deals one, a color paints that color, "" adds no color from this setting, so a row keeps the color it already has, a variant cell takes the alt hue and a feature the no-value grey |
scale.invalidmaybeColor | color for a feature with no value under an ordinal scale's field; unset, the display's no-value color |
scale.namesstringArray = [] | key name for each domain value, one each in order, or under threshold for each interval from the lowest; a value past the end of the list shows its own |
scale.schememaybeStringEnum (viridis, magma, inferno, cividis, juicebox, fall, reds, blues, redblue, purpleorange, redgreyblue, redyellowblue) | a named ramp: a linear, log or symlog scale runs along it, and a threshold that writes cuts takes one color per interval from end to end; range's colors, where it lists any, win over it |
scale.reversemaybeBoolean | turns the ramp round, so its last color paints the bottom of a ramp's domain or a threshold's lowest interval; unset follows the field's preset, else runs as written |
scale.domainMidmaybeNumber | the value the ramp's middle stop sits at, so a diverging ramp centres somewhere other than the middle of the domain, both sides on one scale: the farther end of the domain reaches its end color and equal distances from the middle take equal colors; unset, the stops are evenly spaced across it |
scale.domainMinmaybeNumber | the bottom of a ramp's domain; unset follows the loaded values |
scale.domainMaxmaybeNumber | the top of a ramp's domain; unset follows the loaded values |
scale.domainQuantilenumber = 1 | the quantile an open end of a ramp follows over the loaded values: 1 their extremes, 0.99 clips the outermost 1% at each end, each sign measured on its own advanced |
legend.titlemaybeString | key title; unset keeps the display's own heading, "" draws none |
Related links
- User guide: Gene track