@jbrowse/core 5.0.0-beta.10 → 5.0.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +210 -80
  2. package/esm/BaseFeatureWidget/BaseFeatureDetail/ArrayValue.js +0 -2
  3. package/esm/BaseFeatureWidget/BaseFeatureDetail/Attributes.d.ts +3 -0
  4. package/esm/BaseFeatureWidget/BaseFeatureDetail/Attributes.js +14 -1
  5. package/esm/BaseFeatureWidget/BaseFeatureDetail/BasicValue.js +22 -6
  6. package/esm/BaseFeatureWidget/BaseFeatureDetail/jexlFilterActions.js +3 -4
  7. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.d.ts +2 -0
  8. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.js +5 -5
  9. package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.js +1 -1
  10. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/FeatureSequenceDialog.d.ts +3 -1
  11. package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/FeatureSequenceDialog.js +2 -2
  12. package/esm/BaseFeatureWidget/SequenceFeatureDetails/featureTypeUtil.d.ts +2 -1
  13. package/esm/BaseFeatureWidget/SequenceFeatureDetails/featureTypeUtil.js +7 -14
  14. package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.js +3 -3
  15. package/esm/BaseFeatureWidget/SequenceFeatureDetails/useSequenceData.js +8 -5
  16. package/esm/BaseFeatureWidget/stateModelFactory.d.ts +7 -0
  17. package/esm/BaseFeatureWidget/stateModelFactory.js +11 -0
  18. package/esm/BaseFeatureWidget/types.d.ts +2 -0
  19. package/esm/CorePlugin.js +32 -1
  20. package/esm/PluginManager.d.ts +6 -3
  21. package/esm/PluginManager.js +6 -3
  22. package/esm/ReExports/coreModules.generated.js +291 -283
  23. package/esm/ReExports/coreWorkerModules.generated.js +288 -281
  24. package/esm/ReExports/list.js +10 -2
  25. package/esm/TextSearch/TextSearchManager.d.ts +3 -3
  26. package/esm/TextSearch/TextSearchManager.js +6 -13
  27. package/esm/configuration/configurationSchema.d.ts +33 -95
  28. package/esm/configuration/configurationSchema.js +50 -218
  29. package/esm/configuration/configurationSlot.d.ts +18 -64
  30. package/esm/configuration/configurationSlot.js +31 -97
  31. package/esm/configuration/formatDetailsConfigSchema.js +2 -0
  32. package/esm/configuration/getConf.d.ts +7 -36
  33. package/esm/configuration/getConf.js +7 -37
  34. package/esm/configuration/index.d.ts +5 -2
  35. package/esm/configuration/index.js +3 -1
  36. package/esm/configuration/partitionAdvanced.d.ts +12 -0
  37. package/esm/configuration/partitionAdvanced.js +42 -0
  38. package/esm/configuration/plot.d.ts +67 -0
  39. package/esm/configuration/plot.js +175 -0
  40. package/esm/configuration/readConfObject.d.ts +15 -17
  41. package/esm/configuration/readConfObject.js +19 -50
  42. package/esm/configuration/schemaTypes.js +5 -1
  43. package/esm/configuration/snapshotPreprocess.js +1 -3
  44. package/esm/configuration/types.d.ts +60 -159
  45. package/esm/pluggableElementTypes/DisplayType.d.ts +14 -0
  46. package/esm/pluggableElementTypes/DisplayType.js +13 -0
  47. package/esm/pluggableElementTypes/RpcMethodType.d.ts +7 -0
  48. package/esm/pluggableElementTypes/RpcMethodType.js +9 -0
  49. package/esm/pluggableElementTypes/WidgetType.d.ts +6 -0
  50. package/esm/pluggableElementTypes/WidgetType.js +6 -0
  51. package/esm/pluggableElementTypes/addMenuItems.d.ts +2 -1
  52. package/esm/pluggableElementTypes/addMenuItems.js +2 -1
  53. package/esm/pluggableElementTypes/index.js +1 -8
  54. package/esm/pluggableElementTypes/models/BaseDisplayModel.d.ts +58 -1
  55. package/esm/pluggableElementTypes/models/BaseDisplayModel.js +84 -2
  56. package/esm/pluggableElementTypes/models/BaseTrackModel.d.ts +2 -4
  57. package/esm/pluggableElementTypes/models/BaseTrackModel.js +2 -4
  58. package/esm/pluggableElementTypes/models/BaseViewModel.d.ts +2 -2
  59. package/esm/pluggableElementTypes/models/BaseViewModel.js +1 -1
  60. package/esm/pluggableElementTypes/models/baseTrackConfig.js +3 -0
  61. package/esm/rpc/RpcRegistry.d.ts +2 -1
  62. package/esm/rpc/byteBudget.d.ts +7 -0
  63. package/esm/rpc/byteBudget.js +10 -0
  64. package/esm/rpc/coreRpcMethods.d.ts +1 -1
  65. package/esm/rpc/coreRpcMethods.js +1 -1
  66. package/esm/rpc/explainTransferError.js +3 -3
  67. package/esm/rpc/methods/CoreLoadTrackCode.d.ts +17 -0
  68. package/esm/rpc/methods/CoreLoadTrackCode.js +24 -0
  69. package/esm/ui/AppLogo.js +43 -3
  70. package/esm/ui/JexlFilterDialog.d.ts +1 -1
  71. package/esm/ui/JexlFilterDialog.js +2 -3
  72. package/esm/ui/buildExtraTrackMenuItems.d.ts +2 -2
  73. package/esm/ui/colors.d.ts +41 -30
  74. package/esm/ui/colors.js +81 -44
  75. package/esm/ui/multiTrackMenuItems.d.ts +2 -2
  76. package/esm/util/TimeTraveller.d.ts +3 -0
  77. package/esm/util/TimeTraveller.js +34 -2
  78. package/esm/util/alignedBytes.d.ts +19 -0
  79. package/esm/util/alignedBytes.js +37 -0
  80. package/esm/util/analytics.d.ts +5 -6
  81. package/esm/util/analytics.js +5 -3
  82. package/esm/util/baseDisplayConfig.d.ts +8 -0
  83. package/esm/util/baseDisplayConfig.js +27 -0
  84. package/esm/util/bezierConnector.js +5 -1
  85. package/esm/util/cachedSetup.d.ts +16 -6
  86. package/esm/util/cachedSetup.js +108 -38
  87. package/esm/util/categoricalField.d.ts +23 -3
  88. package/esm/util/categoricalField.js +36 -3
  89. package/esm/util/cellMatches.d.ts +23 -0
  90. package/esm/util/cellMatches.js +264 -0
  91. package/esm/util/cellsStep.d.ts +27 -0
  92. package/esm/util/cellsStep.js +439 -0
  93. package/esm/util/color-bits/parse.js +22 -11
  94. package/esm/util/colorRamp.js +6 -0
  95. package/esm/util/colorScale.d.ts +9 -2
  96. package/esm/util/colorScale.js +33 -2
  97. package/esm/util/colorSchemes.d.ts +4 -2
  98. package/esm/util/colorSchemes.js +4 -1
  99. package/esm/util/copyToClipboard.js +8 -1
  100. package/esm/util/createAbortRotation.js +3 -3
  101. package/esm/util/featureTransforms.d.ts +7 -6
  102. package/esm/util/featureTransforms.js +131 -479
  103. package/esm/util/fetchPhases.d.ts +1 -1
  104. package/esm/util/formatBytes.js +1 -1
  105. package/esm/util/formatGuessers.d.ts +25 -14
  106. package/esm/util/formatGuessers.js +42 -27
  107. package/esm/util/formatRelativeTime.js +1 -1
  108. package/esm/util/getLocationUri.d.ts +2 -1
  109. package/esm/util/getLocationUri.js +8 -2
  110. package/esm/util/groupKeys.d.ts +4 -5
  111. package/esm/util/groupKeys.js +7 -6
  112. package/esm/util/intervals.js +9 -4
  113. package/esm/util/io/index.js +3 -1
  114. package/esm/util/isoformRank.d.ts +39 -0
  115. package/esm/util/isoformRank.js +118 -0
  116. package/esm/util/jexlFilters.d.ts +31 -49
  117. package/esm/util/jexlFilters.js +29 -39
  118. package/esm/util/locString.js +5 -2
  119. package/esm/util/markEncoding.js +48 -8
  120. package/esm/util/markEncodingTypes.d.ts +11 -2
  121. package/esm/util/quantileExtent.d.ts +22 -0
  122. package/esm/util/quantileExtent.js +24 -1
  123. package/esm/util/springAnimate.js +1 -1
  124. package/esm/util/stepTables.d.ts +14 -0
  125. package/esm/util/stepTables.js +38 -4
  126. package/esm/util/systemColorScheme.d.ts +4 -0
  127. package/esm/util/systemColorScheme.js +21 -0
  128. package/esm/util/tabix.d.ts +7 -3
  129. package/esm/util/tabix.js +3 -3
  130. package/esm/util/temporaryAssembly.d.ts +2 -2
  131. package/esm/util/temporaryAssembly.js +2 -3
  132. package/esm/util/trackConfigDelta.d.ts +1 -1
  133. package/esm/util/tracks.d.ts +28 -45
  134. package/esm/util/tracks.js +71 -82
  135. package/esm/util/types/index.d.ts +15 -7
  136. package/esm/util/types/index.js +21 -2
  137. package/esm/util/unknownSnapshotKeys.d.ts +3 -1
  138. package/esm/util/unknownSnapshotKeys.js +5 -11
  139. package/esm/util/usePanZoom.js +10 -3
  140. package/esm/util/useRafCommit.js +1 -0
  141. package/esm/util/useRowVirtualScroll.d.ts +1 -0
  142. package/esm/util/withFeatureDetails.js +4 -0
  143. package/package.json +13 -9
  144. package/esm/rpc/methods/CoreLoadAdapterCode.d.ts +0 -13
  145. package/esm/rpc/methods/CoreLoadAdapterCode.js +0 -16
package/README.md CHANGED
@@ -99,6 +99,19 @@ historically drifted.
99
99
 
100
100
  [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/bandLayout.ts)
101
101
 
102
+ ### baseDisplayConfig
103
+
104
+ The base's entry for this display, hydrated, which a reset returns to and "is
105
+ this the reader's" compares against: the config.json's, or the one a track the
106
+ session owns was added with; empty in a session that keeps no base.
107
+
108
+ ```js
109
+ // type signature
110
+ (self: object) => Record<string, unknown>
111
+ ```
112
+
113
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/baseDisplayConfig.ts)
114
+
102
115
  ### BinStep
103
116
 
104
117
  Place every feature in a genome-aligned bin of `step` bp, writing the bin's
@@ -222,11 +235,13 @@ a refName.
222
235
  ### categoricalField
223
236
 
224
237
  `labels` names the `domain`'s values in a key, one each in order, where a config
225
- spells them for a reader rather than as the data does.
238
+ spells them for a reader rather than as the data does. `held` deals each key the
239
+ domain does not list a color of its own on first sight (`categoricalScale`); the
240
+ caller keeps it for as long as the colors should hold.
226
241
 
227
242
  ```js
228
243
  // type signature
229
- (field: string, {…}?: { domain?: readonly string[] | undefined; range?: readonly string[] | undefined; labels?: readonly string[] | undefined; }) => CategoricalField
244
+ (field: string, {…}?: {…}) => CategoricalField
230
245
  ```
231
246
 
232
247
  [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/categoricalField.ts)
@@ -237,7 +252,9 @@ One categorical field as every channel reads it — a facet's sections, a color'
237
252
  range entries, a key's rows. `key` files a value, `compare` orders keys (the
238
253
  `domain` first, the rest by `compareGroupKeys`, `''` after them), `label` names
239
254
  a key in a legend, `sectionLabel` on a chip, and `color` paints it. A key's
240
- color depends only on the key and the declaration, so every region agrees on it.
255
+ color depends only on the key and the declaration, so every region agrees on it,
256
+ except that a field dealing its colors (`categoricalField`'s `held`) also steps
257
+ a key off the colors of the keys met before it.
241
258
 
242
259
  [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/categoricalField.ts)
243
260
 
@@ -330,7 +347,9 @@ matplotlib's perceptual ramps, dark at the low end; `juicebox` fades from
330
347
  transparent to red, as Juicebox paints contacts; `fall` runs white through
331
348
  yellow and red to black, as HiGlass does; `reds` and `blues` are ColorBrewer's,
332
349
  from white; `redblue` and `purpleorange` diverge through white, ColorBrewer's
333
- RdBu and PuOr.
350
+ RdBu and PuOr; `redgreyblue` diverges through a grey middle, which stays visible
351
+ on a white page where a white middle would not, as the MAF display's identity
352
+ ramp paints it.
334
353
 
335
354
  ```js
336
355
  // type signature
@@ -344,7 +363,8 @@ readonly[
344
363
  'reds',
345
364
  'blues',
346
365
  'redblue',
347
- 'purpleorange')
366
+ 'purpleorange',
367
+ 'redgreyblue')
348
368
  ]
349
369
  ```
350
370
 
@@ -479,7 +499,9 @@ ramp is `range`'s CSS colours, evenly spaced, where it lists any, else the named
479
499
 
480
500
  Replace the features with runs of constant depth: how many of them overlap each
481
501
  stretch of the region, in a field `as` (`coverage` by default), with the
482
- stretches nothing overlaps left out.
502
+ stretches nothing overlaps left out. A read counts across its whole span,
503
+ deletions and introns included; gap-aware depth stays the alignments display's
504
+ (ADR-118).
483
505
 
484
506
  [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/markEncodingTypes.ts)
485
507
 
@@ -490,11 +512,24 @@ siblings do, juicebox, fall, reds and blues do not.
490
512
 
491
513
  ```js
492
514
  // type signature
493
- (scheme: "blues" | "cividis" | "fall" | "inferno" | "juicebox" | "magma" | "purpleorange" | "redblue" | "reds" | "viridis") => boolean
515
+ (scheme: "blues" | "cividis" | "fall" | "inferno" | "juicebox" | "magma" | "purpleorange" | "redblue" | "redgreyblue" | "reds" | "viridis") => boolean
494
516
  ```
495
517
 
496
518
  [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/colorRamp.ts)
497
519
 
520
+ ### dealKeyColors
521
+
522
+ Deals `keys` their colours in `field.compare` order, so the colours a set of
523
+ keys first seen together takes do not depend on the order they arrive in. A
524
+ no-op for a field that deals nothing.
525
+
526
+ ```js
527
+ // type signature
528
+ (field: CategoricalField, keys: Iterable<string>) => void
529
+ ```
530
+
531
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/categoricalField.ts)
532
+
498
533
  ### DEFAULT_COLOR_SCHEME
499
534
 
500
535
  The ramp a continuous scale samples while it names no `range` and no `scheme`,
@@ -510,6 +545,7 @@ so a declaration spelling it out and one leaving it unset resolve alike.
510
545
  'magma' |
511
546
  'purpleorange' |
512
547
  'redblue' |
548
+ 'redgreyblue' |
513
549
  'reds' |
514
550
  'viridis'
515
551
  ```
@@ -583,6 +619,18 @@ categorical over a `category` column per label.
583
619
 
584
620
  [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/markEncoding.ts)
585
621
 
622
+ ### evaluateForFeature
623
+
624
+ A config value as `feature` reads it: a `jexl:` callback evaluated against the
625
+ feature, anything else as written.
626
+
627
+ ```js
628
+ // type signature
629
+ (value: unknown, feature: Feature, jexl: JexlInstance) => unknown
630
+ ```
631
+
632
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/configuration/readConfObject.ts)
633
+
586
634
  ### FacetedLayer
587
635
 
588
636
  One layer of a faceted request: its rows in section order, and the stacked row
@@ -647,6 +695,23 @@ the hover.
647
695
 
648
696
  [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/featureTable.ts)
649
697
 
698
+ ### fenceOutliers
699
+
700
+ Where a value axis's open ends stand below a `domainQuantile` of 1: at the
701
+ `extremes`, unless one would stretch the axis past twice the span the
702
+ quantileExtent ends `quantiles` draw, 0 included where the axis reaches it
703
+ (`zero`); that end stops at the fence. So a plot with no spike shows every value
704
+ and cuts none, and a spike leaves the values under it at least half the axis.
705
+ Quantiles that meet span their own size, as a flat domain widens in
706
+ `getNiceDomain`.
707
+
708
+ ```js
709
+ // type signature
710
+ ({ extremes, quantiles, zero, }: { extremes: readonly [number, number]; quantiles: readonly [number, number]; zero: boolean; }) => [number, number]
711
+ ```
712
+
713
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/quantileExtent.ts)
714
+
650
715
  ### fieldReader
651
716
 
652
717
  What a channel reads off a feature: a field by name, a dotted path into a
@@ -743,15 +808,8 @@ mate must drop both rather than treat `<DEL>` as a refName.
743
808
 
744
809
  ### getConf
745
810
 
746
- Reads a configuration value from a state model that has a `.configuration`
747
- member (a track or display state model). For a raw configuration model, use
748
- `readConfObject` instead.
749
-
750
- **This is exactly `readConfObject(model.configuration, path)`** — sugar for the
751
- `.configuration` hop, and nothing more. The two readers carry the same slot-name
752
- check, so reaching for the other one does not get a typo past tsc. It does not
753
- consult the session and has no per-slot behavior; what you read is what the
754
- track stores.
811
+ Reads a configuration value from a track or display state model: exactly
812
+ `readConfObject(model.configuration, path)`, with the same slot-name check.
755
813
 
756
814
  ```js
757
815
  // type signature
@@ -888,6 +946,18 @@ module actually uses.
888
946
 
889
947
  [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/sessionServices.ts)
890
948
 
949
+ ### heldSlotsOf
950
+
951
+ The `HeldSlots` `owner` keeps under `key`, made empty on first ask. Lives as
952
+ long as `owner` and is never persisted, so a reload deals afresh.
953
+
954
+ ```js
955
+ // type signature
956
+ (owner: object, key: string) => HeldSlots
957
+ ```
958
+
959
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/categoricalField.ts)
960
+
891
961
  ### HitIndexed
892
962
 
893
963
  An encoded payload as a display stores it: the hit index the worker built with
@@ -909,27 +979,15 @@ at 0 for a mark with no value.
909
979
 
910
980
  ### hydrateTrackConfig
911
981
 
912
- Hydrate a plain track config into a live config node, dispatching on its `type`
913
- to find the schema. `session.tracks` holds `types.frozen` plain objects until
914
- something references a track (ADR-031). One of those holds only what was
915
- literally authored: a slot at its schema default is absent, `preProcessSnapshot`
916
- has not run, and nothing that walks a live node applies to it.
917
-
918
- Use it where a caller needs the resolved config and may be handed either form.
919
- The About dialog's "Copy config" is reached from two menus, and one of them
920
- passes a `session.tracks` entry.
982
+ Hydrate a plain track config, such as a `session.tracks` entry, into a live
983
+ config node, dispatching on its `type` to find the schema. A plain entry holds
984
+ only what was authored: a slot at its default is absent and `preProcessSnapshot`
985
+ has not run.
921
986
 
922
- Returns **undefined** when the config names a track type no plugin registered,
923
- or when `create` rejects it as invalid. An un-hydrated config has never been
924
- validated, so the dialog opening over it should not throw. Callers fall back to
925
- using the plain object.
926
-
927
- Shares `TrackConfigurationReference`'s per-PluginManager cache, so hydrating the
928
- same entry twice returns the same node, and in an admin session a track opened
929
- later resolves to that same node. A non-admin's open track resolves to the
930
- session's private working copy (ADR-032), and this function returns the pristine
931
- mirror beside it. The two have the same content; `CopyConfigEntryPoints.test.ts`
932
- tests both cases.
987
+ Returns **undefined** when no plugin registered the type or `create` rejects the
988
+ config, which has never been validated; callers fall back to the plain object.
989
+ Hydrating one entry twice returns one node. A shown track resolves to the
990
+ session's working copy instead (ADR-032), which has the same content.
933
991
 
934
992
  ```js
935
993
  // type signature
@@ -1057,6 +1115,22 @@ steps that follow it read the rows already in section order.
1057
1115
 
1058
1116
  [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/featureTransforms.ts)
1059
1117
 
1118
+ ### liftPlot
1119
+
1120
+ A draft as the display's config would hold it, through the schema's own lift and
1121
+ checks: a shorthand becomes its object, a default falls off, and what a config
1122
+ file is refused for throws, a key outside the plot included. The node is never
1123
+ attached, so nothing on the display is touched; a display reads its typed
1124
+ members off it. The draft is copied first, since MST freezes what it creates
1125
+ from.
1126
+
1127
+ ```js
1128
+ // type signature
1129
+ (conf: AnyConfigurationModel, draft: Plot) => AnyConfigurationModel
1130
+ ```
1131
+
1132
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/configuration/plot.ts)
1133
+
1060
1134
  ### ListColumn
1061
1135
 
1062
1136
  A list of rows per row: row `i`'s entries are the rows of `entries` from
@@ -1123,14 +1197,15 @@ the worker.
1123
1197
  ### matedBy
1124
1198
 
1125
1199
  How a record states its other end, or undefined where it states none: the `mate`
1126
- a paired adapter fills (BEDPE, STAR-Fusion), or an `ALT` the breakend and
1127
- symbolic-SV readers resolve. The `mate` step admits exactly the features this
1128
- names one for, so a caller deciding whether links are the picture a track wants
1129
- asks here rather than re-reading the fields.
1200
+ a paired adapter fills (BEDPE, STAR-Fusion), an `ALT` the breakend and
1201
+ symbolic-SV readers resolve, or a read's `next_ref` and `next_pos`. The `mate`
1202
+ step admits exactly the features this names one for, so a caller deciding
1203
+ whether links are the picture a track wants asks here rather than re-reading the
1204
+ fields.
1130
1205
 
1131
1206
  ```js
1132
1207
  // type signature
1133
- (f: Feature) => "alt" | "mate" | undefined
1208
+ (f: Feature) => "alt" | "mate" | "pair" | undefined
1134
1209
  ```
1135
1210
 
1136
1211
  [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/featureTransforms.ts)
@@ -1228,6 +1303,18 @@ every comparison against it declines.
1228
1303
 
1229
1304
  [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/thresholdScale.ts)
1230
1305
 
1306
+ ### parsePlot
1307
+
1308
+ The text as a plot, refusing a key the display's plot does not hold. The schema
1309
+ is the parser past this point.
1310
+
1311
+ ```js
1312
+ // type signature
1313
+ (text: string, keys: readonly string[]) => Plot
1314
+ ```
1315
+
1316
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/configuration/plot.ts)
1317
+
1231
1318
  ### parseSvAlt
1232
1319
 
1233
1320
  Parse raw (non-assembly-resolved) mate coordinates from a VCF SV feature+alt.
@@ -1253,6 +1340,72 @@ packs each section on its own.
1253
1340
 
1254
1341
  [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/util/markEncodingTypes.ts)
1255
1342
 
1343
+ ### Plot
1344
+
1345
+ A display's plot settings as written: a key left out is left alone, and `null`
1346
+ resets that setting. Untyped, since a value may be a shorthand the schema lifts,
1347
+ and the schema is what judges it.
1348
+
1349
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/configuration/plot.ts)
1350
+
1351
+ ### PLOT_VOCABULARY
1352
+
1353
+ The grammar's settings, by the slot name every display that has one gives it,
1354
+ and what each holds: what "Edit plot..." shows and an agent reads as a display's
1355
+ `plot`. A display's plot is the ones its config declares (`plotKeysOf`).
1356
+
1357
+ ```js
1358
+ // type signature
1359
+ Readonly<Record<string, string>>
1360
+ ```
1361
+
1362
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/configuration/plot.ts)
1363
+
1364
+ ### PlotExample
1365
+
1366
+ A worked example of a display's plot: the text it fills the editor with, and
1367
+ what it does.
1368
+
1369
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/configuration/plot.ts)
1370
+
1371
+ ### plotKeysOf
1372
+
1373
+ The plot keys a display config declares.
1374
+
1375
+ ```js
1376
+ // type signature
1377
+ (conf: AnyConfigurationModel) => string[]
1378
+ ```
1379
+
1380
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/configuration/plot.ts)
1381
+
1382
+ ### plotOf
1383
+
1384
+ A display's plot as declared, defaults left off. A list sitting at a default it
1385
+ shares with no other display, a default plot's marks, shows its entries, since
1386
+ they are what is drawn.
1387
+
1388
+ ```js
1389
+ // type signature
1390
+ (conf: AnyConfigurationModel) => Plot
1391
+ ```
1392
+
1393
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/configuration/plot.ts)
1394
+
1395
+ ### plotWrites
1396
+
1397
+ What applying a draft writes: each setting whose lifted value differs from the
1398
+ plot, as the lifted value, and `null` for one it resets. A value spelled another
1399
+ way but lifting to the same setting writes nothing. Throws a refusal before
1400
+ anything is written.
1401
+
1402
+ ```js
1403
+ // type signature
1404
+ (conf: AnyConfigurationModel, draft: Plot) => Record<string, unknown>
1405
+ ```
1406
+
1407
+ [Source code](https://github.com/GMOD/jbrowse-components/blob/main/packages/core/src/configuration/plot.ts)
1408
+
1256
1409
  ### preProcessConfigSnapshot
1257
1410
 
1258
1411
  A snapshot as `type` admits it: the same lift and checks `type.create` applies,
@@ -1276,6 +1429,11 @@ it itself. Under 0.5 reads as 0.5, where the ends meet rather than cross.
1276
1429
  `scales.y.domainQuantile` and a colour's `domainQuantile` both name it.
1277
1430
  `[Infinity, -Infinity]` where nothing is finite.
1278
1431
 
1432
+ Nearest rank keeps ties: where one value holds the rank, as on a segmented
1433
+ copy-number track, a ramp clipped below 1 paints nearly every value one colour.
1434
+ A value axis fences instead (fenceOutliers); a ramp takes the same fence once a
1435
+ colour default below 1 meets tied data.
1436
+
1279
1437
  ```js
1280
1438
  // type signature
1281
1439
  (values: ArrayLike<number>, count: number, quantile?: number) => [number, number]
@@ -1358,20 +1516,13 @@ widened domain with no table baked again.
1358
1516
 
1359
1517
  ### readConfObject
1360
1518
 
1361
- Given a configuration model (an instance of a ConfigurationSchema), read the
1362
- configuration value at the given path. Use this when you hold the configuration
1363
- model directly, e.g. an entry from `session.tracks`.
1364
-
1365
- Wants a **live config node**, not a snapshot of one, and passing a snapshot is a
1366
- type error. Slots are built with `types.stripDefault`, so a slot sitting at its
1367
- default is absent from a snapshot — "unset" and "at its default" are
1368
- indistinguishable there, and a read off one reports a default as missing.
1519
+ Read the value at a path of a live config node, such as a track's
1520
+ `configuration`, evaluating a `jexl:` callback with `args`.
1369
1521
 
1370
- That is enforced in the types only, deliberately: it can't be a runtime check.
1371
- `generateHierarchy` reads slots straight off the **un-hydrated frozen** entries
1372
- of `jbrowse.tracks` on purpose, because hydrating every track to answer the
1373
- track selector is what `types.frozen` exists to avoid — and those reads are
1374
- indistinguishable at runtime from the broken spelling.
1522
+ A snapshot is refused by the types, since a slot at its default is absent from
1523
+ one. A `session.tracks` entry is one (`TrackConfigEntry`): read its `trackId`
1524
+ and `type` directly, and a slot through a helper that supplies the default, such
1525
+ as `getConfAssemblyNamesOrNone`.
1375
1526
 
1376
1527
  ```js
1377
1528
  // type signature
@@ -1653,32 +1804,11 @@ array naming a sub-schema's member at any depth —
1653
1804
  `setConf(self, ['scales', 'y', 'domainMin'], 5)`. Takes the display or track
1654
1805
  model, or a config node directly.
1655
1806
 
1656
- **The path length says what the write replaces.** A path ending on a slot writes
1657
- that slot and leaves the object around it alone; a path ending on a sub-schema
1658
- replaces the whole object, which is how a channel whose members move together —
1659
- a facet's field and the domain that field's values order — gets written without
1660
- a stale member surviving underneath.
1661
-
1662
- **Prefer this over a bare `self.configuration.setSlot('x', v)`.** The constraint
1663
- here mirrors `getConf`'s, so on a model with a concrete schema an unknown slot
1664
- name is a compile error. `setSlot` itself stays untyped on purpose — the config
1665
- editor's slot facade routes dynamic slot names through it
1666
- (`configurationSchema.ts`) — and guards the name at runtime instead (ADR-052),
1667
- so a misspelled write is diagnosed one way or the other.
1668
-
1669
- **The read is the half with no diagnostic at all.** `getConf` for a name the
1670
- schema doesn't declare returns `undefined` and reports nothing, at any layer, so
1671
- the slot keeps reading as its default forever. Which makes the compile-time
1672
- constraint worth keeping _reachable_: it is only as good as the schema of the
1673
- holder handed in, and a holder widened to `AnyConfigurationModel` switches it
1674
- off entirely — the trap a mixin casting to reach its host walks into. Every such
1675
- cast names a concrete schema instead (`ConfigModelForFields`, or the base schema
1676
- when the slot is the base's), and `HostChecksSlotNames` pins each one.
1677
-
1678
- A wrong _value_ type still throws at runtime (MST type-checks the assignment)
1679
- rather than at compile time. `value` is deliberately `unknown` because
1680
- `undefined` is a legitimate write — it resets a slot to its schema default — and
1681
- the declared slot value type doesn't include it.
1807
+ A path ending on a slot writes that slot; one ending on a sub-schema replaces
1808
+ the whole object, so a channel's members (a facet's field and its domain) move
1809
+ together. On a concrete schema an unknown slot name is a compile error, and
1810
+ `setSlot` refuses one at runtime (ADR-052). A wrong value type throws at
1811
+ runtime; `null` or `undefined` resets the slot to its default (ADR-146).
1682
1812
 
1683
1813
  ```js
1684
1814
  // type signature
@@ -18,11 +18,9 @@ const useStyles = makeStyles()(theme => ({
18
18
  },
19
19
  fieldSubvalue: {
20
20
  wordBreak: 'break-word',
21
- maxHeight: 300,
22
21
  padding: theme.spacing(0.5),
23
22
  border: `1px solid ${theme.palette.action.selected}`,
24
23
  boxSizing: 'border-box',
25
- overflow: 'auto',
26
24
  },
27
25
  }));
28
26
  /**
@@ -1,4 +1,7 @@
1
1
  import type { Descriptors, FeatureFormatter, FieldActions } from '../types.tsx';
2
+ export declare function withoutLocations(attributes: Record<string, unknown>): Record<string, unknown>;
3
+ /** Whether `Attributes` given these `attributes` and `omit` draws any row. */
4
+ export declare function hasAttributeRows(attributes: Record<string, unknown>, omit?: string[]): boolean;
2
5
  export default function Attributes(props: {
3
6
  attributes: Record<string, unknown>;
4
7
  omit?: string[];
@@ -51,7 +51,7 @@ function isLocation(value) {
51
51
  }
52
52
  // hideUris prunes the data rather than each render branch checking: an array
53
53
  // of objects reaches the data grid and ArrayValue, which print locations too
54
- function withoutLocations(attributes) {
54
+ export function withoutLocations(attributes) {
55
55
  return Object.fromEntries(Object.entries(attributes)
56
56
  .filter(([, value]) => !isLocation(value))
57
57
  .map(([key, value]) => [key, valueWithoutLocations(value)]));
@@ -103,6 +103,19 @@ function measureLabels(attributes, opts) {
103
103
  }
104
104
  return widest;
105
105
  }
106
+ /** Whether `Attributes` given these `attributes` and `omit` draws any row. */
107
+ export function hasAttributeRows(attributes, omit = []) {
108
+ const omits = new Set([...omit, ...globalOmit]);
109
+ return Object.entries(attributes).some(([key, value]) => value == null || omits.has(key)
110
+ ? false
111
+ : Array.isArray(value)
112
+ ? isHomogeneousObjectArray(value) ||
113
+ !isObjectArray(value) ||
114
+ value.some(entry => hasAttributeRows(entry))
115
+ : isObject(value)
116
+ ? isUriLocation(value) || hasAttributeRows(value, omit)
117
+ : true);
118
+ }
106
119
  function widestLabel(attributes, opts) {
107
120
  return Math.ceil(measureLabels(attributes, opts)) + FIELD_NAME_PADDING;
108
121
  }
@@ -1,16 +1,27 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { isValidElement } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { isValidElement, useState } from 'react';
3
3
  import { Link } from '@mui/material';
4
4
  import { SanitizedHTML } from '../../ui/index.js';
5
5
  import { isObject } from '../../util/index.js';
6
6
  import { makeStyles } from '../../util/tss-react/index.js';
7
+ import useMeasure from '../../util/useMeasure.js';
8
+ const CLAMP_HEIGHT = 300;
7
9
  const useStyles = makeStyles()(theme => ({
8
10
  fieldValue: {
9
11
  wordBreak: 'break-word',
10
- maxHeight: 300,
11
12
  fontSize: 12,
12
13
  padding: theme.spacing(0.5),
13
- overflow: 'auto',
14
+ minWidth: 0,
15
+ },
16
+ clip: {
17
+ overflowX: 'auto',
18
+ overflowY: 'hidden',
19
+ },
20
+ clamped: {
21
+ maxHeight: CLAMP_HEIGHT,
22
+ },
23
+ faded: {
24
+ maskImage: 'linear-gradient(to bottom, black 75%, transparent)',
14
25
  },
15
26
  }));
16
27
  export function isBareUrl(text) {
@@ -29,6 +40,11 @@ export function ValueText({ text }) {
29
40
  return isBareUrl(text) ? (_jsx(Link, { href: text, target: "_blank", rel: "noopener noreferrer", children: text })) : (_jsx(SanitizedHTML, { html: text }));
30
41
  }
31
42
  export default function BasicValue({ value }) {
32
- const { classes } = useStyles();
33
- return (_jsx("div", { className: classes.fieldValue, children: isValidElement(value) ? value : _jsx(ValueText, { text: valueText(value) }) }));
43
+ const { classes, cx } = useStyles();
44
+ const [expanded, setExpanded] = useState(false);
45
+ const [ref, { height }] = useMeasure('height');
46
+ const overflows = height !== undefined && height > CLAMP_HEIGHT;
47
+ return (_jsxs("div", { className: classes.fieldValue, children: [_jsx("div", { className: cx(classes.clip, !expanded && classes.clamped, !expanded && overflows && classes.faded), children: _jsx("div", { ref: ref, children: isValidElement(value) ? (value) : (_jsx(ValueText, { text: valueText(value) })) }) }), overflows ? (_jsx(Link, { component: "button", variant: "caption", onClick: () => {
48
+ setExpanded(v => !v);
49
+ }, children: expanded ? 'Show less' : 'Show more' })) : null] }));
34
50
  }
@@ -1,5 +1,4 @@
1
1
  import { pathSubject, printCondition } from '@jbrowse/jexl';
2
- import { activeJexlFilters } from '../../util/jexlFilters.js';
3
2
  import { ensureJexlPrefix } from '../../util/jexlStrings.js';
4
3
  import { getNotificationSink } from '../../util/sessionServices.js';
5
4
  const MAX_LABEL_VALUE = 30;
@@ -26,17 +25,17 @@ export function filterByValueItems(display, path, value) {
26
25
  const text = String(value);
27
26
  const shown = text.length > MAX_LABEL_VALUE ? `${text.slice(0, MAX_LABEL_VALUE)}…` : text;
28
27
  const add = (op) => () => {
29
- const previous = display.filterSetting;
28
+ const previous = display.configuredFilters();
30
29
  const line = printCondition({
31
30
  subject: pathSubject('feature', path),
32
31
  op,
33
32
  value,
34
33
  });
35
- display.setFilter([...activeJexlFilters(display), ensureJexlPrefix(line)]);
34
+ display.setFilter([...previous, ensureJexlPrefix(line)]);
36
35
  getNotificationSink(display).notify('Filter added', 'info', {
37
36
  name: 'Undo',
38
37
  onClick: () => {
39
- display.setFilter(previous && [...previous]);
38
+ display.setFilter(previous);
40
39
  },
41
40
  });
42
41
  };
@@ -1,4 +1,5 @@
1
1
  import type { AbstractSessionModel, SimpleFeatureSerialized } from '../../util/index.ts';
2
+ import type { CanonicalTranscripts } from '../../util/isoformRank.ts';
2
3
  import type { SequenceFeatureDetailsModel, SequenceHoverTarget } from './model.ts';
3
4
  interface SequenceFeatureDetailsProps {
4
5
  model: SequenceFeatureDetailsModel;
@@ -7,6 +8,7 @@ interface SequenceFeatureDetailsProps {
7
8
  feature: SimpleFeatureSerialized;
8
9
  hoverTarget?: SequenceHoverTarget;
9
10
  showOpenInDialog?: boolean;
11
+ canonicalTranscripts?: CanonicalTranscripts;
10
12
  }
11
13
  declare function SequenceFeatureDetails(props: SequenceFeatureDetailsProps): import("react").JSX.Element;
12
14
  export default SequenceFeatureDetails;
@@ -10,15 +10,15 @@ import { useSequenceFetch } from './useSequenceFetch.js';
10
10
  // lazies
11
11
  const SequenceBody = lazy(() => import('./SequenceBody.js'));
12
12
  const SequenceDialog = lazy(() => import('./dialogs/SequenceDialog.js'));
13
- const SequenceFeatureDetailsPanel = observer(function SequenceFeatureDetailsPanel({ model, session, assemblyName, feature, hoverTarget, showOpenInDialog = true, }) {
13
+ const SequenceFeatureDetailsPanel = observer(function SequenceFeatureDetailsPanel({ model, session, assemblyName, feature, hoverTarget, showOpenInDialog = true, canonicalTranscripts, }) {
14
14
  const { upDownBp } = model;
15
15
  const seqPanelRef = useRef(null);
16
16
  // A container feature (e.g. a gene) has no CDS/exon of its own — one of its
17
- // transcript children does. Default to the longest-coding transcript so CDS
18
- // and Protein sequence types work without an extra click into Subfeatures,
19
- // with a selector to switch transcripts when the gene has more than one.
17
+ // transcript children does. Default to the transcript the track draws first
18
+ // so CDS and Protein sequence types work without an extra click into
19
+ // Subfeatures, with a selector to switch when the gene has more than one.
20
20
  const transcripts = getTranscripts(feature);
21
- const [transcriptIndex, setTranscriptIndex] = useState(() => pickDefaultTranscriptIndex(transcripts));
21
+ const [transcriptIndex, setTranscriptIndex] = useState(() => pickDefaultTranscriptIndex(transcripts, canonicalTranscripts));
22
22
  const effectiveFeature = transcripts[transcriptIndex] ?? feature;
23
23
  // mode and revcomp are per-panel state, not on the shared model, so each
24
24
  // subfeature panel (e.g. coding vs noncoding transcripts of one gene) picks
@@ -38,6 +38,6 @@ const SequenceFeaturePanel = observer(function SequenceFeaturePanel({ model, fea
38
38
  feature,
39
39
  viewAssemblyNames: model.view?.assemblyNames,
40
40
  assemblyManager: getSession(model).assemblyManager,
41
- }), feature: feature, hoverTarget: model }) })) : null] }));
41
+ }), feature: feature, hoverTarget: model, canonicalTranscripts: model.canonicalTranscripts }) })) : null] }));
42
42
  });
43
43
  export default SequenceFeaturePanel;
@@ -1,11 +1,13 @@
1
1
  import type { AbstractSessionModel, SimpleFeatureSerialized } from '../../../util/index.ts';
2
+ import type { CanonicalTranscripts } from '../../../util/isoformRank.ts';
2
3
  import type { SequenceHoverTarget } from '../model.ts';
3
- declare const FeatureSequenceDialog: ({ feature, error, session, assemblyName, hoverTarget, handleClose, }: {
4
+ declare const FeatureSequenceDialog: ({ feature, error, session, assemblyName, hoverTarget, canonicalTranscripts, handleClose, }: {
4
5
  feature: SimpleFeatureSerialized | undefined;
5
6
  error?: unknown;
6
7
  session: AbstractSessionModel;
7
8
  assemblyName: string | undefined;
8
9
  hoverTarget?: SequenceHoverTarget;
10
+ canonicalTranscripts?: CanonicalTranscripts;
9
11
  handleClose: () => void;
10
12
  }) => import("react").JSX.Element;
11
13
  export default FeatureSequenceDialog;
@@ -17,13 +17,13 @@ const useStyles = makeStyles()({
17
17
  // The settings model lives for as long as the dialog does: it holds no
18
18
  // snapshot and reads no tree, so nothing has to carry one around on the chance
19
19
  // a sequence panel is opened.
20
- const FeatureSequenceDialog = observer(function FeatureSequenceDialog({ feature, error, session, assemblyName, hoverTarget, handleClose, }) {
20
+ const FeatureSequenceDialog = observer(function FeatureSequenceDialog({ feature, error, session, assemblyName, hoverTarget, canonicalTranscripts, handleClose, }) {
21
21
  const { classes } = useStyles();
22
22
  const [model] = useState(() => SequenceFeatureDetailsF().create());
23
23
  return (_jsx(InfoDialog, { maxWidth: "xl", open: true, title: feature
24
24
  ? `Feature sequence - ${feature.name || feature.id || feature.type}`
25
25
  : 'Feature sequence', onClose: () => {
26
26
  handleClose();
27
- }, children: _jsx("div", { className: classes.content, children: error ? (_jsx(ErrorBanner, { error: error })) : feature ? (_jsx(SequenceFeatureDetails, { model: model, session: session, assemblyName: assemblyName, feature: feature, hoverTarget: hoverTarget, showOpenInDialog: false })) : (_jsx(LoadingEllipses, { message: "Loading feature" })) }) }));
27
+ }, children: _jsx("div", { className: classes.content, children: error ? (_jsx(ErrorBanner, { error: error })) : feature ? (_jsx(SequenceFeatureDetails, { model: model, session: session, assemblyName: assemblyName, feature: feature, hoverTarget: hoverTarget, showOpenInDialog: false, canonicalTranscripts: canonicalTranscripts })) : (_jsx(LoadingEllipses, { message: "Loading feature" })) }) }));
28
28
  });
29
29
  export default FeatureSequenceDialog;