TreeSidebarMixin
Auto-generated @jbrowse/mobx-state-tree API for the current JBrowse release — see pluggable elements for concepts. Built into JBrowse core. View source.
#crossCuttingMixin Row set with a dendrogram sidebar. sources (the display
rows, named), the three treeSidebarConfigSchemaFields slots, plus the run
callback naming its own clustering RPC and the sortRows callback naming what a
row carries at a column. Brings layout / clusterTree / clusterProvenance /
treeAreaWidth / subtreeFilter, the showTree / showBranchLength /
showRowLabels getters and setters over those slots, the runClustering /
clusterRegion and sortRowsBy declarative launch specs
setupTreeSidebarAutoruns consumes, the root, willClearTree and
rowOrderIsCustom getters, and the tree-hover and canvas-ref volatiles the
shared sidebar draws through Adds a dendrogram sidebar to a display: stores the
leaf layout, newick cluster tree, sidebar width and subtree filter, plus the
hover/canvas volatile state used while drawing the tree.
The three toggles are declared here because this package reads them.
treeSidebarGeometry reads showTree, treeMenuItems reads all three and
setShowTree, computeClusterHierarchy takes showBranchLength — so a display
composing this mixin and not supplying them would compile and then fail at the
first menu click. They were four hand-written getConf / setConf copies,
which is the same shape the config half was in before
treeSidebarConfigSchemaFields: that set had already drifted, three displays
spelling the labels toggle showRowLabels and the fourth showSidebarLabels,
so "showRowLabels": false on a multi-sample variant track was dropped in
silence. Slots and accessors now move together.
Properties
| Member | Description |
|---|---|
layoutlayout: types.stripDefault(types.frozen<S[]>(), []) | |
| clusterTree | |
| clusterProvenance | What clusterTree was computed from — the locus and the settings. Set only for a tree this app computed; a supplied phylogeny (maf's .nh) leaves it undefined. Persisted with the tree so it survives a session snapshot, which is the case that most needs it: a shared link otherwise hands over a dendrogram with no way to learn its locus. |
treeAreaWidthtreeAreaWidth: types.stripDefault(types.number, 80) | |
| subtreeFilter | |
runClusteringrunClustering: types.maybe(types.boolean) | 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.Lives here rather than on each display because it is the trigger for a run whose output — clusterTree, clusterProvenance, layout — is this mixin's state. Three displays declared it identically, each with its own wrapper module that existed to code-split the clustering code and, along the way, hand-wrote the same six-member duck type of the display. Splitting inside the run callback does the same job and loads on a run rather than on every attach. What each run actually is stays per display, in that callback. |
clusterRegionclusterRegion: types.maybe(types.string) | Where that run reads from, as a locstring (whitespace-separated for several). Clustering is region-scoped, so running it over the visible window feeds the estimator whatever happens to be on screen; naming the locus instead lets a session cluster on the signal and then show it against its context — otherwise a zoom the user has to perform in the right order. Cleared with runClustering, since it is that flag's argument and a locus left standing describes a run that is not coming. |
sortRowsBysortRowsBy: types.maybe(types.frozen<RowSortSpec>()) | Transient declarative launch spec, the same idea as runClustering: set {refName, pos} to order the rows once by the value each carries 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 layout persists but a saved session never re-sorts.Where clustering orders rows by the whole region in view and layout states an order outright, only this one says "rank them here", which is what lets a figure open a cohort ranked at a candidate locus with the surrounding context still on screen. What the value at the column is stays per display, in its sortRows callback. |
Volatiles
| Member | Description |
|---|---|
hoveredTreeNodehoveredTreeNode: undefined as HoveredTreeNode | undefined | |
treeCanvastreeCanvas: null as HTMLCanvasElement | null | |
mouseoverCanvasmouseoverCanvas: null as HTMLCanvasElement | null |
Getters
| Member | Description |
|---|---|
showTreeboolean | Whether the dendrogram sidebar is drawn. |
showBranchLengthboolean | Whether tree nodes are positioned by branch length (dendrogram) or evenly by topology (cladogram). |
showRowLabelsboolean | Whether each row's name is drawn over the left of the plot. |
parsedTreeHierarchyNode<NewickNode> | undefined | |
rootHierarchyNode<NewickNode> | undefined | |
treeHasBranchLengthsboolean | |
rowOrderIsCustomboolean | Whether the rows have been arranged away from the order they arrived in — what "Reset row order" is offered on. A written layout here; a display whose config seeds layout on load (the multi-sample variant displays' colorBy / groupBy) overrides it to compare against that seed, so the reset does not appear on a track nobody has touched. |
Methods
| Member | Description |
|---|---|
willClearTree(next: S[]) => boolean |
Actions
| Member | Description |
|---|---|
setShowTree(arg: boolean) => void | |
setShowBranchLength(arg: boolean) => void | |
setShowRowLabels(arg: boolean) => void | |
setLayout(layout: S[]) => void | |
clearLayout() => void | |
setClusterTree(tree?: string | undefined) => void | |
| setLayoutAndClusterTree | |
setTreeAreaWidth(width: number) => void | |
setSubtreeFilter(names?: string[] | undefined) => void | |
setRunClustering(arg?: boolean | undefined) => void | |
setClusterRegion(arg?: string | undefined) => void | |
setSortRowsBy(arg?: RowSortSpec | undefined) => void | Trigger (or clear) a one-shot declarative row sort; consumed and reset by setupRowSortAutorun. A display's right-click item calls its own sort directly (instant, the data is already loaded); this is the session-level entry point. |
setHoveredTreeNode(node?: HoveredTreeNode | undefined) => void | |
setTreeCanvasRef(ref: HTMLCanvasElement | null) => void | |
setMouseoverCanvasRef(ref: HTMLCanvasElement | null) => void |