TreeSidebarMixin
Auto-generated from the @jbrowse/mobx-state-tree model in the source. See the developer guide for concepts. Built into JBrowse core. View source.
Row set with a dendrogram sidebar, its arrangement and its row colors the display's rows config object (rows.colors pinned on rows, rows.color mapped from an attribute), each written as a session edit to the track's config so undo, reset and a share link reach it and it survives unticking the track. Brings the sidebar toggles, the runClustering / clusterRegion and sortRowsBy declarative launch specs setupTreeSidebarAutoruns consumes, the row arrangement every shared consumer goes through, the rows derived from it (arrangedRows, shownRows) with the arrangement dialog's applyRowEdits, the root getter, and the tree-hover and canvas-ref volatiles the shared sidebar draws through. A display supplies discoveredRows, and guideTreeNewick where its adapter has a tree, and overrides the hooks its rows need
The rows are derived in stages, each a separate computed: the display's
discoveredRows, then expandedRows (expandRows: a variant display's
haplotypes), then arrangedRows, ordered by rowOrder, relabelled by
rows.labels and each with its resolved color as rowColor, then
shownRows, narrowed to the focus, then stackedRows, stacked
in the bands rowBanding names. The stages, the row colors, where
the rows start (rowsTopOffset) and the dendrogram positioned against them
(hierarchy) are written in treeSidebarRowViews.ts,
which a tables export installs on a model of its own beside its display's
row hooks, so it arranges and colors the rows as the view does.
A row's color is resolvedRowColors: its rows.colors entry, else its
rows.color entry (the color dealtValueColors deals its field's value),
else the row's color, else the row palette's color by name where
rowPaletteDeals. The
sidebar draws it as a bar beside the row's label, and a display paints its
marks in it where rowColorPaintsMarks. Its key is rowColorScales, and a
click on an entry focuses that entry's rows (focusLegendEntry).
Every arrangement write reaches the session at once rather than after the
track's 400 ms save, so a clustering run is one undo step and undoable the
moment its tree appears. "Reset row order" returns each member, and
rows.color where it sets a row a color, to what the config.json declares,
or what a track the session owns was added with, and never touches
rows.field.
A change in the drawn rows' order (a sort, a clustering run landing, a
focus) clears the display's stored hover, which would otherwise name a row
no longer under a still pointer; a relabel moves no row and keeps it.
The composing display must provide clearHoveredFeature (BaseDisplay
does): TreeSidebarHost is asserted onto self, not checked.
Properties
| Member | Description |
|---|---|
runClusteringboolean | undefined |
Transient declarative launch spec, the same idea as LinearGenomeView's init: a session or config sets this true and the real clustering RPC runs once automatically, with no dialog, as soon as the display reports itself ready. setupRunClusteringAutorun clears it afterwards, so a saved session never re-triggers. |
clusterRegionstring | undefined |
Where that run reads from, as a locstring (whitespace-separated for several). Clustering is region-scoped, so naming the locus lets a session cluster on the signal and then show it against its context. Cleared with runClustering, since it is that flag's argument. |
sortRowsByRowSortSpec | undefined |
Transient declarative launch spec, the same idea as runClustering: set {refName, pos} to order the rows once by the value each row has at that genomic column — the session-expressible form of the right-click "Sort rows by ... here". setupRowSortAutorun applies it once the region containing it has loaded and then clears it, so the resulting order persists but a saved session never re-sorts. |
Volatiles
| Member | Description |
|---|---|
hoveredTreeNodeHoveredTreeNode | undefined |
|
treeCanvasHTMLCanvasElement | null |
|
mouseoverCanvasHTMLCanvasElement | null |
Getters
| Member | Description |
|---|---|
showTreeboolean |
Whether the dendrogram sidebar is drawn. |
showBranchLengthboolean |
Whether the tree draws nodes at their branch length (dendrogram) or evenly by topology (cladogram). |
showRowLabelsboolean |
Whether each row's name is drawn over the left of the plot. |
treeAreaWidthnumber |
Width in px of the sidebar the dendrogram draws in. On the config rather than the display snapshot for the same reason height is: the config node outlives the display instance, so a dragged width survives unticking and reticking the track. |
rowSortstring[] |
The row order, rows.sort: the rows it names lead, in its order, and the rest follow in the order they arrived in. |
rowLabelsReadonly<Record<string, string>> |
The labels drawn in place of row names, rows.labels, by name. |
storedRowTreestring | undefined |
The newick rows.tree stores, a clustering run's or one that arrived as data; undefined while none is stored. |
rowTreeProvenanceClusterProvenance | undefined |
What rowTree was computed from, the locus and the settings; undefined for a tree that arrived as data, and while no newick is stored, since a provenance describes only the newick beside it. |
rowFocusreadonly string[] | undefined |
Overridable hook: the row names a focus narrows the display to, rows.kept — a clade picked off the tree or a key row's rows — or undefined while every row shows. A display that can hide its rows answers undefined while they are hidden. |
rowFilterreadonly FieldPredicate[] |
Overridable hook: rows.filter, the predicates over row attributes a row must pass to show, none where the display declares none. A display that can hide its rows answers none while they are hidden. |
rowColorChannelRowColorSetting |
The rows.color object: the row field whose values take colors, name where it names none, and the values with an assigned color. |
rowColorPinsReadonlyMap<string, string> |
The colors pinned on rows, rows.colors, by name. |
rowSubtitleFieldstring |
The row attribute rows.subtitle names, drawn after each row's label; '' for none, and where the display's rows declares no subtitle (MAF's). |
rowAnnotationChannelsRowAnnotationSetting[] |
The rows.annotations channels drawn, in the order listed, each read as rowColorChannel reads rows.color: none where the display's rows declares no annotations (MAF's), none while the row labels they draw beside are hidden, never one on name, which the labels already show, and none on the rows.color field, whose column the row color already draws. Each keeps its position in the list. |
finerTreeHint{ text: string; title: string; } |
Overridable hook: what the sidebar says where the tree's leaves are finerRows, which it hides. |
SvgSidebarProps | undefined |
Overridable hook: what the SVG export draws in the sidebar left of the track, or undefined, the default, for none. SvgTreeSidebar draws it and svgSidebarWidth sizes the gutter from it. |
internalRowFieldsreadonly string[] |
Overridable hook: the row fields that are display plumbing, which the arrangement dialog never lists as a column. |
baseRowColorChannelRowColorSetting |
The rows.color object this display's base declares, which a reset returns to and "is this the reader's" compares against. |
baseRowColorSettingRowColorSetting |
rowColorSetting as this display's base declares it. |
rowColorIsCustomboolean |
Whether rows.color gives its field's values colors the config does not, so "Reset row order" is offered for a recolor too: whether rowColorResetTarget has anything to write. A choice of row color source is no arrangement, so it is never custom. The pins are an arrangement member. |
rowColorChoicestring |
The choice of what colors the rows, as the arrangement dialog and a menu offer it: '' for none dealt, name for a palette color each, or a field. |
rowColorFieldsOfferedreadonly string[] |
The fields a reader can color the rows by: rowColorFields, and the current one where the rows lack it, so it still shows as chosen. |
rowArrangementIsCustomboolean |
Whether the arrangement differs from what the config declares — what "Reset row order" is offered on. |
rotatableRowTreestring | undefined |
The tree a reorder rotates rather than drops, as newick: a supplied rows.tree, one with no provenance, else the guide tree while guideTreeHonoursDomain. A computed tree is never one, since its run rotated it already. |
autoClusterReadyboolean |
Overridable hook: whether the declarative runClustering run may start, two or more shownRows by default. |
rowsContentHeightnumber |
The px the rows stack to, drawnRows × effectiveRowHeight, which the dendrogram's leaves spread over: the content the rows scroll through, never the viewport they scroll inside. It counts the mixin's rows, not wiggle's grouped rows: its one reader is the tree, which grouped rows do not draw. |
hierarchyClusterHierarchyNode | undefined |
The dendrogram positioned against the rows drawn, or undefined while there is no tree or drawsTree is off. computeClusterHierarchy checks the tree's leaves against the drawn row names, the backstop against anything reordering drawnRows downstream of the arrangement: such a reorder drops the dendrogram rather than drawing it against rows it does not name. |
SvgSidebarProps |
What the sidebar draws left of the rows, from the settings and the rows drawn: the dendrogram, the band strip, the row labels, the rows.annotations columns and the columns' labels. A display's svgSidebar is this, or a spread of it with what that display changes, so the screen, the axis past the panel and the export size and draw one sidebar. |
SidebarBounds |
The box the sidebar covers, in display px: left of right, the dendrogram's resize handle's right edge (0 with no tree drawn), and from rowsTopOffset down, so a band stacked above the rows stays the display's across its full width. The canvas runs under the sidebar, so x maps to bp as anywhere else. Every pointer gate reads it through sidebarCovers, and a drag over the rows stops at right. |
awaitingDependentDataboolean |
Fills FetchMixin's hook: a declared runClustering run is due, so the loading scrim and the export wait for the rows it orders. The run clears the flag when it settles, failed or not. |
spatialIndexTreeSpatialIndex | undefined |
The hit index the sidebar's subtree hover reads, built from hierarchy. |
clusterPartitionstring[][] | undefined |
The names of the rows a clustering run clusters, by band, so each band clusters apart and the run writes one forest; undefined while fewer than two bands stack. |
treelessBandCountnumber |
How many bands the tree draws no dendrogram for, because it holds no clade whose leaves are that band's rows in order; 0 with no tree or no bands. |
baseRowFilterFieldPredicate[] |
The rows.filter this display's base declares, which "Show all" and "Reset row order" return to. |
rowBandingNoticesstring[] |
A line for the corner notice when rows have arrived and none has the field rowBanding bands by, which then bands nothing. |
rowNarrowingClearsboolean |
Whether "Show all" has anything to clear: rows.kept names rows, or rows.filter differs from the config's. |
rowNarrowingNoticesstring[] |
The corner notice's lines on the narrowing, once the rows are known: a rows.filter field no row carries, what left no row where none shows, and where the track lists its rows up front (rowsListedUpFront), the rows.kept names no row has. |
rowSettingNoticesstring[] |
The lines on what the rows settings leave, whatever draws them: rowBandingNotices, then rowNarrowingNotices. A tables export warns with these. |
rowNoticesstring[] |
The corner notice's lines on the rows, which each display spreads into its notices: rowSettingNotices, then rowAnnotationNotices at the track's height. |
rowNarrowingHint{ text: string; title: string; } | undefined |
The chip above the rows while rowNarrowingShows: "Showing N of M rows", with "Show all" where rowNarrowingClears, and the config's own rows.filter, which "Show all" keeps, stated in its tooltip. |
treeOnFinerRowsboolean |
Whether the tree's leaves include rows a finer field draws (finerRows), each standing in for a drawn row, as a tree clustered per haplotype is in sample mode: it describes no drawn rows, and the hint says why (finerTreeHint). |
treeHasBranchLengthsboolean |
Whether the tree has merge heights, so a dendrogram layout differs from the cladogram; gates the "Show tree branch lengths" toggle. |
Methods
| Member | Description |
|---|---|
(text?: ExportTextStyle) => number |
Px the SVG export reserves left of the track for svgSidebar, measured in the export's text. |
rowColorFor(choice: string) => RowColorSetting |
The rows.color object choice starts from (startingRowColor): the current object's where it shows that choice, else the config's. |
orderDropsRowTree(order: readonly string[]) => boolean |
Whether ordering the rows as order drops the tree: one a reorder rotates drops only for an order no rotation of it lists, and any other drops for any change. |
rowOrderWillDropTree(next: readonly { name: string; }[]) => boolean |
Whether the arrangement dialog's submit of next drops the tree: an order that moves no row is not written, so it drops nothing. |
unreadFilterFieldNotice(field: string, record: string) => string |
The notice for a top-level filter field no loaded record carries: where a row carries it, a pointer at rows.filter, which keeps rows by their attributes, where the top-level filter tests records. |
rowAnnotationNotices(height: number) => string[] |
The lines for the corner notice about rows.annotations on a track height px tall (rowAnnotationNotices): an entry on a field no row carries, one on mostly distinct numbers, and column labels taking more than half the track. |
Actions
| Member | Description |
|---|---|
setShowTree(arg: boolean) => void |
|
setShowBranchLength(arg: boolean) => void |
|
setShowRowLabels(arg: boolean) => void |
|
setTreeAreaWidth(width: number) => void |
|
setRunClustering(arg?: boolean) => void |
|
setClusterRegion(arg?: string) => void |
|
setSortRowsBy(arg?: RowSortSpec) => void |
Trigger (or clear) a one-shot declarative row sort; consumed and reset by setupRowSortAutorun. |
setHoveredTreeNode(node?: HoveredTreeNode) => void |
|
setTreeCanvasRef(ref: HTMLCanvasElement | null) => void |
|
setMouseoverCanvasRef(ref: HTMLCanvasElement | null) => void |
|
setRowOrder(rows: readonly { name: string; }[], run?: ClusterRun) => void |
Arrange the rows in rows' order, ahead of any name the current order has that rows does not. A clustering run passes its result, and the tree and its provenance land with the order; any other reorder that moves a row drops the tree, which no longer describes it. |
setRowLabels(labels: Readonly<Record<string, string>>) => void |
The labels drawn in place of row names, whole: a row the map does not name shows the name it arrived with. |
setRowFocus(names?: readonly string[]) => void |
Narrow the display to names, or show every row again. |
showAllRows() => void |
The chip's "Show all": clears rows.kept and returns rows.filter to the config's, so a filter the config states shows through. |
applyRowEdits(rows: readonly S[], { color, colors }?: RowColorEdits) => void |
The arrangement dialog's submit: the rows in their new order, each with the label the reader left on it, and the colors the dialog shows, rows.colors and rows.color, each written where it differs from the config's. The labels go to rows by the rule labelEdits states, and the order to rows.sort unless it moves no row, so a submit that changes nothing writes nothing. |
resetRowArrangement() => void |
Return every arrangement member — order, labels, colors, tree, provenance, kept rows and rows.filter — to what the config declares, leaving rows.field, and rows.color to rowColorResetTarget: the config's for the choice, which stays. On another field than the config's, the members naming rows clear instead, since the config's name the old field's rows. |
setRowColorChoice(choice: string) => void |
Color the rows by choice, as a menu picks it: '' for None, name for Each row, or a field, starting from rowColorFor. The pins stay under every choice. A pick of the current choice writes nothing. |
focusLegendEntry(scaleId: string, value: string) => void |
LegendHost's hook: a click on a row color key entry narrows the rows to those it lists that rows.filter admits, so the focus names no row the filter would hide. Every other scale's entries name colors, not rows, and stay inert. |
Related links
- Tutorial: LD at a selective sweep (human)