jbrowse-plugin-graphgenomeviewer 10.4.0 → 10.4.2

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 (88) hide show
  1. package/dist/chunks/{AddTrackWorkflow-4S5QEZTJ.js → AddTrackWorkflow-P5APNL32.js} +2 -2
  2. package/dist/chunks/{GbzBaseSyntenyAdapter-64HUHYVC.js → GbzBaseSyntenyAdapter-46A4LMVD.js} +2 -2
  3. package/dist/chunks/{GbzBaseSyntenyAdapter-64HUHYVC.js.map → GbzBaseSyntenyAdapter-46A4LMVD.js.map} +1 -1
  4. package/dist/chunks/{GraphGenomeView-EGR7L5WT.js → GraphGenomeView-MXRAP7QB.js} +2 -2
  5. package/dist/chunks/GraphSettingsDialog-HIOYWTO7.js +2 -0
  6. package/dist/chunks/{HighlightColorDialog-FHRKHBDZ.js → HighlightColorDialog-UKFUS5S4.js} +2 -2
  7. package/dist/chunks/LinearGraphDisplay-KPWFPVFK.js +2 -0
  8. package/dist/chunks/{MinigraphBubbleAdapter-LQ2NYC6O.js → MinigraphBubbleAdapter-QSPPG4LG.js} +2 -2
  9. package/dist/chunks/{RgfaTabixAdapter-UM7L6HPH.js → RgfaTabixAdapter-UPCOXYVG.js} +2 -2
  10. package/dist/chunks/{WalkFormsAdapter-4D6MTHLE.js → WalkFormsAdapter-LHKGRYC6.js} +2 -2
  11. package/dist/chunks/{WalkTabixSyntenyAdapter-V5IQCHP4.js → WalkTabixSyntenyAdapter-ELTYD73I.js} +2 -2
  12. package/dist/chunks/{chunk-5KWWMR7X.js → chunk-2TMZO3P5.js} +2 -2
  13. package/dist/chunks/{chunk-HYQOBARI.js → chunk-43EUXRKZ.js} +2 -2
  14. package/dist/chunks/{chunk-HYQOBARI.js.map → chunk-43EUXRKZ.js.map} +1 -1
  15. package/dist/chunks/{chunk-L5HPUPUZ.js → chunk-4QYWBDUL.js} +2 -2
  16. package/dist/chunks/{chunk-L5HPUPUZ.js.map → chunk-4QYWBDUL.js.map} +1 -1
  17. package/dist/chunks/{chunk-LDY26KXZ.js → chunk-52BUFQHJ.js} +3 -3
  18. package/dist/chunks/{chunk-LDY26KXZ.js.map → chunk-52BUFQHJ.js.map} +2 -2
  19. package/dist/chunks/{chunk-ZMUXLTEP.js → chunk-5N4B6FEH.js} +2 -2
  20. package/dist/chunks/{chunk-2OH3T4CR.js → chunk-AC5KEN36.js} +2 -2
  21. package/dist/chunks/{chunk-2OH3T4CR.js.map → chunk-AC5KEN36.js.map} +1 -1
  22. package/dist/chunks/{chunk-QVQIHX2Y.js → chunk-BLE63OIT.js} +2 -2
  23. package/dist/chunks/{chunk-QVQIHX2Y.js.map → chunk-BLE63OIT.js.map} +3 -3
  24. package/dist/chunks/{chunk-55PR5XJY.js → chunk-DZXYOIGJ.js} +2 -2
  25. package/dist/chunks/{chunk-5CTDN4UC.js → chunk-E3GNTGWW.js} +1 -1
  26. package/dist/chunks/{chunk-5CTDN4UC.js.map → chunk-E3GNTGWW.js.map} +1 -1
  27. package/dist/chunks/{chunk-XXMAC5EP.js → chunk-E5ERNAYL.js} +1 -1
  28. package/dist/chunks/{chunk-XXMAC5EP.js.map → chunk-E5ERNAYL.js.map} +1 -1
  29. package/dist/chunks/chunk-KGAZZNZC.js +8 -0
  30. package/dist/chunks/chunk-KGAZZNZC.js.map +7 -0
  31. package/dist/chunks/{chunk-4IPVOCXX.js → chunk-L7ZSEA4T.js} +2 -2
  32. package/dist/chunks/{chunk-4IPVOCXX.js.map → chunk-L7ZSEA4T.js.map} +1 -1
  33. package/dist/chunks/chunk-M5XKM6D2.js +5 -0
  34. package/dist/chunks/chunk-M5XKM6D2.js.map +7 -0
  35. package/dist/chunks/chunk-N2TMTGYP.js +2 -0
  36. package/dist/chunks/{chunk-HE7BFKXW.js → chunk-QOMV5OG7.js} +2 -2
  37. package/dist/chunks/{chunk-5PMRULDS.js → chunk-RDTLCMD2.js} +1 -1
  38. package/dist/chunks/{chunk-5PMRULDS.js.map → chunk-RDTLCMD2.js.map} +1 -1
  39. package/dist/chunks/{chunk-SBHNFZRS.js → chunk-RUKWE5MB.js} +2 -2
  40. package/dist/chunks/chunk-SMZZWPRX.js +3 -0
  41. package/dist/chunks/chunk-SMZZWPRX.js.map +7 -0
  42. package/dist/chunks/{chunk-EYNSJ5AX.js → chunk-TM22QR6V.js} +2 -2
  43. package/dist/chunks/{chunk-EYNSJ5AX.js.map → chunk-TM22QR6V.js.map} +1 -1
  44. package/dist/chunks/{chunk-2XAPUOET.js → chunk-VY7G4FSX.js} +2 -2
  45. package/dist/chunks/{chunk-2XAPUOET.js.map → chunk-VY7G4FSX.js.map} +2 -2
  46. package/dist/chunks/{chunk-4GC42TBO.js → chunk-WBDZVWK4.js} +2 -2
  47. package/dist/chunks/{chunk-4GC42TBO.js.map → chunk-WBDZVWK4.js.map} +1 -1
  48. package/dist/chunks/{chunk-4WMWSJXJ.js → chunk-YIGESHTA.js} +2 -2
  49. package/dist/chunks/{chunk-4WMWSJXJ.js.map → chunk-YIGESHTA.js.map} +1 -1
  50. package/dist/chunks/{chunk-LOR4V6JJ.js → chunk-YLB6GKFG.js} +2 -2
  51. package/dist/chunks/{chunk-LOR4V6JJ.js.map → chunk-YLB6GKFG.js.map} +1 -1
  52. package/dist/chunks/{renderSvg-WQ5CH3G3.js → renderSvg-4AG3PPI5.js} +2 -2
  53. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +1 -1
  54. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +1 -1
  55. package/package.json +3 -3
  56. package/src/GraphGenomeView/host.test.ts +1 -0
  57. package/src/GraphGenomeView/host.ts +9 -3
  58. package/src/GraphGenomeView/pane/fitViews.ts +2 -2
  59. package/src/GraphGenomeView/pane/graphViews.ts +8 -5
  60. package/src/GraphGenomeView/pane/hostViews.ts +2 -4
  61. package/src/LinearGraphDisplay/LinearGraphDisplay.test.ts +22 -0
  62. package/src/WalkFormsAdapter/formsMenu.test.ts +1 -0
  63. package/src/version.ts +1 -1
  64. package/dist/chunks/GraphSettingsDialog-6VOMA2TZ.js +0 -2
  65. package/dist/chunks/LinearGraphDisplay-R3A64XKK.js +0 -2
  66. package/dist/chunks/chunk-3S24TQNP.js +0 -5
  67. package/dist/chunks/chunk-3S24TQNP.js.map +0 -7
  68. package/dist/chunks/chunk-GPNGXGMH.js +0 -3
  69. package/dist/chunks/chunk-GPNGXGMH.js.map +0 -7
  70. package/dist/chunks/chunk-RRQGLRKY.js +0 -8
  71. package/dist/chunks/chunk-RRQGLRKY.js.map +0 -7
  72. package/dist/chunks/chunk-VOD5M5MV.js +0 -2
  73. /package/dist/chunks/{AddTrackWorkflow-4S5QEZTJ.js.map → AddTrackWorkflow-P5APNL32.js.map} +0 -0
  74. /package/dist/chunks/{GraphGenomeView-EGR7L5WT.js.map → GraphGenomeView-MXRAP7QB.js.map} +0 -0
  75. /package/dist/chunks/{GraphSettingsDialog-6VOMA2TZ.js.map → GraphSettingsDialog-HIOYWTO7.js.map} +0 -0
  76. /package/dist/chunks/{HighlightColorDialog-FHRKHBDZ.js.map → HighlightColorDialog-UKFUS5S4.js.map} +0 -0
  77. /package/dist/chunks/{LinearGraphDisplay-R3A64XKK.js.map → LinearGraphDisplay-KPWFPVFK.js.map} +0 -0
  78. /package/dist/chunks/{MinigraphBubbleAdapter-LQ2NYC6O.js.map → MinigraphBubbleAdapter-QSPPG4LG.js.map} +0 -0
  79. /package/dist/chunks/{RgfaTabixAdapter-UM7L6HPH.js.map → RgfaTabixAdapter-UPCOXYVG.js.map} +0 -0
  80. /package/dist/chunks/{WalkFormsAdapter-4D6MTHLE.js.map → WalkFormsAdapter-LHKGRYC6.js.map} +0 -0
  81. /package/dist/chunks/{WalkTabixSyntenyAdapter-V5IQCHP4.js.map → WalkTabixSyntenyAdapter-ELTYD73I.js.map} +0 -0
  82. /package/dist/chunks/{chunk-5KWWMR7X.js.map → chunk-2TMZO3P5.js.map} +0 -0
  83. /package/dist/chunks/{chunk-ZMUXLTEP.js.map → chunk-5N4B6FEH.js.map} +0 -0
  84. /package/dist/chunks/{chunk-55PR5XJY.js.map → chunk-DZXYOIGJ.js.map} +0 -0
  85. /package/dist/chunks/{chunk-VOD5M5MV.js.map → chunk-N2TMTGYP.js.map} +0 -0
  86. /package/dist/chunks/{chunk-HE7BFKXW.js.map → chunk-QOMV5OG7.js.map} +0 -0
  87. /package/dist/chunks/{chunk-SBHNFZRS.js.map → chunk-RUKWE5MB.js.map} +0 -0
  88. /package/dist/chunks/{renderSvg-WQ5CH3G3.js.map → renderSvg-4AG3PPI5.js.map} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jbrowse-plugin-graphgenomeviewer",
3
- "version": "10.4.0",
3
+ "version": "10.4.2",
4
4
  "description": "JBrowse 2 graph genome (pangenome) view: rGFA reference-anchored layouts, the Bandage force-directed engine, and haplotype lanes read from a gbz-base database",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "@jbrowse/core": "5.0.0-beta.20",
33
33
  "@jbrowse/display-kit": "5.0.0-beta.20",
34
34
  "@jbrowse/display-ui": "5.0.0-beta.20",
35
- "@jbrowse/graph-walks": "^9.0.0",
35
+ "@jbrowse/graph-walks": "^9.1.0",
36
36
  "@jbrowse/render-core": "5.0.0-beta.20",
37
37
  "@jbrowse/synteny-core": "5.0.0-beta.20"
38
38
  },
@@ -40,7 +40,7 @@
40
40
  "@emotion/react": "^11.14.0",
41
41
  "@emotion/styled": "^11.14.1",
42
42
  "@eslint/js": "^10.0.1",
43
- "@jbrowse/bandage-core": "^14.3.0",
43
+ "@jbrowse/bandage-core": "^14.3.1",
44
44
  "@jbrowse/cli": "5.0.0-beta.20",
45
45
  "@jbrowse/mobx-state-tree": "^6.10.0",
46
46
  "@jbrowse/plugin-linear-genome-view": "5.0.0-beta.20",
@@ -58,6 +58,7 @@ test('a reversed block runs bp right to left from the same screen edge', () => {
58
58
  }
59
59
  const view = (reversed: boolean) =>
60
60
  ({
61
+ initialized: true,
61
62
  bpPerPx: 2,
62
63
  offsetPx: 400,
63
64
  dynamicBlocks: { contentBlocks: [{ ...block, reversed }] },
@@ -67,6 +67,12 @@ export interface HostWindow {
67
67
  regionEnd: number
68
68
  }
69
69
 
70
+ // A view lays out no blocks until it has measured its width, which it throws on
71
+ // reading until then
72
+ export function hostBlocks(view: LinearHost) {
73
+ return view.initialized ? view.dynamicBlocks.contentBlocks : []
74
+ }
75
+
70
76
  // x is reference bp on an anchored layout, so the graph shows what the linear
71
77
  // view shows when one bp is as many px in both and the cut's refName sits at
72
78
  // the same screen x. Undefined when the linear view shows no block of that
@@ -74,7 +80,7 @@ export interface HostWindow {
74
80
  // runs bp right to left, which only the tube map's connectors can draw.
75
81
  export function hostFrame(view: LinearHost, region: SubgraphRegion) {
76
82
  const block = widest(
77
- view.dynamicBlocks.contentBlocks.filter(
83
+ hostBlocks(view).filter(
78
84
  b =>
79
85
  b.refName === region.refName && b.assemblyName === region.assemblyName,
80
86
  ),
@@ -92,7 +98,7 @@ export function hostFrame(view: LinearHost, region: SubgraphRegion) {
92
98
  // Read off the LIVE blocks even when the coarse ones woke the caller: those
93
99
  // name where the window was half a second ago (SyntenyFollow/CLAUDE.md).
94
100
  export function hostWindow(view: LinearHost): HostWindow | undefined {
95
- const block = widest(view.dynamicBlocks.contentBlocks)
101
+ const block = widest(hostBlocks(view))
96
102
  const displayed =
97
103
  block?.displayedRegionIndex === undefined
98
104
  ? undefined
@@ -114,7 +120,7 @@ export function hostWindow(view: LinearHost): HostWindow | undefined {
114
120
  // The bp the view's width spans on the window's sequence, running past the
115
121
  // sequence's ends where the view does, where hostWindow stops at them
116
122
  export function paneWindow(view: LinearHost) {
117
- const block = widest(view.dynamicBlocks.contentBlocks)
123
+ const block = widest(hostBlocks(view))
118
124
  const start =
119
125
  block && block.start - (block.offsetPx - view.offsetPx) * view.bpPerPx
120
126
  return start === undefined
@@ -48,7 +48,7 @@ import {
48
48
  import { contains, padded } from '@jbrowse/bandage-core/viewport'
49
49
  import { walkPosition } from '@jbrowse/bandage-core/walkKey'
50
50
 
51
- import { cutRuleOf, hostWindow, paneWindow } from '../host'
51
+ import { cutRuleOf, hostBlocks, hostWindow, paneWindow } from '../host'
52
52
  import { measureReadout } from '../readoutMeasure'
53
53
  import { sectionHeadersPx, sectionPlacement } from '../walkRowGroups'
54
54
  import { withHostViews } from './hostViews'
@@ -475,7 +475,7 @@ export const withFitViews = withHostViews
475
475
  return (
476
476
  !!host &&
477
477
  cutRuleOf(self.chosenLayoutMode) === 'snapped' &&
478
- !host.dynamicBlocks.contentBlocks.some(
478
+ !hostBlocks(host).some(
479
479
  b =>
480
480
  b.reversed &&
481
481
  (b.refName === graphRegion?.refName || b.refName === seen?.refName),
@@ -88,6 +88,7 @@ import {
88
88
  pickGeneTrack,
89
89
  } from '../genes/geneFeatures'
90
90
  import { layersOf } from '../graphLayers'
91
+ import { isLinearHost } from '../host'
91
92
  import { domainOfColor, schemeOfColor } from '../nodeColor'
92
93
  import { nodeSizeOf } from '../nodeSize'
93
94
  import {
@@ -386,12 +387,14 @@ export const withGraphViews = paneBase
386
387
  }
387
388
  })
388
389
  .views(self => ({
389
- get paneWidth() {
390
- return getContainingView(self).width
391
- },
392
- // a linear view knows its width before its tracks draw
390
+ // a restored session attaches its tracks before the linear view measures
391
+ // its width, which the view throws on reading until then
393
392
  get paneMeasured() {
394
- return true
393
+ const view = getContainingView(self)
394
+ return !isLinearHost(view) || view.initialized
395
+ },
396
+ get paneWidth(): number {
397
+ return this.paneMeasured ? getContainingView(self).width : 0
395
398
  },
396
399
  // The graph the drawing's node ids address: a tube map's, which is the
397
400
  // window it drew with each merged run one node, the cut otherwise. Hover,
@@ -14,7 +14,7 @@ import { deviationMarks } from '@jbrowse/bandage-core/tubeMap/deviations'
14
14
  import { tubeMapPicture } from '@jbrowse/bandage-core/tubeMap/draw'
15
15
  import { tubeMapGenes } from '@jbrowse/bandage-core/tubeMap/genes'
16
16
 
17
- import { hostFrame } from '../host'
17
+ import { hostBlocks, hostFrame } from '../host'
18
18
  import { withWalkRowViews } from './walkRowViews'
19
19
 
20
20
  export const withHostViews = withWalkRowViews
@@ -41,9 +41,7 @@ export const withHostViews = withWalkRowViews
41
41
  host.initialized &&
42
42
  region !== undefined &&
43
43
  self.xIsReferenceBp &&
44
- !host.dynamicBlocks.contentBlocks.some(
45
- b => b.refName === region.refName && b.reversed,
46
- )
44
+ !hostBlocks(host).some(b => b.refName === region.refName && b.reversed)
47
45
  )
48
46
  },
49
47
  }))
@@ -653,6 +653,8 @@ function createEnvironment({
653
653
  return {
654
654
  session,
655
655
  view,
656
+ newView: () =>
657
+ LinearGenomeModel.create({ type: 'LinearGenomeView', tracks: [] }),
656
658
  cuts,
657
659
  errors,
658
660
  addedViews,
@@ -898,6 +900,26 @@ test('a restored session cuts the region it saved', async () => {
898
900
  expect(cuts[0]!.region).toEqual(saved)
899
901
  })
900
902
 
903
+ test('a track restored before its view measures its width waits for the width, then cuts', async () => {
904
+ const { view, session, newView, cuts } = createEnvironment()
905
+ const errors = vi.spyOn(console, 'error').mockImplementation(() => {})
906
+ const restored = session.setOther(newView())
907
+ restored.setDisplayedRegions(view.displayedRegions)
908
+ restored.showTrack('graph')
909
+ const display = restored.tracks[0]!.displays[0] as LinearGraphDisplayModel
910
+ display.startRenderingBackend(fakeRenderer())
911
+ await wait(SETTLE_MS)
912
+ expect(display.paneWidth).toBe(0)
913
+ restored.setWidth(WIDTH_PX)
914
+ restored.zoomTo(60_000 / WIDTH_PX)
915
+ restored.scrollTo(1_000_000 / restored.bpPerPx)
916
+ await wait(SETTLE_MS)
917
+ expect(errors).not.toHaveBeenCalled()
918
+ expect(cuts).toHaveLength(1)
919
+ expect(display.keyView.maxX - display.keyView.minX).toBeGreaterThan(0)
920
+ errors.mockRestore()
921
+ })
922
+
901
923
  test('a tube map on its own axis ties each reference box to its bp in the linear view', async () => {
902
924
  const { view, pane } = await shownGraph({ paths: true })
903
925
  await pane.switchLayout('tubemap')
@@ -52,6 +52,7 @@ const FakeView = types
52
52
  end: types.number,
53
53
  })
54
54
  .volatile(() => ({
55
+ initialized: true,
55
56
  width: 1000,
56
57
  bpPerPx: 1,
57
58
  offsetPx: 0,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '10.4.0'
1
+ export const version = '10.4.2'
@@ -1,2 +0,0 @@
1
- import{b as a}from"./chunk-LOR4V6JJ.js";import"./chunk-2OH3T4CR.js";import"./chunk-4WMWSJXJ.js";import"./chunk-QVQIHX2Y.js";import"./chunk-HYQOBARI.js";import"./chunk-D3QZGLZ3.js";import"./chunk-TMM73K4C.js";import"./chunk-EGZZ3ADM.js";import"./chunk-5PMRULDS.js";import"./chunk-J2PN6CG3.js";import"./chunk-H42TSPVA.js";import"./chunk-DUU6T2I5.js";export{a as default};
2
- //# sourceMappingURL=GraphSettingsDialog-6VOMA2TZ.js.map
@@ -1,2 +0,0 @@
1
- import{a,b as i}from"./chunk-L5HPUPUZ.js";import"./chunk-LOR4V6JJ.js";import"./chunk-EYNSJ5AX.js";import"./chunk-GPNGXGMH.js";import"./chunk-HE7BFKXW.js";import"./chunk-2OH3T4CR.js";import"./chunk-3S24TQNP.js";import"./chunk-2XAPUOET.js";import"./chunk-4WMWSJXJ.js";import"./chunk-QVQIHX2Y.js";import"./chunk-5CTDN4UC.js";import"./chunk-ZQOMV674.js";import"./chunk-55PR5XJY.js";import"./chunk-4GC42TBO.js";import"./chunk-YBLNN5FU.js";import"./chunk-4IPVOCXX.js";import"./chunk-XXMAC5EP.js";import"./chunk-HYQOBARI.js";import"./chunk-D3QZGLZ3.js";import"./chunk-WKD7ALOU.js";import"./chunk-RRQGLRKY.js";import"./chunk-TMM73K4C.js";import"./chunk-YBLNN5FU.js";import"./chunk-EGZZ3ADM.js";import"./chunk-5PMRULDS.js";import"./chunk-5L276I7O.js";import"./chunk-J2PN6CG3.js";import"./chunk-H42TSPVA.js";import{b as o,d as t}from"./chunk-DUU6T2I5.js";var e=JBrowseExports["@jbrowse/display-kit/DisplayChrome"];var s=e&&e.__esModule?e.default:e;var p=t(function({model:r}){return o(s,{model:r,factory:a,testid:"linear-graph-display","data-layout":r.chosenLayoutMode,"data-cut-tier":r.cutTier,"data-recuts":r.recuts,"data-node-count":r.hasGraph?r.nodeCount:void 0,"data-loading":r.isLoading?"":void 0,style:{width:r.paneWidth,height:r.height,overflow:"hidden"},children:n=>o(i,{model:r,handle:n})})}),c=p;export{c as default};
2
- //# sourceMappingURL=LinearGraphDisplay-R3A64XKK.js.map