TrackColorsMixin
Auto-generated from the @jbrowse/mobx-state-tree model in the source — see the developer guide 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 color 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 |
|---|---|
| color | The color every track in the view paints with, a SyntenyColor object: { field: "strand" }, { field: "query" }, { field: "reference" }, { field: "track" }, a measurement (identity, mapq, dnds) or a column the tracks declare, with domain ordering a text column's labels, range coloring them and labels naming them in the key, range or scheme, reverse and pinned ends reshaping a ramp, and scale: 'threshold' binning a number at domain's cuts; a color string paints every alignment. Unset, the view's default paints: query on the circular view, the default scheme elsewhere. |
trackColorstrackColors: types.map(types.string) | trackId -> explicit color under color: { 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 |
|---|---|
seenAttributeRangesRecord<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 |
|---|---|
colorSettingSyntenyColorSnapshot | The color object as its snapshot holds it. |
colorPaintSyntenyColorPaint | What color declares over a field's own scale: scale, domain, range or scheme for its colors, reverse, and a ramp's pinned ends and middle. Read off its own slots, so a key-only edit repaints nothing. |
colorValuestring | undefined | color.value: the color every alignment paints under the default mode in place of the view's own scheme, or undefined for that scheme. |
colorDomainreadonly string[] | color.domain, the order a text column's labels take. Read off its own slot, so a key-only edit (title, labels) recolors nothing. |
colorRangereadonly string[] | color.range, the colors a text column's labels take in domain order |
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 color: { field: 'track' }. Assigned across the whole view rather than per display, so an automatic slot can't duplicate a color pinned on a sibling. |
colorFieldstring | The field color paints by, '' for the default color. |
hasLegendKeyboolean | Whether the mode has a key worth a box: a track palette, a ramp, a reader-named column, or strand wherever the shape does not show it (shapeShowsStrand), which leaves the color the only strand cue. |
colorLegendChipsColorChip[] | Legend rows naming the overlaid tracks — one per track with its palette color, however many levels it is on, and only under color: { field: 'track' }, since every other mode has a fixed legend of its own. |
colorScalesColorScale[] | The active mode's key, 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. |
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. |
colorSurface() => SyntenyColorSurface | Overridable hook: what draws each alignment, a ribbon with match and indel blocks or one flat point (the dotplot). The key, the menu's help text and which fields key at all read it. |
offersReferenceColor() => boolean | Overridable hook: whether the view has a shared reference for the reference field to anchor on. It needs a stack of two or more levels; below that it is query or target by another name. |
shapeShowsStrand() => boolean | Overridable hook: whether an alignment's shape shows its strand, which spares the strand colors a key. A linear ribbon twists against its rows' directions, which their rulers show; a whole-genome dotplot is mostly dots with no slope to read. |
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 | |
setColorField(field: string) => void | Set the field the view paints by over the color object ('' for the default color), 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 color: { field: 'track' }, or release it back to an automatic palette slot. |
clearTrackColors() => void |
Related links
- Docs: URL query parameter API