TrackColorsMixin
Auto-generated @jbrowse/mobx-state-tree API for the current JBrowse release — see pluggable elements for concepts. Built into JBrowse core. View source.
The color-by state shared by every view that can draw more than one synteny track at once: the view-wide colour object and the palette that tells overlaid tracks apart.
A view supplies only colorableTrackConfigs — the dotplot walks its flat
tracks, a linear synteny view flattens levels. Everything downstream of
that list (palette assignment, mode resolution, legend rows) is identical, so
it lives here rather than being copied into both models.
Properties
| Member | Description |
|---|---|
colorBycolorBy: syntenyColorConfigSchema | The colour every track in the view paints with, a SyntenyColor object: { field: "strand" }, { field: "query" }, { field: "reference" }, { field: "track" }, a measurement (identity, mappingQual, dnds) or a column the tracks declare, with domain ordering a text column's labels; a colour string paints every alignment. Unset, the default scheme paints. |
trackColorstrackColors: types.map(types.string) | trackId -> explicit color under colorBy: { field: 'track' }. Absent means the track takes an automatic slot from the palette. |
hideUnlabelledhideUnlabelled: types.stripDefault(types.boolean, false) | Under a text-column mode, draw only the rows that carry a label. |
Volatiles
| Member | Description |
|---|---|
colorLegendDismissedForcolorLegendDismissedFor: undefined as string | undefined | The field whose legend the reader closed. The legend comes back with the next field that has one, so a dismissal is scoped to the field it was made in rather than being a setting to find again. |
seenAttributeRangesseenAttributeRanges: {} as Record<string, AttributeRange> | The widest span each numeric channel has been seen to cover, over every fetch this view has taken — what keeps a column's ramp from re-scaling under a pan. Widened by observeAttributeRanges, dropped by resetAttributeRanges, read through attributeRanges, which is where the reasoning is. |
Getters
| Member | Description |
|---|---|
colorBySettingSyntenyColorSnapshot | The colorBy object as its snapshot holds it. |
colorByValuestring | undefined | colorBy.value: the colour every alignment paints under the default mode in place of the view's own scheme, or undefined for that scheme. |
colorDomainreadonly string[] | colorBy.domain, the order a text column's labels take. |
colorableAttributesstring[] | Distinct numeric columns across the overlaid tracks, in first-seen order — two tracks declaring dn offer one dn mode, not two. |
attributeRangesRecord<string, AttributeRange> | The span each numeric channel covers: unioned over the loaded displays, and over every fetch this view has already taken (seenAttributeRanges). A column has no declared domain, so this is what its ramp scales to, what the legend labels it with, and — since it is the one domain — what the two cannot disagree about.MONOTONIC, which is the point. A fetch's payload reports the span of the slice it holds, and that slice is the snapped window: painting straight off it re-maps every feature onto the ramp each time a pan rolls the window over, so a ribbon in the middle of the ramp turns into one at the bottom while the reader is scrolling and its value has not changed. A domain that only ever widens still says what the reader is looking at — the legend prints the actual numbers — and settles instead of oscillating. Monotonic UNTIL A MODE IS PICKED, which is the way back: one window holding an outlier would otherwise compress the ramp for the rest of the session, and the union above is over the LOADED spans, so resetAttributeRanges rescales to what is on screen there and then.View-wide rather than per display because the floating legend is one box for the whole view: two displays scaling the same ramp from different spans would make that one legend lie about one of them. |
colorableTracksColorableTrack[] | colorableTrackConfigs paired with whatever color the user pinned. This is the single definition of "the tracks that get colors" — the palette, the legend and the palette menu all read it, so they cannot disagree about which tracks are in play. |
trackColorAssignmentsMap<string, string> | trackId -> the color it draws in under colorBy: { field: 'track' }. Assigned across the whole view rather than per display, so an automatic slot can't duplicate a color pinned on a sibling. |
colorByFieldstring | The field colorBy paints by, '' for the default colour. |
hasLegendKeyboolean | Whether the floating legend is up: the mode has a key worth drawing — a ramp, a label per track, a chip per category — and the reader has not closed it for this mode. Default and strand are read without one, and the by-chromosome modes have no fixed key to show. Whether the mode has a key worth a box: a track palette, a ramp, or a reader-named column. The two structural presets key nothing on screen — their colors are the menu preview's. |
showLegendboolean | The legend-host half of LegendMixin a view needs: whether the key draws, which is the mode having one and the reader not having closed it in this mode. ChromeLegend and SvgLegend read it. |
colorLegendChipsColorChip[] | Legend rows naming the overlaid tracks — one per track with its palette color, however many levels it is on, and only under colorBy: { field: 'track' }, since every other mode has a fixed legend of its own. |
colorScalesColorScale[] | The active mode's key as its one color scale, or none for a mode without one. View-wide rather than per display because the key is one box for the whole view, and the ramp domain it labels is the view's. |
legendSpecLegendSpec | The key ChromeLegend draws on screen and SvgLegend in the export. |
Methods
| Member | Description |
|---|---|
colorableTrackConfigs() => { trackId: string; name: string; }[] | The tracks that can take a palette slot, in paint order. Overridden by the composing view; a method rather than a getter because that is the form MST overrides cleanly. |
colorableAttributeNames() => string[] | Columns the overlaid tracks declare (an ortholog table's attributeColumns), each of which the palette menu offers as its own mode, less the reserved color column. Overridden by the composing view, which is the only thing that can reach the track configs.From the CONFIG rather than from loaded data: the menu has to be right before the first fetch, and a track that declares a column carrying no values paints the default color anyway. |
loadedAttributeRanges() => Record<string, AttributeRange>[] | One entry per loaded display: the span each numeric channel actually covered in the data that display fetched. Overridden by the composing view, which is the only thing that can reach the displays. From loaded DATA rather than from the config, unlike colorableAttributeNames — a column's observed span is not declared anywhere, so nothing before the first fetch can answer it. |
legendAlpha() => number | Overridable hook: what the key's chips are composited by. The ribbon views draw at a global alpha over the band's ground; a view that draws opaque leaves it. |
legendCigarOps() => number | undefined | Overridable hook: the indel ops the key lists a chip for, so it names only what the eye can find. undefined is the static menu preview; the dotplot draws flat points and never a CIGAR op. |
legendPointBased() => boolean | Overridable hook: whether the view draws each alignment as one flat point (the dotplot) rather than a ribbon with match and indel blocks. |
trackColorFor(trackId: string) => string |
Actions
| Member | Description |
|---|---|
observeAttributeRanges(ranges: Record<string, AttributeRange>) => void | Fold one fetch's observed attribute spans into the domain this view paints and labels its ramps with. Called by each display as its fetch lands, because the accumulation has to outlive the payload it came from: the previous window's span is gone from loadedAttributeRanges the moment the next one commits. |
resetAttributeRanges() => void | Forget the accumulated domain, leaving attributeRanges reporting what the LOADED fetches cover and nothing else.The way back from a monotonic domain, and the only one: a single window holding an outlier widens the ramp for the rest of the session, and attributeRanges unions the loaded spans over this, so a reset rescales to what is on screen without waiting for a refetch. Picking a mode is what calls it — the gesture a reader makes when the ramp is telling them nothing is to choose it again. |
setHideUnlabelled(value: boolean) => void | |
setColorBy(field: string) => void | Set the field the view paints by over the colorBy object ('' for the default colour), and rescale the ramp, which is the only way back from a domain one outlying window widened. |
setColorDomain(domain: string[]) => void | Declare the order a text column's labels take. The labels listed lead, the rest follow sorted; an empty list gives back the order the fetches found them in. |
setTrackColor(trackId: string, value: string | undefined) => void | Pin one track's color under colorBy: { field: 'track' }, or release it back to an automatic palette slot. |
clearTrackColors() => void | |
setShowLegend(show: boolean) => void | Close the legend for the mode in use. The legend host's setter: closing the key hides it for this mode only, so picking another mode brings its key up. |
dismissLegendSection() => void | One section is the whole key here. |
Related links
- Guide: URL query parameter API