jbrowse-plugin-graphgenomeviewer 7.6.0 → 7.7.0

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 (96) hide show
  1. package/README.md +5 -4
  2. package/dist/chunks/GbzBaseSyntenyAdapter-HT275FAA.js +2 -0
  3. package/dist/chunks/{GbzBaseSyntenyAdapter-3PVPTKNW.js.map → GbzBaseSyntenyAdapter-HT275FAA.js.map} +2 -2
  4. package/dist/chunks/GraphGenomeView-NBLEWVY2.js +10 -0
  5. package/dist/chunks/{GraphGenomeView-GQW4YC23.js.map → GraphGenomeView-NBLEWVY2.js.map} +1 -1
  6. package/dist/chunks/{GraphTrackSettingsDialog-ARWCWJW4.js → GraphTrackSettingsDialog-63UGAGAC.js} +2 -2
  7. package/dist/chunks/{HighlightColorDialog-PD3KMF2U.js → HighlightColorDialog-MY4MWVCJ.js} +2 -2
  8. package/dist/chunks/LinearGraphDisplay-3LMAWRNR.js +2 -0
  9. package/dist/chunks/{LinearGraphDisplay-QNS4EAL3.js.map → LinearGraphDisplay-3LMAWRNR.js.map} +1 -1
  10. package/dist/chunks/{MinigraphBubbleAdapter-L6JSQIOL.js → MinigraphBubbleAdapter-YMI75DAV.js} +2 -2
  11. package/dist/chunks/{RgfaTabixAdapter-5HCAJ7QI.js → RgfaTabixAdapter-AFNTSA6Y.js} +2 -2
  12. package/dist/chunks/{WalkFormsAdapter-NX36GP35.js → WalkFormsAdapter-ZPE2JQJU.js} +2 -2
  13. package/dist/chunks/{WalkTabixSyntenyAdapter-JFNFX3JP.js → WalkTabixSyntenyAdapter-EOD4RQVU.js} +2 -2
  14. package/dist/chunks/{chunk-LJ7O3736.js → chunk-22A3MS5J.js} +1 -1
  15. package/dist/chunks/{chunk-LJ7O3736.js.map → chunk-22A3MS5J.js.map} +1 -1
  16. package/dist/chunks/{chunk-OQHN2GWX.js → chunk-2QRCU675.js} +2 -2
  17. package/dist/chunks/chunk-3Y2G43HK.js +3 -0
  18. package/dist/chunks/chunk-3Y2G43HK.js.map +7 -0
  19. package/dist/chunks/{chunk-SGP63UMC.js → chunk-4AXLBI6M.js} +2 -2
  20. package/dist/chunks/{chunk-SGP63UMC.js.map → chunk-4AXLBI6M.js.map} +4 -4
  21. package/dist/chunks/chunk-AK3UZI6J.js +4 -0
  22. package/dist/chunks/chunk-AK3UZI6J.js.map +7 -0
  23. package/dist/chunks/{chunk-4PHM6JNU.js → chunk-DDAG445J.js} +2 -2
  24. package/dist/chunks/chunk-DFZ6G452.js +4 -0
  25. package/dist/chunks/chunk-DFZ6G452.js.map +7 -0
  26. package/dist/chunks/{chunk-DOC7QIE2.js → chunk-DSSZIADV.js} +1 -1
  27. package/dist/chunks/{chunk-DOC7QIE2.js.map → chunk-DSSZIADV.js.map} +1 -1
  28. package/dist/chunks/{chunk-5LFPNQWH.js → chunk-E7S7PGEZ.js} +2 -2
  29. package/dist/chunks/{chunk-5LFPNQWH.js.map → chunk-E7S7PGEZ.js.map} +1 -1
  30. package/dist/chunks/chunk-EV54SYM7.js +2 -0
  31. package/dist/chunks/chunk-EV54SYM7.js.map +7 -0
  32. package/dist/chunks/{chunk-G4OPM6G7.js → chunk-GK5YETAZ.js} +2 -2
  33. package/dist/chunks/{chunk-G4OPM6G7.js.map → chunk-GK5YETAZ.js.map} +1 -1
  34. package/dist/chunks/{chunk-LGV6BTOY.js → chunk-IFIZMFS6.js} +2 -2
  35. package/dist/chunks/{chunk-LGV6BTOY.js.map → chunk-IFIZMFS6.js.map} +3 -3
  36. package/dist/chunks/{chunk-SI5VLKVN.js → chunk-KY6GXBXU.js} +2 -2
  37. package/dist/chunks/{chunk-SI5VLKVN.js.map → chunk-KY6GXBXU.js.map} +2 -2
  38. package/dist/chunks/{chunk-ZFJGNGIB.js → chunk-LIRBZOBX.js} +2 -2
  39. package/dist/chunks/{chunk-ZFJGNGIB.js.map → chunk-LIRBZOBX.js.map} +1 -1
  40. package/dist/chunks/chunk-O6HXOTJN.js +2 -0
  41. package/dist/chunks/{chunk-JYYF3U2H.js.map → chunk-O6HXOTJN.js.map} +4 -4
  42. package/dist/chunks/{chunk-TWPUVVYH.js → chunk-ODQSCM3F.js} +1 -1
  43. package/dist/chunks/{chunk-TWPUVVYH.js.map → chunk-ODQSCM3F.js.map} +1 -1
  44. package/dist/chunks/chunk-PT3WV5ED.js +4 -0
  45. package/dist/chunks/chunk-PT3WV5ED.js.map +7 -0
  46. package/dist/chunks/{chunk-XF6GU4GK.js → chunk-Q5H6ETNZ.js} +2 -2
  47. package/dist/chunks/{chunk-XSDGE4RF.js → chunk-SXQ6222I.js} +2 -2
  48. package/dist/chunks/chunk-TUECGSVJ.js +2 -0
  49. package/dist/chunks/{renderSvg-NIWFCY3U.js → renderSvg-WMFKXKFZ.js} +2 -2
  50. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +6 -4
  51. package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +4 -4
  52. package/package.json +2 -2
  53. package/src/GraphGenomeView/components/LegendSwatch.tsx +11 -1
  54. package/src/GraphGenomeView/components/WalkStrip.tsx +1 -0
  55. package/src/GraphGenomeView/genes/geneFeatures.ts +8 -0
  56. package/src/GraphGenomeView/genes/genes.test.ts +14 -1
  57. package/src/GraphGenomeView/legendSections.ts +42 -6
  58. package/src/GraphGenomeView/model.test.ts +54 -2
  59. package/src/GraphGenomeView/nodeSize.test.ts +1 -0
  60. package/src/GraphGenomeView/nodeSize.ts +10 -5
  61. package/src/GraphGenomeView/pane/fitViews.ts +1 -0
  62. package/src/GraphGenomeView/pane/graphViews.ts +4 -0
  63. package/src/GraphGenomeView/pane/launchViews.ts +11 -3
  64. package/src/GraphGenomeView/pane/renderingActions.ts +36 -4
  65. package/src/GraphGenomeView/subgraphLoad.test.ts +42 -0
  66. package/src/LinearGraphDisplay/configSchema.ts +3 -2
  67. package/src/version.ts +1 -1
  68. package/dist/chunks/GbzBaseSyntenyAdapter-3PVPTKNW.js +0 -2
  69. package/dist/chunks/GraphGenomeView-GQW4YC23.js +0 -10
  70. package/dist/chunks/LinearGraphDisplay-QNS4EAL3.js +0 -2
  71. package/dist/chunks/chunk-2CPD5NX2.js +0 -4
  72. package/dist/chunks/chunk-2CPD5NX2.js.map +0 -7
  73. package/dist/chunks/chunk-3AC33AXB.js +0 -2
  74. package/dist/chunks/chunk-CNEUOM7X.js +0 -2
  75. package/dist/chunks/chunk-CNEUOM7X.js.map +0 -7
  76. package/dist/chunks/chunk-GRLNDNX4.js +0 -2
  77. package/dist/chunks/chunk-GRLNDNX4.js.map +0 -7
  78. package/dist/chunks/chunk-JYYF3U2H.js +0 -2
  79. package/dist/chunks/chunk-KDXVLEHS.js +0 -3
  80. package/dist/chunks/chunk-KDXVLEHS.js.map +0 -7
  81. package/dist/chunks/chunk-PTDOYJFH.js +0 -4
  82. package/dist/chunks/chunk-PTDOYJFH.js.map +0 -7
  83. package/dist/chunks/chunk-ZI7RFIA2.js +0 -4
  84. package/dist/chunks/chunk-ZI7RFIA2.js.map +0 -7
  85. /package/dist/chunks/{GraphTrackSettingsDialog-ARWCWJW4.js.map → GraphTrackSettingsDialog-63UGAGAC.js.map} +0 -0
  86. /package/dist/chunks/{HighlightColorDialog-PD3KMF2U.js.map → HighlightColorDialog-MY4MWVCJ.js.map} +0 -0
  87. /package/dist/chunks/{MinigraphBubbleAdapter-L6JSQIOL.js.map → MinigraphBubbleAdapter-YMI75DAV.js.map} +0 -0
  88. /package/dist/chunks/{RgfaTabixAdapter-5HCAJ7QI.js.map → RgfaTabixAdapter-AFNTSA6Y.js.map} +0 -0
  89. /package/dist/chunks/{WalkFormsAdapter-NX36GP35.js.map → WalkFormsAdapter-ZPE2JQJU.js.map} +0 -0
  90. /package/dist/chunks/{WalkTabixSyntenyAdapter-JFNFX3JP.js.map → WalkTabixSyntenyAdapter-EOD4RQVU.js.map} +0 -0
  91. /package/dist/chunks/{chunk-OQHN2GWX.js.map → chunk-2QRCU675.js.map} +0 -0
  92. /package/dist/chunks/{chunk-4PHM6JNU.js.map → chunk-DDAG445J.js.map} +0 -0
  93. /package/dist/chunks/{chunk-XF6GU4GK.js.map → chunk-Q5H6ETNZ.js.map} +0 -0
  94. /package/dist/chunks/{chunk-XSDGE4RF.js.map → chunk-SXQ6222I.js.map} +0 -0
  95. /package/dist/chunks/{chunk-3AC33AXB.js.map → chunk-TUECGSVJ.js.map} +0 -0
  96. /package/dist/chunks/{renderSvg-NIWFCY3U.js.map → renderSvg-WMFKXKFZ.js.map} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jbrowse-plugin-graphgenomeviewer",
3
- "version": "7.6.0",
3
+ "version": "7.7.0",
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": {
@@ -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": "^11.14.0",
43
+ "@jbrowse/bandage-core": "^11.19.0",
44
44
  "@jbrowse/cli": "^4.3.0",
45
45
  "@jbrowse/mobx-state-tree": "^6.9.0",
46
46
  "@jbrowse/plugin-linear-genome-view": "5.0.0-beta.11",
@@ -121,7 +121,17 @@ export function SvgSwatch({
121
121
  )
122
122
  }
123
123
  case 'line':
124
- return (
124
+ return swatch.dashed ? (
125
+ <line
126
+ x1={x + 1}
127
+ x2={x + SWATCH_PX}
128
+ y1={mid}
129
+ y2={mid}
130
+ stroke={swatch.color}
131
+ strokeWidth={3}
132
+ strokeDasharray="4 3"
133
+ />
134
+ ) : (
125
135
  <rect
126
136
  x={x}
127
137
  y={mid - 1.5}
@@ -148,6 +148,7 @@ const WalkStrip = observer(function WalkStrip({
148
148
  ramp: model.referenceRampDomain,
149
149
  rampCss: RAMP_GRADIENT_CSS,
150
150
  genes: stripGeneGaps(frame, model.walkRowGenes, model.walkRowGeneGaps),
151
+ annotation: model.walkRowAnnotation,
151
152
  })
152
153
  return (
153
154
  <div
@@ -54,6 +54,14 @@ export function pickGeneTrack<T extends TrackChoice>(
54
54
  )
55
55
  }
56
56
 
57
+ const TE_TRACK_HINT = /\bTEs?\b|transpos/i
58
+
59
+ // What a walk row's boxes are, for the key: TEs where the annotation track's
60
+ // name says so, else genes
61
+ export function annotationNoun(track: TrackChoice | undefined) {
62
+ return track && TE_TRACK_HINT.test(trackLabel(track)) ? 'TE' : 'gene'
63
+ }
64
+
57
65
  interface LaneView {
58
66
  tracks?: readonly {
59
67
  configuration: AnyConfigurationModel
@@ -6,7 +6,7 @@ import {
6
6
  graphBackbone,
7
7
  } from '@jbrowse/bandage-core/reference'
8
8
 
9
- import { geneModelsFrom, pickGeneTrack } from './geneFeatures'
9
+ import { annotationNoun, geneModelsFrom, pickGeneTrack } from './geneFeatures'
10
10
 
11
11
  const gene = {
12
12
  type: 'gene',
@@ -161,6 +161,19 @@ test("a BED gene's transcripts merge, its copies stay apart, CDS and UTR count a
161
161
  ])
162
162
  })
163
163
 
164
+ test('a track named for TEs keys its boxes as TEs, any other as genes', () => {
165
+ const track = (name: string) => ({
166
+ trackId: 'b73_te',
167
+ name,
168
+ adapterType: 'Gff3TabixAdapter',
169
+ })
170
+ expect(annotationNoun(track('B73 v5 TEs'))).toBe('TE')
171
+ expect(annotationNoun(track('Transposable elements'))).toBe('TE')
172
+ expect(annotationNoun(track('NCBI RefSeq genes'))).toBe('gene')
173
+ expect(annotationNoun(track('Gene site annotation'))).toBe('gene')
174
+ expect(annotationNoun(undefined)).toBe('gene')
175
+ })
176
+
164
177
  test('a BED track counts as genes only where its name says so', () => {
165
178
  expect(
166
179
  pickGeneTrack([{ trackId: 'peaks', adapterType: 'BedTabixAdapter' }], ''),
@@ -3,6 +3,7 @@ import {
3
3
  BUBBLE_KIND_COLORS,
4
4
  BUBBLE_KIND_NAMES,
5
5
  } from '@jbrowse/bandage-core/bubbles/classifyBubble'
6
+ import { deletionKey } from '@jbrowse/bandage-core/deletionEdges'
6
7
  import { EXON_COLOR } from '@jbrowse/bandage-core/genes/exonOutline'
7
8
  import { formatBp } from '@jbrowse/bandage-core/graphLabels'
8
9
  import {
@@ -13,6 +14,7 @@ import {
13
14
  UNBACKED_TICK,
14
15
  walkRowsKey,
15
16
  } from '@jbrowse/bandage-core/layout/walkRowDraw'
17
+ import { referenceLabel } from '@jbrowse/bandage-core/reference'
16
18
  import { RAMP_GRADIENT_STOPS } from '@jbrowse/bandage-core/referenceRampCss'
17
19
  import {
18
20
  LIFT_BACKDROP_CSS,
@@ -24,6 +26,7 @@ import {
24
26
  REVERSE_READ_COLORS,
25
27
  } from '@jbrowse/bandage-core/tubeMap/reads'
26
28
  import { encodingStops } from '@jbrowse/bandage-core/walkEncoding'
29
+ import { fadedKey } from '@jbrowse/bandage-core/walkHighlight'
27
30
  import { walkKey } from '@jbrowse/bandage-core/walkKey'
28
31
 
29
32
  import { CALL_TOLERANCE } from './repeats/walkCalls'
@@ -43,6 +46,7 @@ const BAR_PX = 48
43
46
  // LIFT_BACKDROP_CSS reads paler alone than faded strokes do where they
44
47
  // overlap, so the key samples it darker
45
48
  const FADED_SWATCH = 'rgba(160, 160, 160, 0.45)'
49
+ const DELETION_INK = '#18181c'
46
50
 
47
51
  const STRIP_SAMPLES = 6
48
52
  const TUBE_SWATCH_PX = 7
@@ -64,7 +68,7 @@ export type LegendSwatch =
64
68
  }
65
69
  // the reference strip, a band per lifted walk
66
70
  | { kind: 'bands'; bands: Stop[][] }
67
- | { kind: 'line'; color: string }
71
+ | { kind: 'line'; color: string; dashed?: true }
68
72
  | { kind: 'halo'; color: string }
69
73
  | {
70
74
  kind: 'outline'
@@ -242,6 +246,23 @@ function haloRows(model: GraphPaneModel): LegendRow[] {
242
246
  })
243
247
  }
244
248
 
249
+ function deletionRows(model: GraphPaneModel): LegendRow[] {
250
+ const { graph } = model
251
+ return graph && model.deletions.length > 0
252
+ ? [
253
+ {
254
+ key: 'deletion',
255
+ label: deletionKey(referenceLabel(graph)),
256
+ swatch: {
257
+ kind: 'line',
258
+ color: model.walkLift ? FADED_SWATCH : DELETION_INK,
259
+ dashed: true,
260
+ },
261
+ },
262
+ ]
263
+ : []
264
+ }
265
+
245
266
  function geneRows(model: GraphPaneModel): LegendRow[] {
246
267
  return model.genePins.some(pin => pin.exonsByNode.length > 0)
247
268
  ? [
@@ -447,6 +468,7 @@ function walkRowsRows(model: GraphPaneModel): LegendRow[] {
447
468
  ...walkRowsKey(bars, {
448
469
  ramp: model.referenceRampDomain,
449
470
  genes: model.walkRowGeneKey,
471
+ annotation: model.walkRowAnnotation,
450
472
  }).map(entry => ({
451
473
  key: `rows-${entry.label}`,
452
474
  label: entry.label,
@@ -523,16 +545,29 @@ function walkReadoutRows(model: GraphPaneModel): LegendRow[] {
523
545
  const width = rows.some(r => swatchWidth(r.swatch!) === BAR_PX)
524
546
  ? BAR_PX
525
547
  : SWATCH_PX
526
- return [
527
- ...rows,
528
- ...fadedRows(model, `not on ${model.liftedWalksLabel}`, width),
529
- ]
548
+ const faded = model.graph
549
+ ? fadedKey(model.graph, lift, model.liftedWalksLabel)
550
+ : `not on ${model.liftedWalksLabel}`
551
+ return [...rows, ...fadedRows(model, faded, width)]
530
552
  }
531
553
 
532
554
  // The faceted pane's one key line under its panels: each panel's title keys
533
555
  // its walk, so this keys only what every panel greys
534
556
  export function facetKeyRows(model: GraphPaneModel): LegendRow[] {
535
- return model.facetPanels ? fadedRows(model, "not on the panel's walk") : []
557
+ const { graph, facetPanels } = model
558
+ if (!graph || !facetPanels) {
559
+ return []
560
+ }
561
+ const keys = new Set(
562
+ facetPanels.map(panel => fadedKey(graph, panel, "the panel's walk")),
563
+ )
564
+ return [
565
+ ...fadedRows(
566
+ model,
567
+ keys.size === 1 ? [...keys][0]! : "not on the panel's walk",
568
+ ),
569
+ ...deletionRows(model),
570
+ ]
536
571
  }
537
572
 
538
573
  // The keys in the order the panel stacks them, top first
@@ -542,6 +577,7 @@ export function legendSections(model: GraphPaneModel): LegendSection[] {
542
577
  { testid: 'graph-ramp-legend', rows: rampRows(model) },
543
578
  { testid: 'graph-reference-strip-legend', rows: stripRows(model) },
544
579
  { testid: 'graph-halo-legend', rows: haloRows(model) },
580
+ { testid: 'graph-deletion-legend', rows: deletionRows(model) },
545
581
  { testid: 'graph-gene-legend', rows: geneRows(model) },
546
582
  { testid: 'graph-fold-legend', rows: foldRows(model) },
547
583
  { testid: 'graph-path-legend', rows: pathRows(model) },
@@ -33,7 +33,7 @@ import {
33
33
  } from '@jbrowse/mobx-state-tree'
34
34
  import { autorun } from 'mobx'
35
35
 
36
- import { facetKeyRows } from './legendSections'
36
+ import { facetKeyRows, legendSections } from './legendSections'
37
37
  import { MAX_GRAPH_REGION_BP, formatSpanBp } from './model'
38
38
  import { walkRowGeneKey } from './pane/fitViews'
39
39
  import { EMPTY_BATCH, SELECT_BRIGHTEN } from './pane/paneBase'
@@ -3048,6 +3048,23 @@ describe('what the row axis draws, in pixels', () => {
3048
3048
  expect(hidden.hiddenEdgeIndexes!.size).toBe(0)
3049
3049
  })
3050
3050
 
3051
+ test('the legend keys the dashed links only while they draw', async () => {
3052
+ const deletionRows = (model: Awaited<ReturnType<typeof fitted>>) =>
3053
+ legendSections(model)
3054
+ .filter(s => s.testid === 'graph-deletion-legend')
3055
+ .flatMap(s => s.rows)
3056
+ const shown = await fitted()
3057
+ expect(deletionRows(shown)).toMatchObject([
3058
+ {
3059
+ label: expect.stringMatching(/^skips .* sequence \(a deletion\)$/),
3060
+ swatch: { kind: 'line', dashed: true },
3061
+ },
3062
+ ])
3063
+ expect(
3064
+ deletionRows(await fitted({ layers: { deletions: false } })),
3065
+ ).toEqual([])
3066
+ })
3067
+
3051
3068
  // The panel-alignment half: the backbone is drawn across the pane rather than
3052
3069
  // squeezed into whatever the vertical fit left it. The recorded points are
3053
3070
  // the stroke's coordinates; the round caps the canvas adds past them are not
@@ -3776,7 +3793,7 @@ describe('walk rows', () => {
3776
3793
  // the grid, then the key line under it
3777
3794
  expect(model.canvasHeight).toBe(Math.max(160, grid.total + 8 + 19))
3778
3795
  expect(facetKeyRows(model).map(r => r.label)).toEqual([
3779
- "not on the panel's walk",
3796
+ 'only in other haplotypes',
3780
3797
  ])
3781
3798
  expect(model.scale).toBeCloseTo(grid.scale, 10)
3782
3799
  expect(model.scale).not.toBeCloseTo(whole, 10)
@@ -4918,6 +4935,41 @@ describe('walk rows grouped by a sample column', () => {
4918
4935
  }
4919
4936
  })
4920
4937
 
4938
+ test("beside a backbone of genes, a walk row reads its haplotype's genes, never its TEs", async () => {
4939
+ const was = vi.mocked(readConfObject).getMockImplementation()
4940
+ vi.mocked(readConfObject).mockImplementation(
4941
+ (obj: Record<string, unknown>, key?: unknown) => obj[String(key)],
4942
+ )
4943
+ mockSession.assemblyNames = ['B.1']
4944
+ mockSession.assemblyAliases = { 'B#1': 'B.1' }
4945
+ const track = (trackId: string, name: string) => ({
4946
+ trackId,
4947
+ name,
4948
+ assemblyNames: ['B#1'],
4949
+ adapter: { type: 'Gff3TabixAdapter' },
4950
+ })
4951
+ try {
4952
+ mockSession.tracks = [
4953
+ { ...SAMPLES_TRACK, assemblyNames: [] },
4954
+ track('b-tes', 'B TEs'),
4955
+ track('b-genes', 'B genes'),
4956
+ ]
4957
+ const both = await groupedModel()
4958
+ expect(both.walkRowAnnotation).toBe('gene')
4959
+ expect(both.walkGeneReads!.reads.map(r => r.trackId)).toEqual(['b-genes'])
4960
+ mockSession.tracks = [
4961
+ { ...SAMPLES_TRACK, assemblyNames: [] },
4962
+ track('b-tes', 'B TEs'),
4963
+ ]
4964
+ const tesOnly = await groupedModel()
4965
+ expect(tesOnly.walkGeneReads!.reads).toEqual([])
4966
+ } finally {
4967
+ vi.mocked(readConfObject).mockImplementation(was!)
4968
+ mockSession.assemblyNames = []
4969
+ mockSession.assemblyAliases = {}
4970
+ }
4971
+ })
4972
+
4921
4973
  test('no samples table, no Group by...', async () => {
4922
4974
  mockSession.tracks = []
4923
4975
  const model = await groupedModel()
@@ -24,6 +24,7 @@ test.each([
24
24
  ['uniform', 'uniform'],
25
25
  ['depth', 'walks'],
26
26
  ['uniform', 'walks'],
27
+ ['frequency', 'uniform'],
27
28
  ] as const)('nodes %s, links %s survive the trip', (width, links) => {
28
29
  const size = { width, px: 5, links }
29
30
  expect(nodeSizeOf(sizeOf(size))).toEqual(size)
@@ -5,10 +5,12 @@ import type { NodeWidth } from '@jbrowse/bandage-core/nodeWidths'
5
5
 
6
6
  // The mark thickness as a config or session writes it: a px number draws every
7
7
  // node that thick; `{ field: 'depth', value }` thickens a node the more paths
8
- // carry it, around `value` px; `links: 'walks'` thickens a link the more walks
9
- // take it. Unset is nodes by depth around 6, links uniform.
8
+ // carry it, around `value` px; `{ field: 'frequency', value }` draws it as wide
9
+ // as the share of haplotypes through it, `value` px at 100%; `links: 'walks'`
10
+ // thickens a link the more walks take it. Unset is nodes by depth around 6,
11
+ // links uniform.
10
12
  export type NodeSize =
11
- number | { field?: 'depth'; value?: number; links?: 'walks' }
13
+ number | { field?: 'depth' | 'frequency'; value?: number; links?: 'walks' }
12
14
 
13
15
  const DEFAULT_PX = 6
14
16
 
@@ -23,7 +25,10 @@ export function nodeSizeOf(size: unknown): MarkSize {
23
25
  ? { width: 'uniform', px: size, links: 'uniform' }
24
26
  : isRecord(size)
25
27
  ? {
26
- width: size.field === 'depth' ? 'depth' : 'uniform',
28
+ width:
29
+ size.field === 'depth' || size.field === 'frequency'
30
+ ? size.field
31
+ : 'uniform',
27
32
  px: typeof size.value === 'number' ? size.value : DEFAULT_PX,
28
33
  links: size.links === 'walks' ? 'walks' : 'uniform',
29
34
  }
@@ -34,7 +39,7 @@ export function sizeOf({ width, px, links }: MarkSize): NodeSize {
34
39
  return width === 'uniform' && links === 'uniform'
35
40
  ? px
36
41
  : {
37
- ...(width === 'depth' ? { field: 'depth' as const } : {}),
42
+ ...(width === 'uniform' ? {} : { field: width }),
38
43
  value: px,
39
44
  ...(links === 'walks' ? { links } : {}),
40
45
  }
@@ -588,6 +588,7 @@ export const withFitViews = withHostViews
588
588
  walkRowPitch: self.walkRowPitch,
589
589
  rowGenes: self.walkRowGenes,
590
590
  rowGeneGaps: self.walkRowGeneGaps,
591
+ rowAnnotation: self.walkRowAnnotation,
591
592
  walkStrip: self.walkStripRows && {
592
593
  rows: self.walkStripRows,
593
594
  rowGenes: self.walkRowGenes,
@@ -70,6 +70,7 @@ import { locationIsSet } from '../../locationName.ts'
70
70
  import { trackAdapterConfig } from '../../panSNAliases/trackAdapterConfig'
71
71
  import {
72
72
  GENE_ADAPTER_TYPES,
73
+ annotationNoun,
73
74
  geneModelsFrom,
74
75
  laneFilters,
75
76
  pickGeneTrack,
@@ -747,6 +748,9 @@ export const withGraphViews = paneBase
747
748
  get geneTrack() {
748
749
  return pickGeneTrack(self.geneTrackChoices, self.geneTrackId)
749
750
  },
751
+ get walkRowAnnotation() {
752
+ return annotationNoun(this.geneTrack)
753
+ },
750
754
  // the Repeat picker's entries, in the toolbar and the menu alike
751
755
  get repeatOptions() {
752
756
  return [
@@ -19,7 +19,11 @@ import {
19
19
  withReferenceRegion,
20
20
  } from '../../launchFromGraph/launchFromGraph'
21
21
  import { linearViewTarget } from '../../launchFromGraph/linearViewTarget'
22
- import { GENE_ADAPTER_TYPES, pickGeneTrack } from '../genes/geneFeatures'
22
+ import {
23
+ GENE_ADAPTER_TYPES,
24
+ annotationNoun,
25
+ pickGeneTrack,
26
+ } from '../genes/geneFeatures'
23
27
  import { isLinearHost } from '../host'
24
28
 
25
29
  import type { LinearHost } from '../host'
@@ -86,12 +90,16 @@ export const withLaunchViews = withGraphViews
86
90
  return (sample: string) => loaded(byPrefix.get(sample)) ?? loaded(sample)
87
91
  },
88
92
  // Each assembly's gene track among the session's tracks, picked as the
89
- // backbone's is, so a walk row can read its haplotype's own annotation.
93
+ // backbone's is and of the backbone's kind, so a walk row reads its
94
+ // haplotype's own TEs beside a backbone of TEs and its genes beside genes.
90
95
  // One pass over the tracks, not one per row.
91
96
  get geneTracksByAssembly() {
92
97
  const byAssembly = new Map<string, typeof self.sessionTracks>()
93
98
  for (const track of self.sessionTracks) {
94
- if (GENE_ADAPTER_TYPES.has(track.adapterType)) {
99
+ if (
100
+ GENE_ADAPTER_TYPES.has(track.adapterType) &&
101
+ annotationNoun(track) === self.walkRowAnnotation
102
+ ) {
95
103
  for (const asm of track.assemblies) {
96
104
  byAssembly.set(asm, [...(byAssembly.get(asm) ?? []), track])
97
105
  }
@@ -484,11 +484,43 @@ export const withRenderingActions = withLoadActions
484
484
  },
485
485
  }))
486
486
  .actions(self => ({
487
- // reads the abridged walk `name` in full with the next cut
488
- expandWalk(name: string) {
489
- if (!self.expandedWalks.includes(name)) {
490
- self.expandedWalks = self.expandedWalks.concat(name)
487
+ // reads the abridged walks `names` in full with the next cut
488
+ expandWalks(names: string[]) {
489
+ const more = names.filter(name => !self.expandedWalks.includes(name))
490
+ if (more.length > 0) {
491
+ self.expandedWalks = self.expandedWalks.concat(more)
491
492
  self.retryLoad()
492
493
  }
493
494
  },
494
495
  }))
496
+ .actions(self => ({
497
+ expandWalk(name: string) {
498
+ self.expandWalks([name])
499
+ },
500
+ // A lifted walk's key states its length, so the cut reads a lifted walk
501
+ // it abridged in full
502
+ afterAttach() {
503
+ addDisposer(
504
+ self,
505
+ reaction(
506
+ () => {
507
+ const lifted = new Set(self.walkLayers.map(l => l.walk))
508
+ return [
509
+ ...new Set(
510
+ (self.graph?.paths ?? [])
511
+ .filter(p => p.abridged && lifted.has(p.name))
512
+ .map(p => p.name),
513
+ ),
514
+ ]
515
+ },
516
+ names => {
517
+ self.expandWalks(names)
518
+ },
519
+ {
520
+ fireImmediately: true,
521
+ equals: (a, b) => a.join('\n') === b.join('\n'),
522
+ },
523
+ ),
524
+ )
525
+ },
526
+ }))
@@ -1,3 +1,6 @@
1
+ import { gfaTables } from '@jbrowse/bandage-core/gfa/gfaTables'
2
+ import { types } from '@jbrowse/mobx-state-tree'
3
+
1
4
  import stateModelFactory from './viewModel'
2
5
  import { hoverInRegion } from '../hoverSync/lgvHover'
3
6
 
@@ -319,6 +322,45 @@ describe('canceling and retrying', () => {
319
322
  })
320
323
  })
321
324
 
325
+ test('lifting an abridged walk cuts again with its name', async () => {
326
+ const tables = gfaTables(
327
+ [
328
+ GFA,
329
+ 'W\tGRCh38\t0\tchr6\t32000000\t32001900\t>s1>s3',
330
+ 'W\tNA20809\t2\tCM094351.1\t31900800\t31903000\t>s1>h1>s3',
331
+ ].join('\n'),
332
+ )!
333
+ tables.walks.abridgedSteps = Float64Array.from([Number.NaN, 40])
334
+ tables.walks.abridgedBp = Float64Array.from([Number.NaN, 9000])
335
+ mockRpcCall.mockImplementation((_sid: unknown, method: string) =>
336
+ method === 'GetSubgraph'
337
+ ? Promise.resolve(tables)
338
+ : Promise.reject(new Error(`Unexpected RPC: ${method}`)),
339
+ )
340
+ const { view: model } = types.model({ view: stateModelFactory() }).create({
341
+ view: {
342
+ type: 'GraphGenomeView',
343
+ layoutMode: 'auto',
344
+ loadedTrackId: TRACK.trackId,
345
+ loadedRegion: ON_HG38,
346
+ } as never,
347
+ })
348
+ await vi.waitFor(() => {
349
+ expect(model.hasGraph).toBe(true)
350
+ })
351
+ model.liftWalks(['GRCh38#0#chr6'])
352
+ expect(model.expandedWalks).toEqual([])
353
+ mockRpcCall.mockClear()
354
+ model.liftWalks(['GRCh38#0#chr6', 'NA20809#2#CM094351.1'])
355
+ expect(model.expandedWalks).toEqual(['NA20809#2#CM094351.1'])
356
+ await vi.waitFor(() => {
357
+ expect(mockRpcCall).toHaveBeenCalledTimes(1)
358
+ })
359
+ expect(mockRpcCall.mock.calls[0]?.[2]).toMatchObject({
360
+ opts: { expand: ['NA20809#2#CM094351.1'] },
361
+ })
362
+ })
363
+
322
364
  test('a newer cut aborts the one it replaces', () => {
323
365
  pendingCuts()
324
366
  const model = launchedView()
@@ -47,8 +47,9 @@ export function configSchemaFactory() {
47
47
  * #slot
48
48
  * the node thickness: a px number draws every node that thick;
49
49
  * `{ field: 'depth', value }` thickens a node the more paths carry it,
50
- * around `value` px; `links: 'walks'` thickens a link the more walks
51
- * take it
50
+ * around `value` px; `{ field: 'frequency', value }` draws it as wide as
51
+ * the share of haplotypes through it, `value` px at 100%; `links:
52
+ * 'walks'` thickens a link the more walks take it
52
53
  */
53
54
  size: {
54
55
  type: 'frozen',
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '7.6.0'
1
+ export const version = '7.7.0'
@@ -1,2 +0,0 @@
1
- import{a as ne,b as ae,c as ue,d as re,e as oe,f as O,g as ie,h as se}from"./chunk-4PHM6JNU.js";import{a as te}from"./chunk-3AC33AXB.js";import{a as ee}from"./chunk-KOB7YIMR.js";import{a as Q,b as D,c as Z,d as u,e as k,f as M,g as j,h as $,i as W,k as U}from"./chunk-SI5VLKVN.js";import"./chunk-M2D7NUOY.js";import"./chunk-CNEUOM7X.js";import{b as z,c as E}from"./chunk-2CPD5NX2.js";import"./chunk-YBLNN5FU.js";import"./chunk-G4OPM6G7.js";import"./chunk-ZFJGNGIB.js";import{C as V,a as K,c as L}from"./chunk-XF6GU4GK.js";import"./chunk-YBLNN5FU.js";import"./chunk-JRJHXLGP.js";import{g as F,h as N,i as C}from"./chunk-TWPUVVYH.js";import"./chunk-T4R3ZVEM.js";import"./chunk-7WIBGKBU.js";import{d as G,g as X,h as Y,i as J}from"./chunk-IKJZPPOA.js";import{a as P}from"./chunk-OGQ6OQDN.js";import"./chunk-NDRLCGPC.js";import{e as _,o as B}from"./chunk-TENPGIPX.js";function A(n){let i=/\.gbz\.db$/i;return i.test(n)?n.replace(i,".haplotype-index.db"):void 0}function ge(n){return Y(n)&&A(X(n))?J(n,i=>A(i)):void 0}function ye(n){return n instanceof Error&&(/\bHTTP 40[34]\b/.test(n.message)||n.code==="ENOENT")}async function ce(n,i){let e=ge(n);if(!e)return{};try{return await P(e,i).stat(),{location:e}}catch(t){return ye(t)?{}:{unreadable:String(t)}}}var be=5e3,we=50*2**20,H=class extends Error{constructor(e){super(`this GAF is ${(e/2**20).toFixed(0)} MB without an index; bgzip it and index it with tabix -p gaf`);this.name="UnindexedGafTooLargeError"}};function xe(n,i){if(n.length<=i)return n;let e=n.length/i;return Array.from({length:i},(t,a)=>n[Math.floor(a*e)])}var pe=(n,i)=>n.path.some(e=>i.has(e.name)),v=class{constructor(i,e){this.file=i;this.tabix=e;this.whole=L({setup:async({signal:i})=>{let{size:e}=await this.file.stat();if(e>we)throw new H(e);let t=await this.file.readFile({signal:i}),a=new TextDecoder().decode(t[0]===31&&t[1]===139?await K(t):t);return E(a)}})}async readIndexed(i,e,t){let a=1/0,r=-1/0;for(let s of e){let c=Number(s);Number.isInteger(c)&&(a=Math.min(a,c),r=Math.max(r,c))}let o=[];return a<=r&&await i.getLines("{node}",a,r+1,{signal:t,lineCallback:s=>{let c=z(s);c&&pe(c,e)&&o.push(c)}}),o}async readsOver(i,{signal:e}={}){let t=this.tabix?await this.readIndexed(this.tabix,i,e):(await this.whole({signal:e})).filter(a=>pe(a,i));return{records:xe(t,be),total:t.length}}};var I=class extends Error{constructor(e){super(e===void 0?"no haplotype index is set, so the walks cannot be named; build one with gbz-haplotype-index (cargo install gbz-haplotype-index) and set it as haplotypeIndexLocation":`the haplotype index beside the graph database could not be checked (${e}), so the walks cannot be named; if it is there, reload to try again, or set haplotypeIndexLocation`);this.name="NoHaplotypeIndexError"}},q=class extends Error{constructor(e,t){super(`the graph is cut on its reference, ${t}; a window on ${e} has no reference coordinates to cut at. Open the graph from a ${t} view, and find this haplotype's lane there`);this.name="HaplotypeWindowError"}};function Se(n,i){return`${u(n)}#${n.contig}@${i.start.node}.${i.start.offset}`}function Ne({alignment:n,assemblyName:i,refName:e,lane:t}){let{refStart:a,refEnd:r,strand:o,cigar:s}=n;if(!(r<=a)){let{name:c,hapStart:p,hapEnd:l}=n,f=Se(c,n),g={uniqueId:f,assemblyName:i,refName:e,start:a,end:r,type:"match",strand:o==="-"?-1:1,CIGAR:s,syntenyId:f,mate:{refName:c.contig,start:p,end:l,assemblyName:t}};return new ne(g)}}function Pe({pair:n,lane:i,mateLane:e}){return se({target:{name:`${u(n.target)}#${n.target.contig}`,assemblyName:i,refName:n.target.contig,start:n.targetStart,end:n.targetEnd},query:{name:`${u(n.query)}#${n.query.contig}`,assemblyName:e,refName:n.query.contig,start:n.queryStart,end:n.queryEnd},strand:n.strand,cigar:n.cigar,matches:n.matches,columns:n.columns})}var Le=12e4;function Re(n,i){let e=new Map;for(let a of n)for(let{name:r,start:o,end:s}of a.walkSpans()){let c=u(r);if(i.has(c)){let p=`${c}#${r.contig}`,l=e.get(p);l?l.push([o,s]):e.set(p,[[o,s]])}}let t=0;for(let a of e.values()){a.sort((r,o)=>r[0]-o[0]);for(let r=1;r<a.length;r++){let o=a[r][0]-a[r-1][1];o>0&&o<=Le&&(t=Math.max(t,o))}}return t}function fe(n,i){return n instanceof Z&&(n.message=`Zoom in to about ${_(n.fitsBp)} to see ${i}`),n}var le=(n,i,e)=>ie(fe(W(n,i,e)??n,"lanes"),e),me=n=>({...n,start:Math.floor(n.start),end:Math.ceil(n.end)}),T=class extends ae{constructor(){super(...arguments);this.graph=L({label:"Opening pangenome database",setup:async()=>{let e=this.getConf("gbzDbLocation"),t=this.getConf("haplotypeIndexLocation"),a=G(t)?{location:t}:await ce(e,this.pluginManager),r=a.location,o=await D.open({source:P(e,this.pluginManager),haplotypeIndex:r?P(r,this.pluginManager):void 0}),s=this.getConf("assemblyNames")[0];if(s===void 0)throw new Error("GbzBaseSyntenyAdapter needs assemblyNames: its first entry is the assembly the reference sample is loaded as");let c=await M(o),p=j({configured:this.getConf("referenceSample"),anchorPrefix:N(this,s),referenceSamples:c});return{db:o,anchor:s,referenceSample:p,referenceSamples:c,unreadableIndex:a.unreadable}}});this.gaf=L({label:"Opening reads",setup:async()=>{let e=this.getConf("readsLocation"),t=this.getConf(["readsIndex","location"]);return G(e)?new v(P(e,this.pluginManager),G(t)?V(this,["readsLocation"],["readsIndex"]):void 0):void 0}})}async referenceQuery(e,t){let{db:a,referenceSample:r}=await this.graph(t);return $(a,r,e)}async getHaplotypes(e={}){let{db:t,referenceSamples:a}=await this.graph(e),r=new Map;for(let o of await t.paths()){let s=u(o.name),c=r.get(s);c?c.contigs.includes(o.name.contig)||c.contigs.push(o.name.contig):r.set(s,{prefix:s,sample:o.name.sample,haplotype:o.name.haplotype,contigs:[o.name.contig],isReference:a.includes(o.name.sample)})}return[...r.values()]}async getHeader(e={}){let{anchor:t,referenceSample:a}=await this.graph(e),r=C(this),o=[];for(let s of await this.getHaplotypes(e))s.sample!==a&&o.push({name:O(r,s.prefix),label:s.prefix,group:s.sample});return{hasCoarseTier:!1,anchorAssemblyName:t,lanes:o}}async getRefNames(e={}){let{db:t,anchor:a,referenceSample:r}=await this.graph(e),{assemblyName:o}=e,s=o===a?void 0:N(this,o),c=(await t.paths()).filter(p=>o===a?p.isIndexed&&p.name.sample===r:F(u(p.name),s)).map(p=>p.name.contig);return[...new Set(c)]}keepPredicate(e,t){let a=e===void 0||e.length===0?void 0:e.map(r=>N(this,r));return a===void 0&&t===void 0?void 0:r=>k(r,a)&&(t===void 0||F(u(r),t))}async getSubgraph(e,t={}){let{signal:a}=t,{db:r,anchor:o,referenceSample:s,unreadableIndex:c}=await this.graph({signal:a}),{assemblyName:p,refName:l,start:f,end:g}=me(e);if(p!==o)throw new q(p,o);let y=await this.referenceQuery(l,{signal:a});if(!y)throw new Error(`${s} has no indexed path ${l} in this graph`);let b=this.keepPredicate(t.haplotypes);if(b!==void 0&&!r.hasHaplotypeIndex)throw new I(c);let d=await U(r,y,f,g,{context:this.getConf("context"),snarls:t.snarls??this.getConf("subgraphSnarls"),limit:this.getConf("nodeLimit"),signal:t.signal,keep:b}).catch(w=>{throw fe(w,"the graph")});return typeof d=="string"?d:te(d,{start:f,end:g},t.walkRows)}async getReads(e,t={}){let a=await this.gaf(t);return a?a.readsOver(new Set(e),t):{records:[],total:0}}async laneHaplotypes(e,t){let a=N(this,e);return(await this.getHaplotypes(t)).filter(r=>F(r.prefix,a))}async anchorFeatures(e,t){let{db:a}=await this.graph(t),{assemblyName:r,refName:o,start:s,end:c}=e,p=N(this,t.targetAssemblyName),l=C(this),f=this.keepPredicate(t.haplotypes,p),g=await this.referenceQuery(o,t),y=this.getConf("nodeLimit");return(g?await B(`Reading graph ${o}:${s.toLocaleString()}-${c.toLocaleString()}`,t.statusCallback,()=>a.getAlignments({path:g,start:s,end:c,context:this.getConf("context"),haplotypes:"all",limit:y,signal:t.signal,keep:f}).catch(d=>{throw le(d,y,c-s)})):[]).flatMap(d=>{let w=d.resolved?Ne({alignment:d,assemblyName:r,refName:o,lane:O(l,u(d.name))}):void 0;return w===void 0?[]:[w]})}async pairFeatures(e,t,a){let{db:r}=await this.graph(a),{refName:o,start:s,end:c}=e,l=(await Promise.all(t.map(async m=>({pair:m,featureSide:await this.laneHaplotypes(m.queryAssemblyName,a),mateSide:await this.laneHaplotypes(m.targetAssemblyName,a)})))).filter(({featureSide:m,mateSide:h})=>m.length>0&&h.length>0),f=new Set(l.flatMap(({featureSide:m,mateSide:h})=>[...m,...h].map(u))),g=await this.referenceQuery(o,a),y=this.getConf("nodeLimit"),b=this.getConf("context"),d=(m,h)=>r.getSubgraphs({path:m,start:s,end:c,context:h,snarls:this.getConf("subgraphSnarls"),haplotypes:"all",limit:y,signal:a.signal,keep:x=>f.has(u(x))}),w=async m=>{let h=await d(m,b).catch(S=>{throw le(S,y,c-s)}),x=Re(h,f),R=Math.ceil(x/2)+2e3;return x>0&&R>b?d(m,R).catch(S=>{if(S instanceof Q)return h;throw S}):h};return(g&&l.length>0?await B(oe(t),a.statusCallback,()=>w(g)):[]).flatMap(m=>l.flatMap(({pair:h,featureSide:x,mateSide:R})=>x.flatMap(S=>R.flatMap(de=>m.pairAlignments({target:S,query:de,bases:!1}).map(he=>Pe({pair:he,lane:h.queryAssemblyName,mateLane:h.targetAssemblyName}))))))}getFeatures(e,t={}){let a=me(e);return ee(async r=>{let{db:o,anchor:s,unreadableIndex:c}=await this.graph(t);if(!o.hasHaplotypeIndex)throw new I(c);if(a.assemblyName===s){let p=re(t),l=p.length>0?await this.pairFeatures(a,p,t):await this.anchorFeatures(a,t);for(let f of l)r.next(f)}r.complete()},t.signal)}};export{I as NoHaplotypeIndexError,ue as PairTargetError,T as default,Re as widestWalkGap};
2
- //# sourceMappingURL=GbzBaseSyntenyAdapter-3PVPTKNW.js.map
@@ -1,10 +0,0 @@
1
- import{a as C}from"./chunk-LGV6BTOY.js";import"./chunk-5LFPNQWH.js";import"./chunk-PTDOYJFH.js";import"./chunk-ZI7RFIA2.js";import{n as d}from"./chunk-JYYF3U2H.js";import"./chunk-KDXVLEHS.js";import"./chunk-SGP63UMC.js";import"./chunk-LJ7O3736.js";import"./chunk-GRLNDNX4.js";import"./chunk-DOC7QIE2.js";import"./chunk-CNEUOM7X.js";import"./chunk-2CPD5NX2.js";import"./chunk-YBLNN5FU.js";import"./chunk-G4OPM6G7.js";import"./chunk-ZFJGNGIB.js";import"./chunk-YBLNN5FU.js";import"./chunk-JRJHXLGP.js";import"./chunk-TWPUVVYH.js";import"./chunk-IKJZPPOA.js";import"./chunk-NDRLCGPC.js";import"./chunk-TENPGIPX.js";import{h as L}from"./chunk-YU7T5WOQ.js";import{A as l,F as G,H as p,e as s,j as v,o as n,x as y}from"./chunk-UGCNPRKC.js";import{a as h,b as e,c as r,d as i}from"./chunk-JMBDTNUR.js";var N=d()({paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto",display:"flex",flexDirection:"column",gap:12},row:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8}}),S=i(function({model:a}){let{classes:t}=N();return!a.error&&!a.loadCanceled?r(l,{className:t.paper,"data-testid":"graph-genome-loading",children:[r("div",{className:t.row,children:[e(v,{variant:"h6",message:a.statusMessage||void 0}),a.canCancelLoad?e(n,{size:"small","data-testid":"graph-genome-cancel",onClick:()=>{a.cancelLoad()},children:"Cancel"}):null]}),e(y,{variant:"indeterminate"})]}):a.error?e(l,{className:t.paper,children:e(s,{error:a.error,onReset:()=>{a.retryLoad()}})}):e(l,{className:t.paper,"data-testid":"graph-genome-load-canceled",children:r("div",{className:t.row,children:[e(p,{variant:"h6",children:"Loading canceled"}),e(n,{variant:"contained",size:"small","data-testid":"graph-genome-retry",onClick:()=>{a.retryLoad()},children:"Retry"})]})})}),f=S;var T=`H VN:Z:1.0
2
- S 1 ACGT
3
- S 2 GGCC
4
- S 3 TTAA
5
- S 4 CCGG
6
- L 1 + 2 + 0M
7
- L 1 + 3 + 0M
8
- L 2 + 4 + 0M
9
- L 3 + 4 + 0M`,E=d()({column:{display:"flex",flexDirection:"column",gap:8},rowEnd:{display:"flex",gap:8,alignItems:"flex-end"},rowCenter:{display:"flex",gap:8,alignItems:"center"},flex1:{flex:1},paper:{padding:16,margin:8,maxWidth:560,marginInline:"auto"},header:{marginBottom:12},footer:{marginTop:12,display:"flex",justifyContent:"flex-end"}}),F=i(function({model:a}){let{classes:t}=E(),[m,w]=L("");function u(){let o=m.trim();o&&a.openGfaLocation({uri:o,locationType:"UriLocation"})}function M(o){let c=o.target.files?.[0];o.target.value="",c&&a.loadGFAFile(c,c.name)}return r(l,{className:t.paper,children:[e("div",{className:t.header,children:e(p,{variant:"h6",children:"Load a GFA graph"})}),r("div",{className:t.column,children:[r("div",{className:t.rowCenter,children:[r(n,{variant:"outlined",component:"label",size:"small",children:["Choose file",e("input",{type:"file",accept:".gfa,.gfa1,.gfa2,.gz",hidden:!0,onChange:o=>{M(o)}})]}),e(p,{variant:"caption",color:"text.secondary",children:"Whole-file GFA; best for small/medium graphs."})]}),r("div",{className:t.rowEnd,children:[e(G,{size:"small",label:"URL",placeholder:"https://example.com/graph.gfa",value:m,onChange:o=>{w(o.target.value)},onKeyDown:o=>{o.key==="Enter"&&u()},className:t.flex1}),e(n,{variant:"contained",onClick:()=>{u()},disabled:!m.trim(),children:"Open"})]})]}),e("div",{className:t.footer,children:e(n,{size:"small",onClick:()=>{a.loadGFA(T,"Example graph")},children:"Load 4-node example"})}),a.error?e(s,{error:a.error}):null]})}),x=F;var B=i(function({model:a}){return a.hasGraph?e(C,{model:a}):a.canRetryLoad?e(f,{model:a}):r(h,{children:[a.isLoading?e(f,{model:a}):null,e("div",{hidden:a.isLoading,children:e(x,{model:a})})]})}),q=B;export{q as default};
10
- //# sourceMappingURL=GraphGenomeView-GQW4YC23.js.map
@@ -1,2 +0,0 @@
1
- import{a as h}from"./chunk-LGV6BTOY.js";import"./chunk-5LFPNQWH.js";import"./chunk-PTDOYJFH.js";import"./chunk-ZI7RFIA2.js";import"./chunk-JYYF3U2H.js";import"./chunk-KDXVLEHS.js";import"./chunk-SGP63UMC.js";import"./chunk-LJ7O3736.js";import"./chunk-GRLNDNX4.js";import"./chunk-DOC7QIE2.js";import"./chunk-CNEUOM7X.js";import"./chunk-2CPD5NX2.js";import"./chunk-YBLNN5FU.js";import"./chunk-G4OPM6G7.js";import"./chunk-ZFJGNGIB.js";import"./chunk-YBLNN5FU.js";import"./chunk-JRJHXLGP.js";import"./chunk-TWPUVVYH.js";import"./chunk-IKJZPPOA.js";import"./chunk-NDRLCGPC.js";import"./chunk-TENPGIPX.js";import{h as T}from"./chunk-YU7T5WOQ.js";import"./chunk-UGCNPRKC.js";import{b as r,c as d,d as i}from"./chunk-JMBDTNUR.js";var n=JBrowseExports["@jbrowse/display-kit/DisplayBackgroundProgress"];var f=n&&n.__esModule?n.default:n;var l=JBrowseExports["@jbrowse/display-kit/DisplayErrorBar"];var v=l&&l.__esModule?l.default:l;var p=JBrowseExports["@jbrowse/display-kit/DisplayLoadingOverlay"];var O=p&&p.__esModule?p.default:p;var c=JBrowseExports["@jbrowse/display-kit/TooLargeMessage"];var L=c&&c.__esModule?c.default:c;var s=JBrowseExports["@jbrowse/display-ui"],u=e=>s!=null&&e in Object(s)?s[e]:Object.assign(function(){throw new Error("This JBrowse does not provide '"+e+"' from '@jbrowse/display-ui' to plugins: GraphGenomeView was built for a different JBrowse version, so update the plugin or JBrowse")},{jbrowseHostMissing:e});var w=u("BottomRightCornerContext");var g=u("TrackOverlayPortal");var C=u("useChromeOverlayOverride");var U=s&&s.__esModule?s.default:s;var k={TooLarge:L,ErrorBar:v,Loading:O,BackgroundProgress:f},m="Zoom in to see features, or force load this track for the rest of the session (may be slow)",M="Force load this track for the rest of the session (may be slow)";function H(e){let{error:o}=e,t=o instanceof Error&&o.regionTooLarge===!0;return{error:{error:o,onRetry:t?void 0:()=>{e.reload()}},tooLarge:{message:[e.regionTooLargeReason,e.zoomCanReleaseGate?m:M].filter(Boolean).join(". "),onForceLoad:()=>{e.forceLoad()}},loading:{message:e.statusMessage,progress:e.statusProgress,canceled:e.fetchCanceled,onCancel:()=>{e.cancelFetchByUser()},onRetry:()=>{e.reload()}},background:{message:e.statusMessage,progress:e.statusProgress}}}var _=i(function({model:o,phase:t,drawn:x,testid:E,style:B,children:G,...S}){let{TooLarge:b,ErrorBar:P,Loading:A,BackgroundProgress:D}=C()??k,[R,I]=T(null),a=H(o),y={...S,"data-testid":E,"data-display-id":o.configuration.displayId,"data-display-drawn":x,"data-display-phase":t};return t==="tooLarge"?r("div",{style:{display:"contents"},...y,children:r(g,{children:r("div",{style:{pointerEvents:"auto"},children:r(b,{model:o,...a.tooLarge})})})}):d("div",{style:{position:"relative",height:o.height,...B},...y,children:[r(w,{value:R,children:G}),d(g,{children:[t==="error"&&o.error!==void 0?r(P,{model:o,visible:!0,...a.error}):null,r(A,{model:o,...a.loading,visible:t==="loading"||t==="canceled",immediate:!x}),r("div",{ref:I,style:{position:"absolute",bottom:2,right:2,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,pointerEvents:"none"},children:t==="ready"&&o.statusMessage?r(D,{model:o,visible:!0,...a.background}):null})]})]})});var j=i(function({model:o}){return r(_,{model:o,phase:o.displayPhase,drawn:o.painted&&o.geometryPainted,testid:"linear-graph-display","data-layout":o.chosenLayoutMode,"data-cut-tier":o.cutTier,"data-recuts":o.recuts,"data-node-count":o.hasGraph?o.nodeCount:void 0,"data-loading":o.isLoading?"":void 0,style:{width:o.paneWidth,height:o.height,overflow:"hidden"},children:r(h,{model:o,ownChrome:!1})})}),so=j;export{so as default};
2
- //# sourceMappingURL=LinearGraphDisplay-QNS4EAL3.js.map
@@ -1,4 +0,0 @@
1
- import{a as I,b as L,f as S,h as w}from"./chunk-G4OPM6G7.js";import{p as T}from"./chunk-ZFJGNGIB.js";var O=62,Z=60,G=9,k=48,z=57,_=/^(?:LN:i|SN:Z|SO:i|SR:i):/,q=/^[PEOUFG]\t/,C=e=>e.endsWith("\r")?e.slice(0,-1):e;function P(){return{nodes:new T(new Int32Array(65536)),reversed:new T(new Uint8Array(65536))}}var R=class{constructor(){this.names=[],this.byName=new Map,this.byNumber=new Map}has(e){return this.byName.has(e)}add(e){let s=this.names.length;this.byName.set(e,s),this.names.push(e);let t=+e;return Number.isSafeInteger(t)&&String(t)===e&&this.byNumber.set(t,s),s}of(e){return this.byName.get(e)??this.add(e)}ofNumber(e){return this.byNumber.get(e)}};function U(e){let[,s,t="*",...r]=e.split(" ");if(!s||/^\d+$/.test(t))return;let i=t==="*"?0:t.length,n,f,o;for(let c of r){if(!_.test(c))return;let a=c.slice(5),p=c.slice(0,2);p==="LN"?i=+a:p==="SN"?n=a:p==="SO"?f=+a:o=+a}return{name:s,length:i,stable:n!==void 0&&f!==void 0&&o!==void 0?{refName:n,start:f,rank:o}:void 0}}function $(e,s,t,r){let i=0,n=-1,f=0,o=!0,d=a=>{if(n>=0&&a>n){let p=o&&a-n<16&&(a-n===1||e.charCodeAt(n)!==k)?t.ofNumber(f):void 0;r.nodes.push(p??t.of(e.slice(n,a))),r.reversed.push(i)}},c=s;for(;c<e.length;c++){let a=e.charCodeAt(c);if(a===O||a===Z)d(c),i=a===Z?1:0,n=c+1,f=0,o=!0;else{if(a===G)break;o&&a>=k&&a<=z?f=f*10+a-k:o=!1}}return d(c),c}function x(e){let s=[],t=0;for(;s.length<6;){let d=e.indexOf(" ",t);if(d===-1)return;s.push(e.slice(t,d)),t=d+1}let[,r,i,n,f,o]=s;return r&&i&&n&&f&&o&&t<e.length?{sample:r,haplotype:i,contig:n,start:f,end:o,body:t}:void 0}function K(e){let s=e.split(`
2
- `),t=new R,r=[],i=[],n=[],f=[],o=[],d=new Map;for(let u of s){if(q.test(u))return;if(u.startsWith("S ")){let l=U(C(u));if(!l||t.has(l.name))return;t.add(l.name),r.push(l.length);let h=-1;l.stable&&(h=d.get(l.stable.refName)??o.length,h===o.length&&(o.push(l.stable.refName),d.set(l.stable.refName,h))),i.push(h),n.push(l.stable?.start??0),f.push(l.stable?.rank??0)}}let c=[],a=[],p=[],v=[],E=[],W=[],y=[0],g=P(),A=new w,N=new w;for(let u of s)if(u.startsWith("L ")){let[,l,h,b,m]=C(u).split(" ");l&&b&&m&&(c.push(t.of(l)),a.push(t.of(b)),p.push((h==="-"?1:0)|(m==="-"?2:0)))}else if(u.startsWith("W ")){let l=C(u),h=x(l);if(h){v.push(`${h.sample}#${h.haplotype}#${h.contig}`),E.push(h.start==="*"?0:+h.start),W.push(h.end==="*"?-1:+h.end);let b=$(l,h.body,t,g),m=F(l,b);if(m===void 0||(m.before&&A.push(m.before),m.after&&N.push(m.after),g.nodes.length===y.at(-1)))return;y.push(g.nodes.length)}}if(![A.kinds.length,N.kinds.length].some(u=>u>0&&u<v.length))return{nodes:{names:t.names,lengths:Int32Array.from(r),refs:Int32Array.from(i),starts:Float64Array.from(n),ranks:Int32Array.from(f),refNames:o},links:{from:Int32Array.from(c),to:Int32Array.from(a),strands:Uint8Array.from(p)},walks:{names:v,starts:Float64Array.from(E),ends:Float64Array.from(W),offsets:Int32Array.from(y),steps:g.nodes.data.slice(0,g.nodes.length),reversed:g.reversed.data.slice(0,g.reversed.length),...B(v.length,A,N)}}}function F(e,s){let t={};for(let r of s<e.length?e.slice(s+1).split(" "):[]){let i=r.slice(5);if(r.startsWith(`${I}:Z:`)){if(t.before=S(i),!t.before)return}else if(r.startsWith(`${L}:Z:`)&&(t.after=S(i),!t.after))return}return t}function B(e,s,t){return{...s.kinds.length===e&&e>0?{before:s.table()}:{},...t.kinds.length===e&&e>0?{after:t.table()}:{}}}var D=/([><])([^><]+)/g;function M(e){if(!e.startsWith(">")&&!e.startsWith("<"))return;let s=[];for(let[,t,r]of e.matchAll(D))s.push({name:r,strand:t===">"?"+":"-"});return s}function Q(e){let s=e.trimEnd(),t=s.split(" ");if(t.length<12||s.startsWith("#"))return;let r=M(t[5]);if(!r)return;let i,n=!1;for(let f=12;f<t.length;f++){let o=t[f];o.startsWith("cs:Z:")?i=o.slice(5):o==="tp:A:S"&&(n=!0)}return{name:t[0],queryLength:+t[1],queryStart:+t[2],queryEnd:+t[3],strand:t[4]==="-"?"-":"+",path:r,pathLength:+t[6],pathStart:+t[7],pathEnd:+t[8],matches:+t[9],blockLength:+t[10],mappingQuality:+t[11],secondary:n,...i===void 0?{}:{cs:i}}}function Y(e){let s=[];for(let t of e.split(`
3
- `)){let r=Q(t);r&&s.push(r)}return s}var j=/:(\d+)|=([A-Za-z]+)|\*[a-zA-Z]([a-zA-Z])|\+([A-Za-z]+)|-([A-Za-z]+)|~[a-z]{2}(\d+)[a-z]{2}/g;function tt(e){let s=[];for(let t of e.matchAll(j))t[1]!==void 0?s.push({op:"match",length:+t[1]}):t[2]!==void 0?s.push({op:"match",length:t[2].length}):t[3]!==void 0?s.push({op:"substitution",seq:t[3].toUpperCase()}):t[4]!==void 0?s.push({op:"insertion",seq:t[4].toUpperCase()}):t[5]!==void 0?s.push({op:"deletion",length:t[5].length}):t[6]!==void 0&&s.push({op:"match",length:+t[6]});return s}export{K as a,Q as b,Y as c,tt as d};
4
- //# sourceMappingURL=chunk-2CPD5NX2.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../node_modules/.pnpm/@jbrowse+bandage-core@11.14.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-VSSIYQYF.js", "../../node_modules/.pnpm/@jbrowse+bandage-core@11.14.0/node_modules/@jbrowse/bandage-core/dist/chunks/chunk-5OJZV6YT.js"],
4
- "sourcesContent": ["import {\n END_STOP_TAG,\n START_STOP_TAG,\n StopColumns,\n parseStopTag\n} from \"./chunk-LG2UK4MB.js\";\nimport {\n Column\n} from \"./chunk-ZPZ7GNBT.js\";\n\n// src/gfa/gfaTables.ts\nvar GT = 62;\nvar LT = 60;\nvar TAB = 9;\nvar ZERO = 48;\nvar NINE = 57;\nvar TABLE_TAG = /^(?:LN:i|SN:Z|SO:i|SR:i):/;\nvar UNTABLED_RECORD = /^[PEOUFG]\\t/;\nvar trimCR = (line) => line.endsWith(\"\\r\") ? line.slice(0, -1) : line;\nfunction stepColumns() {\n return {\n nodes: new Column(new Int32Array(1 << 16)),\n reversed: new Column(new Uint8Array(1 << 16))\n };\n}\nvar SegmentIndex = class {\n constructor() {\n this.names = [];\n this.byName = /* @__PURE__ */ new Map();\n // ids that are plain decimal, so a walk step finds its segment without\n // slicing a string out of the body\n this.byNumber = /* @__PURE__ */ new Map();\n }\n has(name) {\n return this.byName.has(name);\n }\n add(name) {\n const i = this.names.length;\n this.byName.set(name, i);\n this.names.push(name);\n const n = +name;\n if (Number.isSafeInteger(n) && String(n) === name) {\n this.byNumber.set(n, i);\n }\n return i;\n }\n of(name) {\n return this.byName.get(name) ?? this.add(name);\n }\n ofNumber(n) {\n return this.byNumber.get(n);\n }\n};\nfunction readSegment(line) {\n const [, name, sequence = \"*\", ...tags] = line.split(\"\t\");\n if (!name || /^\\d+$/.test(sequence)) {\n return void 0;\n }\n let length = sequence === \"*\" ? 0 : sequence.length;\n let refName;\n let start;\n let rank;\n for (const tag of tags) {\n if (!TABLE_TAG.test(tag)) {\n return void 0;\n }\n const value = tag.slice(5);\n const key = tag.slice(0, 2);\n if (key === \"LN\") {\n length = +value;\n } else if (key === \"SN\") {\n refName = value;\n } else if (key === \"SO\") {\n start = +value;\n } else {\n rank = +value;\n }\n }\n const stable = refName !== void 0 && start !== void 0 && rank !== void 0 ? { refName, start, rank } : void 0;\n return { name, length, stable };\n}\nfunction readWalkBody(line, from, segments, steps) {\n let reversed = 0;\n let start = -1;\n let value = 0;\n let decimal = true;\n const finish = (end) => {\n if (start >= 0 && end > start) {\n const node = decimal && end - start < 16 && (end - start === 1 || line.charCodeAt(start) !== ZERO) ? segments.ofNumber(value) : void 0;\n steps.nodes.push(node ?? segments.of(line.slice(start, end)));\n steps.reversed.push(reversed);\n }\n };\n let i = from;\n for (; i < line.length; i++) {\n const ch = line.charCodeAt(i);\n if (ch === GT || ch === LT) {\n finish(i);\n reversed = ch === LT ? 1 : 0;\n start = i + 1;\n value = 0;\n decimal = true;\n } else if (ch === TAB) {\n break;\n } else if (decimal && ch >= ZERO && ch <= NINE) {\n value = value * 10 + ch - ZERO;\n } else {\n decimal = false;\n }\n }\n finish(i);\n return i;\n}\nfunction walkFields(line) {\n const fields = [];\n let at = 0;\n while (fields.length < 6) {\n const tab = line.indexOf(\"\t\", at);\n if (tab === -1) {\n return void 0;\n }\n fields.push(line.slice(at, tab));\n at = tab + 1;\n }\n const [, sample, haplotype, contig, start, end] = fields;\n return sample && haplotype && contig && start && end && at < line.length ? { sample, haplotype, contig, start, end, body: at } : void 0;\n}\nfunction gfaTables(text) {\n const lines = text.split(\"\\n\");\n const segments = new SegmentIndex();\n const lengths = [];\n const refs = [];\n const starts = [];\n const ranks = [];\n const refNames = [];\n const refIndex = /* @__PURE__ */ new Map();\n for (const raw of lines) {\n if (UNTABLED_RECORD.test(raw)) {\n return void 0;\n }\n if (raw.startsWith(\"S\t\")) {\n const s = readSegment(trimCR(raw));\n if (!s || segments.has(s.name)) {\n return void 0;\n }\n segments.add(s.name);\n lengths.push(s.length);\n let ref = -1;\n if (s.stable) {\n ref = refIndex.get(s.stable.refName) ?? refNames.length;\n if (ref === refNames.length) {\n refNames.push(s.stable.refName);\n refIndex.set(s.stable.refName, ref);\n }\n }\n refs.push(ref);\n starts.push(s.stable?.start ?? 0);\n ranks.push(s.stable?.rank ?? 0);\n }\n }\n const from = [];\n const to = [];\n const strands = [];\n const names = [];\n const walkStarts = [];\n const walkEnds = [];\n const offsets = [0];\n const steps = stepColumns();\n const before = new StopColumns();\n const after = new StopColumns();\n for (const raw of lines) {\n if (raw.startsWith(\"L\t\")) {\n const [, source, strand1, target, strand2] = trimCR(raw).split(\"\t\");\n if (source && target && strand2) {\n from.push(segments.of(source));\n to.push(segments.of(target));\n strands.push((strand1 === \"-\" ? 1 : 0) | (strand2 === \"-\" ? 2 : 0));\n }\n } else if (raw.startsWith(\"W\t\")) {\n const line = trimCR(raw);\n const w = walkFields(line);\n if (w) {\n names.push(`${w.sample}#${w.haplotype}#${w.contig}`);\n walkStarts.push(w.start === \"*\" ? 0 : +w.start);\n walkEnds.push(w.end === \"*\" ? -1 : +w.end);\n const end = readWalkBody(line, w.body, segments, steps);\n const tags = walkTags(line, end);\n if (tags === void 0) {\n return void 0;\n }\n if (tags.before) {\n before.push(tags.before);\n }\n if (tags.after) {\n after.push(tags.after);\n }\n if (steps.nodes.length === offsets.at(-1)) {\n return void 0;\n }\n offsets.push(steps.nodes.length);\n }\n }\n }\n if ([before.kinds.length, after.kinds.length].some(\n (n) => n > 0 && n < names.length\n )) {\n return void 0;\n }\n return {\n nodes: {\n names: segments.names,\n lengths: Int32Array.from(lengths),\n refs: Int32Array.from(refs),\n starts: Float64Array.from(starts),\n ranks: Int32Array.from(ranks),\n refNames\n },\n links: {\n from: Int32Array.from(from),\n to: Int32Array.from(to),\n strands: Uint8Array.from(strands)\n },\n walks: {\n names,\n starts: Float64Array.from(walkStarts),\n ends: Float64Array.from(walkEnds),\n offsets: Int32Array.from(offsets),\n steps: steps.nodes.data.slice(0, steps.nodes.length),\n reversed: steps.reversed.data.slice(0, steps.reversed.length),\n ...stopColumns(names.length, before, after)\n }\n };\n}\nfunction walkTags(line, from) {\n const out = {};\n for (const tag of from < line.length ? line.slice(from + 1).split(\"\t\") : []) {\n const value = tag.slice(5);\n if (tag.startsWith(`${START_STOP_TAG}:Z:`)) {\n out.before = parseStopTag(value);\n if (!out.before) {\n return void 0;\n }\n } else if (tag.startsWith(`${END_STOP_TAG}:Z:`)) {\n out.after = parseStopTag(value);\n if (!out.after) {\n return void 0;\n }\n }\n }\n return out;\n}\nfunction stopColumns(walks, before, after) {\n return {\n ...before.kinds.length === walks && walks > 0 ? { before: before.table() } : {},\n ...after.kinds.length === walks && walks > 0 ? { after: after.table() } : {}\n };\n}\n\nexport {\n gfaTables\n};\n", "// src/gaf/parseGaf.ts\nvar STEP = /([><])([^><]+)/g;\nfunction parseGafPath(column) {\n if (!column.startsWith(\">\") && !column.startsWith(\"<\")) {\n return void 0;\n }\n const steps = [];\n for (const [, arrow, name] of column.matchAll(STEP)) {\n steps.push({ name, strand: arrow === \">\" ? \"+\" : \"-\" });\n }\n return steps;\n}\nfunction parseGafLine(text) {\n const line = text.trimEnd();\n const columns = line.split(\"\t\");\n if (columns.length < 12 || line.startsWith(\"#\")) {\n return void 0;\n }\n const path = parseGafPath(columns[5]);\n if (!path) {\n return void 0;\n }\n let cs;\n let secondary = false;\n for (let i = 12; i < columns.length; i++) {\n const tag = columns[i];\n if (tag.startsWith(\"cs:Z:\")) {\n cs = tag.slice(5);\n } else if (tag === \"tp:A:S\") {\n secondary = true;\n }\n }\n return {\n name: columns[0],\n queryLength: +columns[1],\n queryStart: +columns[2],\n queryEnd: +columns[3],\n strand: columns[4] === \"-\" ? \"-\" : \"+\",\n path,\n pathLength: +columns[6],\n pathStart: +columns[7],\n pathEnd: +columns[8],\n matches: +columns[9],\n blockLength: +columns[10],\n mappingQuality: +columns[11],\n secondary,\n ...cs === void 0 ? {} : { cs }\n };\n}\nfunction parseGaf(text) {\n const records = [];\n for (const line of text.split(\"\\n\")) {\n const record = parseGafLine(line);\n if (record) {\n records.push(record);\n }\n }\n return records;\n}\nvar CS_OP = /:(\\d+)|=([A-Za-z]+)|\\*[a-zA-Z]([a-zA-Z])|\\+([A-Za-z]+)|-([A-Za-z]+)|~[a-z]{2}(\\d+)[a-z]{2}/g;\nfunction parseCs(cs) {\n const ops = [];\n for (const m of cs.matchAll(CS_OP)) {\n if (m[1] !== void 0) {\n ops.push({ op: \"match\", length: +m[1] });\n } else if (m[2] !== void 0) {\n ops.push({ op: \"match\", length: m[2].length });\n } else if (m[3] !== void 0) {\n ops.push({ op: \"substitution\", seq: m[3].toUpperCase() });\n } else if (m[4] !== void 0) {\n ops.push({ op: \"insertion\", seq: m[4].toUpperCase() });\n } else if (m[5] !== void 0) {\n ops.push({ op: \"deletion\", length: m[5].length });\n } else if (m[6] !== void 0) {\n ops.push({ op: \"match\", length: +m[6] });\n }\n }\n return ops;\n}\n\nexport {\n parseGafPath,\n parseGafLine,\n parseGaf,\n parseCs\n};\n"],
5
- "mappings": "qGAWA,IAAIA,EAAK,GACLC,EAAK,GACLC,EAAM,EACNC,EAAO,GACPC,EAAO,GACPC,EAAY,4BACZC,EAAkB,cAClBC,EAAUC,GAASA,EAAK,SAAS,IAAI,EAAIA,EAAK,MAAM,EAAG,EAAE,EAAIA,EACjE,SAASC,GAAc,CACrB,MAAO,CACL,MAAO,IAAIC,EAAO,IAAI,WAAW,KAAO,CAAC,EACzC,SAAU,IAAIA,EAAO,IAAI,WAAW,KAAO,CAAC,CAC9C,CACF,CACA,IAAIC,EAAe,KAAM,CACvB,aAAc,CACZ,KAAK,MAAQ,CAAC,EACd,KAAK,OAAyB,IAAI,IAGlC,KAAK,SAA2B,IAAI,GACtC,CACA,IAAIC,EAAM,CACR,OAAO,KAAK,OAAO,IAAIA,CAAI,CAC7B,CACA,IAAIA,EAAM,CACR,IAAMC,EAAI,KAAK,MAAM,OACrB,KAAK,OAAO,IAAID,EAAMC,CAAC,EACvB,KAAK,MAAM,KAAKD,CAAI,EACpB,IAAME,EAAI,CAACF,EACX,OAAI,OAAO,cAAcE,CAAC,GAAK,OAAOA,CAAC,IAAMF,GAC3C,KAAK,SAAS,IAAIE,EAAGD,CAAC,EAEjBA,CACT,CACA,GAAGD,EAAM,CAC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E,GAAI,YAAa,IAAKC,EAAE,CAAC,EAAE,YAAY,CAAE,CAAC,EAC5CA,EAAE,CAAC,IAAM,OAClBD,EAAI,KAAK,CAAE,GAAI,WAAY,OAAQC,EAAE,CAAC,EAAE,MAAO,CAAC,EACvCA,EAAE,CAAC,IAAM,QAClBD,EAAI,KAAK,CAAE,GAAI,QAAS,OAAQ,CAACC,EAAE,CAAC,CAAE,CAAC,EAG3C,OAAOD,CACT",
6
- "names": ["GT", "LT", "TAB", "ZERO", "NINE", "TABLE_TAG", "UNTABLED_RECORD", "trimCR", "line", "stepColumns", "Column", "SegmentIndex", "name", "i", "n", "readSegment", "sequence", "tags", "length", "refName", "start", "rank", "tag", "value", "key", "readWalkBody", "from", "segments", "steps", "reversed", "decimal", "finish", "end", "node", "ch", "walkFields", "fields", "at", "tab", "sample", "haplotype", "contig", "gfaTables", "text", "lines", "lengths", "refs", "starts", "ranks", "refNames", "refIndex", "raw", "s", "ref", "to", "strands", "names", "walkStarts", "walkEnds", "offsets", "before", "StopColumns", "after", "source", "strand1", "target", "strand2", "w", "walkTags", "stopColumns", "out", "START_STOP_TAG", "parseStopTag", "END_STOP_TAG", "walks", "STEP", "parseGafPath", "column", "steps", "arrow", "name", "parseGafLine", "text", "line", "columns", "path", "cs", "secondary", "i", "tag", "parseGaf", "records", "record", "CS_OP", "parseCs", "ops", "m"]
7
- }