jbrowse-plugin-tview 2.0.4

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 (81) hide show
  1. package/README.md +59 -0
  2. package/dist/AddHighlightModel/GenomeMouseoverHighlight.d.ts +6 -0
  3. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js +23 -0
  4. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js.map +1 -0
  5. package/dist/AddHighlightModel/Highlight.d.ts +10 -0
  6. package/dist/AddHighlightModel/Highlight.js +15 -0
  7. package/dist/AddHighlightModel/Highlight.js.map +1 -0
  8. package/dist/AddHighlightModel/HighlightComponents.d.ts +7 -0
  9. package/dist/AddHighlightModel/HighlightComponents.js +11 -0
  10. package/dist/AddHighlightModel/HighlightComponents.js.map +1 -0
  11. package/dist/AddHighlightModel/MsaToGenomeHighlight.d.ts +6 -0
  12. package/dist/AddHighlightModel/MsaToGenomeHighlight.js +15 -0
  13. package/dist/AddHighlightModel/MsaToGenomeHighlight.js.map +1 -0
  14. package/dist/AddHighlightModel/index.d.ts +2 -0
  15. package/dist/AddHighlightModel/index.js +19 -0
  16. package/dist/AddHighlightModel/index.js.map +1 -0
  17. package/dist/AddHighlightModel/util.d.ts +9 -0
  18. package/dist/AddHighlightModel/util.js +14 -0
  19. package/dist/AddHighlightModel/util.js.map +1 -0
  20. package/dist/LaunchTView/align.d.ts +20 -0
  21. package/dist/LaunchTView/align.js +121 -0
  22. package/dist/LaunchTView/align.js.map +1 -0
  23. package/dist/LaunchTView/components/LaunchTViewDialog.d.ts +6 -0
  24. package/dist/LaunchTView/components/LaunchTViewDialog.js +87 -0
  25. package/dist/LaunchTView/components/LaunchTViewDialog.js.map +1 -0
  26. package/dist/LaunchTView/fetchTviewPlan.d.ts +51 -0
  27. package/dist/LaunchTView/fetchTviewPlan.js +43 -0
  28. package/dist/LaunchTView/fetchTviewPlan.js.map +1 -0
  29. package/dist/LaunchTView/index.d.ts +2 -0
  30. package/dist/LaunchTView/index.js +41 -0
  31. package/dist/LaunchTView/index.js.map +1 -0
  32. package/dist/LaunchTView/limits.d.ts +2 -0
  33. package/dist/LaunchTView/limits.js +8 -0
  34. package/dist/LaunchTView/limits.js.map +1 -0
  35. package/dist/LaunchTView/tview.d.ts +95 -0
  36. package/dist/LaunchTView/tview.js +191 -0
  37. package/dist/LaunchTView/tview.js.map +1 -0
  38. package/dist/LaunchTView/useTviewMsa.d.ts +14 -0
  39. package/dist/LaunchTView/useTviewMsa.js +20 -0
  40. package/dist/LaunchTView/useTviewMsa.js.map +1 -0
  41. package/dist/TViewPanel/components/TViewPanel.d.ts +6 -0
  42. package/dist/TViewPanel/components/TViewPanel.js +11 -0
  43. package/dist/TViewPanel/components/TViewPanel.js.map +1 -0
  44. package/dist/TViewPanel/coords.d.ts +17 -0
  45. package/dist/TViewPanel/coords.js +36 -0
  46. package/dist/TViewPanel/coords.js.map +1 -0
  47. package/dist/TViewPanel/index.d.ts +2 -0
  48. package/dist/TViewPanel/index.js +15 -0
  49. package/dist/TViewPanel/index.js.map +1 -0
  50. package/dist/TViewPanel/model.d.ts +1028 -0
  51. package/dist/TViewPanel/model.js +246 -0
  52. package/dist/TViewPanel/model.js.map +1 -0
  53. package/dist/config.json +8 -0
  54. package/dist/index.d.ts +8 -0
  55. package/dist/index.js +19 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/jbrowse-plugin-tview.umd.production.min.js +104 -0
  58. package/dist/jbrowse-plugin-tview.umd.production.min.js.map +7 -0
  59. package/dist/version.d.ts +1 -0
  60. package/dist/version.js +2 -0
  61. package/dist/version.js.map +1 -0
  62. package/package.json +76 -0
  63. package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +46 -0
  64. package/src/AddHighlightModel/Highlight.tsx +35 -0
  65. package/src/AddHighlightModel/HighlightComponents.tsx +25 -0
  66. package/src/AddHighlightModel/MsaToGenomeHighlight.tsx +31 -0
  67. package/src/AddHighlightModel/index.tsx +28 -0
  68. package/src/AddHighlightModel/util.ts +14 -0
  69. package/src/LaunchTView/align.ts +154 -0
  70. package/src/LaunchTView/components/LaunchTViewDialog.tsx +129 -0
  71. package/src/LaunchTView/fetchTviewPlan.ts +95 -0
  72. package/src/LaunchTView/index.ts +53 -0
  73. package/src/LaunchTView/limits.ts +8 -0
  74. package/src/LaunchTView/tview.ts +272 -0
  75. package/src/LaunchTView/useTviewMsa.ts +36 -0
  76. package/src/TViewPanel/components/TViewPanel.tsx +20 -0
  77. package/src/TViewPanel/coords.ts +43 -0
  78. package/src/TViewPanel/index.ts +20 -0
  79. package/src/TViewPanel/model.ts +289 -0
  80. package/src/index.ts +21 -0
  81. package/src/version.ts +1 -0
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # jbrowse-plugin-tview
2
+
3
+ Loads BAM/CRAM read pileups into
4
+ [react-msaview](https://github.com/GMOD/react-msaview) for a `samtools tview`
5
+ style interface inside JBrowse 2.
6
+
7
+ Because the reads are laid out as a multiple alignment, non-reference insertions
8
+ get their own columns instead of being collapsed into a marker: every read that
9
+ inserts at a position contributes its bases, and reads without that insertion
10
+ are padded so the reference columns still line up.
11
+
12
+ ## Gallery
13
+
14
+ ![tview expanding a non-reference insertion](img/tview-insertion.png)
15
+
16
+ The same reads at `ctgA:15,140..15,190`, twice. In the pileup above, the 1bp
17
+ insertion at 15,163 is collapsed into a column of purple `(1)` markers. In the
18
+ tview panel below it gets a real column (highlighted): reads carrying the
19
+ insertion show their base, reads that span the position without it show `-`, and
20
+ reads that do not cover it show `.` — so every row stays the same width and the
21
+ reference columns still line up.
22
+
23
+ Regenerate with `pnpm figure`.
24
+
25
+ ## Usage
26
+
27
+ - Install the plugin
28
+ - Open the track menu (vertical `...`) on an alignments track
29
+ - Click "Launch tview for visible region"
30
+
31
+ The launched view stays connected to the genome view it came from: hovering or
32
+ clicking an alignment column highlights the corresponding genome position, and
33
+ clicking navigates there. "Zoom to base level on click?" in the view menu
34
+ switches between centering and zooming.
35
+
36
+ The visible region is capped at 20kb, since one column per base gets unwieldy
37
+ beyond that.
38
+
39
+ ## Requirements
40
+
41
+ Needs a JBrowse build shipping `@jbrowse/core` >=4.3 with MUI 9 — currently
42
+ jbrowse-web nightly. On JBrowse 4.3.0 the bundle fails to load, because
43
+ react-msaview 5.x needs `@jbrowse/mobx-state-tree` 5.13 APIs and MUI 9 icon
44
+ internals that the 4.3.0 release does not ship.
45
+
46
+ ## Development
47
+
48
+ ```bash
49
+ pnpm install
50
+ pnpm start # dev server on :9000, serves dist/out.js with CORS
51
+ pnpm test # unit tests
52
+ pnpm test:e2e # puppeteer tests (creates .test-jbrowse nightly on first run)
53
+ pnpm lint
54
+ pnpm build
55
+ ```
56
+
57
+ `pnpm start` serves the repo root, so a JBrowse instance unpacked at
58
+ `.test-jbrowse` can load the plugin from the same origin via
59
+ `http://localhost:9000/.test-jbrowse/index.html?config=../public/config.json`.
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
3
+ declare const GenomeMouseoverHighlight: ({ model, }: {
4
+ model: LinearGenomeViewModel;
5
+ }) => React.JSX.Element | null;
6
+ export default GenomeMouseoverHighlight;
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { getSession } from '@jbrowse/core/util';
3
+ import { observer } from 'mobx-react';
4
+ import Highlight from './Highlight';
5
+ function getHoverPosition(hovered) {
6
+ const pos = !!hovered && typeof hovered === 'object' && 'hoverPosition' in hovered
7
+ ? hovered.hoverPosition
8
+ : undefined;
9
+ return !!pos &&
10
+ typeof pos === 'object' &&
11
+ 'coord' in pos &&
12
+ typeof pos.coord === 'number' &&
13
+ 'refName' in pos &&
14
+ typeof pos.refName === 'string'
15
+ ? { coord: pos.coord, refName: pos.refName }
16
+ : undefined;
17
+ }
18
+ const GenomeMouseoverHighlight = observer(function GenomeMouseoverHighlight2({ model, }) {
19
+ const hoverPosition = getHoverPosition(getSession(model).hovered);
20
+ return hoverPosition ? (React.createElement(Highlight, { model: model, refName: hoverPosition.refName, start: hoverPosition.coord - 1, end: hoverPosition.coord })) : null;
21
+ });
22
+ export default GenomeMouseoverHighlight;
23
+ //# sourceMappingURL=GenomeMouseoverHighlight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenomeMouseoverHighlight.js","sourceRoot":"","sources":["../../src/AddHighlightModel/GenomeMouseoverHighlight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,SAAS,MAAM,aAAa,CAAA;AASnC,SAAS,gBAAgB,CAAC,OAAgB;IACxC,MAAM,GAAG,GACP,CAAC,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,eAAe,IAAI,OAAO;QACpE,CAAC,CAAC,OAAO,CAAC,aAAa;QACvB,CAAC,CAAC,SAAS,CAAA;IACf,OAAO,CAAC,CAAC,GAAG;QACV,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAO,IAAI,GAAG;QACd,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ;QAC7B,SAAS,IAAI,GAAG;QAChB,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;QAC/B,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE;QAC5C,CAAC,CAAC,SAAS,CAAA;AACf,CAAC;AAED,MAAM,wBAAwB,GAAG,QAAQ,CAAC,SAAS,yBAAyB,CAAC,EAC3E,KAAK,GAGN;IACC,MAAM,aAAa,GAAG,gBAAgB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAA;IACjE,OAAO,aAAa,CAAC,CAAC,CAAC,CACrB,oBAAC,SAAS,IACR,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,aAAa,CAAC,OAAO,EAC9B,KAAK,EAAE,aAAa,CAAC,KAAK,GAAG,CAAC,EAC9B,GAAG,EAAE,aAAa,CAAC,KAAK,GACxB,CACH,CAAC,CAAC,CAAC,IAAI,CAAA;AACV,CAAC,CAAC,CAAA;AAEF,eAAe,wBAAwB,CAAA"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
3
+ /** a band over one genome interval, positioned in the tracks container */
4
+ declare const Highlight: ({ model, refName, start, end, }: {
5
+ model: LinearGenomeViewModel;
6
+ refName: string;
7
+ start: number;
8
+ end: number;
9
+ }) => React.JSX.Element | null;
10
+ export default Highlight;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { observer } from 'mobx-react';
3
+ import { useStyles } from './util';
4
+ /** a band over one genome interval, positioned in the tracks container */
5
+ const Highlight = observer(function Highlight2({ model, refName, start, end, }) {
6
+ const { classes } = useStyles();
7
+ const s = model.bpToPx({ refName, coord: start });
8
+ const e = model.bpToPx({ refName, coord: end });
9
+ return s && e ? (React.createElement("div", { className: classes.highlight, style: {
10
+ left: Math.min(s.offsetPx, e.offsetPx) - model.offsetPx,
11
+ width: Math.max(Math.abs(e.offsetPx - s.offsetPx), 4),
12
+ } })) : null;
13
+ });
14
+ export default Highlight;
15
+ //# sourceMappingURL=Highlight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Highlight.js","sourceRoot":"","sources":["../../src/AddHighlightModel/Highlight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAIlC,0EAA0E;AAC1E,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,UAAU,CAAC,EAC7C,KAAK,EACL,OAAO,EACP,KAAK,EACL,GAAG,GAMJ;IACC,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAA;IAC/B,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;IACjD,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACd,6BACE,SAAS,EAAE,OAAO,CAAC,SAAS,EAC5B,KAAK,EAAE;YACL,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ;YACvD,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;SACtD,GACD,CACH,CAAC,CAAC,CAAC,IAAI,CAAA;AACV,CAAC,CAAC,CAAA;AAEF,eAAe,SAAS,CAAA"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
3
+ type LGV = LinearGenomeViewModel;
4
+ declare const HighlightComponents: ({ model, }: {
5
+ model: LGV;
6
+ }) => React.JSX.Element;
7
+ export default HighlightComponents;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { observer } from 'mobx-react';
3
+ import GenomeMouseoverHighlight from './GenomeMouseoverHighlight';
4
+ import MsaToGenomeHighlight from './MsaToGenomeHighlight';
5
+ const HighlightComponents = observer(function HighlightComponents2({ model, }) {
6
+ return (React.createElement(React.Fragment, null,
7
+ React.createElement(MsaToGenomeHighlight, { model: model }),
8
+ React.createElement(GenomeMouseoverHighlight, { model: model })));
9
+ });
10
+ export default HighlightComponents;
11
+ //# sourceMappingURL=HighlightComponents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HighlightComponents.js","sourceRoot":"","sources":["../../src/AddHighlightModel/HighlightComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,wBAAwB,MAAM,4BAA4B,CAAA;AACjE,OAAO,oBAAoB,MAAM,wBAAwB,CAAA;AAMzD,MAAM,mBAAmB,GAAG,QAAQ,CAAC,SAAS,oBAAoB,CAAC,EACjE,KAAK,GAGN;IACC,OAAO,CACL;QACE,oBAAC,oBAAoB,IAAC,KAAK,EAAE,KAAK,GAAI;QACtC,oBAAC,wBAAwB,IAAC,KAAK,EAAE,KAAK,GAAI,CACzC,CACJ,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,mBAAmB,CAAA"}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
3
+ declare const MsaToGenomeHighlight: ({ model, }: {
4
+ model: LinearGenomeViewModel;
5
+ }) => React.JSX.Element;
6
+ export default MsaToGenomeHighlight;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { getSession } from '@jbrowse/core/util';
3
+ import { observer } from 'mobx-react';
4
+ import Highlight from './Highlight';
5
+ import { isTView } from '../TViewPanel/model';
6
+ const MsaToGenomeHighlight = observer(function MsaToGenomeHighlight2({ model, }) {
7
+ const { views } = getSession(model);
8
+ const highlights = views
9
+ .filter(isTView)
10
+ .filter(v => v.connectedViewId === model.id)
11
+ .flatMap(v => v.connectedHighlights);
12
+ return (React.createElement(React.Fragment, null, highlights.map(r => (React.createElement(Highlight, { key: `${r.refName}:${r.start}`, model: model, ...r })))));
13
+ });
14
+ export default MsaToGenomeHighlight;
15
+ //# sourceMappingURL=MsaToGenomeHighlight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MsaToGenomeHighlight.js","sourceRoot":"","sources":["../../src/AddHighlightModel/MsaToGenomeHighlight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAI7C,MAAM,oBAAoB,GAAG,QAAQ,CAAC,SAAS,qBAAqB,CAAC,EACnE,KAAK,GAGN;IACC,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IACnC,MAAM,UAAU,GAAG,KAAK;SACrB,MAAM,CAAC,OAAO,CAAC;SACf,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,KAAK,KAAK,CAAC,EAAE,CAAC;SAC3C,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAA;IAEtC,OAAO,CACL,0CACG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CACnB,oBAAC,SAAS,IAAC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,KAAM,CAAC,GAAI,CACnE,CAAC,CACD,CACJ,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,oBAAoB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function AddHighlightComponentsModelF(pluginManager: PluginManager): void;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { getSession } from '@jbrowse/core/util';
3
+ import HighlightComponents from './HighlightComponents';
4
+ import { isTView } from '../TViewPanel/model';
5
+ export default function AddHighlightComponentsModelF(pluginManager) {
6
+ pluginManager.addToExtensionPoint('LinearGenomeView-TracksContainerComponent',
7
+ // @ts-expect-error
8
+ (rest, { model }) => {
9
+ // skip entirely unless a TView is connected to this genome view
10
+ const { views } = getSession(model);
11
+ return views.some(v => isTView(v) && v.connectedViewId === model.id)
12
+ ? [
13
+ ...rest,
14
+ React.createElement(HighlightComponents, { key: "tview_highlights", model: model }),
15
+ ]
16
+ : rest;
17
+ });
18
+ }
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/AddHighlightModel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAK7C,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAClD,aAA4B;IAE5B,aAAa,CAAC,mBAAmB,CAC/B,2CAA2C;IAC3C,mBAAmB;IACnB,CAAC,IAAuB,EAAE,EAAE,KAAK,EAAoC,EAAE,EAAE;QACvE,gEAAgE;QAChE,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;QACnC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,KAAK,KAAK,CAAC,EAAE,CAAC;YAClE,CAAC,CAAC;gBACE,GAAG,IAAI;gBACP,oBAAC,mBAAmB,IAAC,GAAG,EAAC,kBAAkB,EAAC,KAAK,EAAE,KAAK,GAAI;aAC7D;YACH,CAAC,CAAC,IAAI,CAAA;IACV,CAAC,CACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const useStyles: (params: void, muiStyleOverridesParams?: {
2
+ props: Record<string, unknown>;
3
+ ownerState?: Record<string, unknown> | undefined;
4
+ } | undefined) => {
5
+ classes: Record<"highlight", string>;
6
+ theme: import("@mui/material").Theme;
7
+ css: import("tss-react").Css;
8
+ cx: import("tss-react").Cx;
9
+ };
@@ -0,0 +1,14 @@
1
+ import { makeStyles } from 'tss-react/mui';
2
+ export const useStyles = makeStyles()({
3
+ highlight: {
4
+ height: '100%',
5
+ background: 'rgba(255,255,0,0.2)',
6
+ border: '1px solid rgba(50,50,0,0.2)',
7
+ position: 'absolute',
8
+ zIndex: 99,
9
+ textAlign: 'center',
10
+ pointerEvents: 'none',
11
+ overflow: 'hidden',
12
+ },
13
+ });
14
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/AddHighlightModel/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;IACpC,SAAS,EAAE;QACT,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,qBAAqB;QACjC,MAAM,EAAE,6BAA6B;QACrC,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,EAAE;QACV,SAAS,EAAE,QAAQ;QACnB,aAAa,EAAE,MAAM;QACrB,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC,CAAA"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Reads carrying the same insertion event usually differ slightly inside it
3
+ * (sequencing error, or a real indel within the inserted allele). Laying each
4
+ * one out left-justified puts those differences in different columns and the
5
+ * shared event stops being readable. Aligning the inserted sequences against
6
+ * each other fixes that.
7
+ *
8
+ * This is deliberately local to one reference position: the insertion still
9
+ * occupies "as many columns as the widest gapped sequence", which is the only
10
+ * thing buildColumnToRefPos knows about, so the column <-> reference mapping is
11
+ * untouched.
12
+ */
13
+ /**
14
+ * Center-star multiple alignment of the sequences inserted at one reference
15
+ * position. Returns each distinct input mapped to a gapped version, all of the
16
+ * same length. Returns an empty map when there is nothing to gain (a single
17
+ * distinct sequence) or when the site is too large to be worth aligning; the
18
+ * caller then keeps the sequences as-is and left-justifies them.
19
+ */
20
+ export declare function alignInsertions(seqs: string[]): Map<string, string>;
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Reads carrying the same insertion event usually differ slightly inside it
3
+ * (sequencing error, or a real indel within the inserted allele). Laying each
4
+ * one out left-justified puts those differences in different columns and the
5
+ * shared event stops being readable. Aligning the inserted sequences against
6
+ * each other fixes that.
7
+ *
8
+ * This is deliberately local to one reference position: the insertion still
9
+ * occupies "as many columns as the widest gapped sequence", which is the only
10
+ * thing buildColumnToRefPos knows about, so the column <-> reference mapping is
11
+ * untouched.
12
+ */
13
+ const MATCH = 2;
14
+ const MISMATCH = -2;
15
+ const GAP = -3;
16
+ // each sequence costs an O(n*m) pairwise alignment against the center, so fall
17
+ // back to left-justified layout rather than stall on a pathological site
18
+ const MAX_LEN = 200;
19
+ const MAX_DISTINCT = 30;
20
+ function subst(a, b) {
21
+ return a === b ? MATCH : MISMATCH;
22
+ }
23
+ /** global alignment, returns both sequences with '-' inserted */
24
+ function needlemanWunsch(a, b) {
25
+ const n = a.length;
26
+ const m = b.length;
27
+ const stride = m + 1;
28
+ const score = new Int32Array((n + 1) * stride);
29
+ for (let i = 1; i <= n; i++) {
30
+ score[i * stride] = i * GAP;
31
+ }
32
+ for (let j = 1; j <= m; j++) {
33
+ score[j] = j * GAP;
34
+ }
35
+ for (let i = 1; i <= n; i++) {
36
+ for (let j = 1; j <= m; j++) {
37
+ score[i * stride + j] = Math.max(score[(i - 1) * stride + j - 1] + subst(a[i - 1], b[j - 1]), score[(i - 1) * stride + j] + GAP, score[i * stride + j - 1] + GAP);
38
+ }
39
+ }
40
+ const outA = [];
41
+ const outB = [];
42
+ let i = n;
43
+ let j = m;
44
+ while (i > 0 || j > 0) {
45
+ const cur = score[i * stride + j];
46
+ const diagonal = i > 0 &&
47
+ j > 0 &&
48
+ cur === score[(i - 1) * stride + j - 1] + subst(a[i - 1], b[j - 1]);
49
+ if (diagonal) {
50
+ outA.push(a[i - 1]);
51
+ outB.push(b[j - 1]);
52
+ i--;
53
+ j--;
54
+ }
55
+ else if (i > 0 && cur === score[(i - 1) * stride + j] + GAP) {
56
+ outA.push(a[i - 1]);
57
+ outB.push('-');
58
+ i--;
59
+ }
60
+ else {
61
+ outA.push('-');
62
+ outB.push(b[j - 1]);
63
+ j--;
64
+ }
65
+ }
66
+ return {
67
+ center: outA.reverse().join(''),
68
+ other: outB.reverse().join(''),
69
+ };
70
+ }
71
+ function splitAgainstCenter({ center, other }, centerLen) {
72
+ const slots = Array.from({ length: centerLen + 1 }, () => '');
73
+ let atCenter = '';
74
+ for (let k = 0; k < center.length; k++) {
75
+ if (center[k] === '-') {
76
+ slots[atCenter.length] = slots[atCenter.length] + other[k];
77
+ }
78
+ else {
79
+ atCenter += other[k];
80
+ }
81
+ }
82
+ return { slots, atCenter };
83
+ }
84
+ function emit({ slots, atCenter }, slotWidths) {
85
+ let ret = '';
86
+ for (let j = 0; j < atCenter.length; j++) {
87
+ const slot = slots[j];
88
+ ret += slot + '-'.repeat(slotWidths[j] - slot.length) + atCenter[j];
89
+ }
90
+ const last = slots[atCenter.length];
91
+ return ret + last + '-'.repeat(slotWidths[atCenter.length] - last.length);
92
+ }
93
+ /**
94
+ * Center-star multiple alignment of the sequences inserted at one reference
95
+ * position. Returns each distinct input mapped to a gapped version, all of the
96
+ * same length. Returns an empty map when there is nothing to gain (a single
97
+ * distinct sequence) or when the site is too large to be worth aligning; the
98
+ * caller then keeps the sequences as-is and left-justifies them.
99
+ */
100
+ export function alignInsertions(seqs) {
101
+ const distinct = [...new Set(seqs)];
102
+ const longest = distinct.reduce((a, b) => (b.length > a.length ? b : a), '');
103
+ if (distinct.length < 2 ||
104
+ distinct.length > MAX_DISTINCT ||
105
+ longest.length > MAX_LEN) {
106
+ return new Map();
107
+ }
108
+ const centerLen = longest.length;
109
+ const others = distinct.filter(s => s !== longest);
110
+ const splits = others.map(s => splitAgainstCenter(needlemanWunsch(longest, s), centerLen));
111
+ const centerSplit = {
112
+ slots: Array.from({ length: centerLen + 1 }, () => ''),
113
+ atCenter: longest,
114
+ };
115
+ const slotWidths = Array.from({ length: centerLen + 1 }, (_, j) => splits.reduce((max, s) => Math.max(max, s.slots[j].length), 0));
116
+ return new Map([
117
+ [longest, emit(centerSplit, slotWidths)],
118
+ ...others.map((seq, i) => [seq, emit(splits[i], slotWidths)]),
119
+ ]);
120
+ }
121
+ //# sourceMappingURL=align.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"align.js","sourceRoot":"","sources":["../../src/LaunchTView/align.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,KAAK,GAAG,CAAC,CAAA;AACf,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAA;AACnB,MAAM,GAAG,GAAG,CAAC,CAAC,CAAA;AAEd,+EAA+E;AAC/E,yEAAyE;AACzE,MAAM,OAAO,GAAG,GAAG,CAAA;AACnB,MAAM,YAAY,GAAG,EAAE,CAAA;AAEvB,SAAS,KAAK,CAAC,CAAqB,EAAE,CAAqB;IACzD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAA;AACnC,CAAC;AAED,iEAAiE;AACjE,SAAS,eAAe,CAAC,CAAS,EAAE,CAAS;IAC3C,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;IAClB,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;IAClB,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,CAAA;IACpB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAA;IAC9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;IAC7B,CAAC;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C,CAAC,CAChE,CAAA;IACD,OAAO,IAAI,GAAG,CAAC;QACb,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACxC,GAAG,MAAM,CAAC,GAAG,CACX,CAAC,GAAG,EAAE,CAAC,EAAoB,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAE,EAAE,UAAU,CAAC,CAAC,CAClE;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { AbstractTrackModel } from '@jbrowse/core/util';
3
+ export default function LaunchTViewDialog({ handleClose, model, }: {
4
+ handleClose: () => void;
5
+ model: AbstractTrackModel;
6
+ }): React.JSX.Element;
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import { getConf } from '@jbrowse/core/configuration';
3
+ import { Dialog, ErrorMessage } from '@jbrowse/core/ui';
4
+ import { assembleLocString, getContainingView, getSession, } from '@jbrowse/core/util';
5
+ import { Button, DialogActions, DialogContent } from '@mui/material';
6
+ import { MAX_BP, MAX_CELLS } from '../limits';
7
+ import { renderTviewMsa } from '../tview';
8
+ import { useTviewMsa } from '../useTviewMsa';
9
+ export default function LaunchTViewDialog({ handleClose, model, }) {
10
+ const view = getContainingView(model);
11
+ const session = getSession(model);
12
+ const block = view.dynamicBlocks.contentBlocks[0];
13
+ // assemblyName is required: the RPC uses it to map the view's refName onto
14
+ // whatever the file calls that sequence (refNameAliases)
15
+ const region = block
16
+ ? {
17
+ assemblyName: block.assemblyName,
18
+ refName: block.refName,
19
+ start: Math.floor(block.start),
20
+ end: Math.ceil(block.end),
21
+ }
22
+ : undefined;
23
+ const width = region ? region.end - region.start : 0;
24
+ const tooWide = width > MAX_BP;
25
+ const { data, error, isLoading } = useTviewMsa({
26
+ model,
27
+ region: tooWide ? undefined : region,
28
+ });
29
+ const displayName = region ? assembleLocString(region) : 'Unknown';
30
+ const tooLarge = !!data && data.plan.cellCount > MAX_CELLS;
31
+ // lets the view rebuild itself after a session reload
32
+ const msaSource = region
33
+ ? { trackId: getConf(model, 'trackId'), assemblyName: region.assemblyName }
34
+ : undefined;
35
+ return (React.createElement(Dialog, { maxWidth: "xl", title: "Launch tview", onClose: () => {
36
+ handleClose();
37
+ }, open: true },
38
+ React.createElement(DialogContent, null,
39
+ React.createElement("div", null,
40
+ "Create a view similar to \"samtools tview\" for the reads in the current region: ",
41
+ displayName),
42
+ tooWide ? (React.createElement("div", null,
43
+ "Region is ",
44
+ width.toLocaleString('en-US'),
45
+ "bp, wider than the",
46
+ ' ',
47
+ MAX_BP.toLocaleString('en-US'),
48
+ "bp limit. Zoom in and try again.")) : error ? (React.createElement(ErrorMessage, { error: error })) : isLoading ? (React.createElement("div", null, "Loading...")) : tooLarge ? (React.createElement("div", null,
49
+ data.rowCount.toLocaleString('en-US'),
50
+ " reads over",
51
+ ' ',
52
+ data.plan.layout.totalColumns.toLocaleString('en-US'),
53
+ " columns is",
54
+ ' ',
55
+ data.plan.cellCount.toLocaleString('en-US'),
56
+ " cells, above the",
57
+ ' ',
58
+ MAX_CELLS.toLocaleString('en-US'),
59
+ " limit. Zoom in and try again.")) : data ? (React.createElement("div", null,
60
+ data.rowCount,
61
+ " reads with sequence data found")) : (React.createElement("div", null, "No region is currently visible."))),
62
+ React.createElement(DialogActions, null,
63
+ React.createElement(Button, { variant: "contained", color: "primary", disabled: !data?.rowCount || tooLarge, onClick: () => {
64
+ if (data && !tooLarge) {
65
+ session.addView('TView', {
66
+ type: 'TView',
67
+ displayName,
68
+ colWidth: 10,
69
+ rowHeight: 12,
70
+ labelsAlignRight: true,
71
+ colorSchemeName: 'jbrowse_dna',
72
+ connectedViewId: view.id,
73
+ msaRegion: data.plan.region,
74
+ insertionWidths: data.plan.insertionWidths,
75
+ msaSource,
76
+ data: {
77
+ msa: renderTviewMsa(data.plan),
78
+ },
79
+ });
80
+ }
81
+ handleClose();
82
+ } }, "Submit"),
83
+ React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => {
84
+ handleClose();
85
+ } }, "Cancel"))));
86
+ }
87
+ //# sourceMappingURL=LaunchTViewDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LaunchTViewDialog.js","sourceRoot":"","sources":["../../../src/LaunchTView/components/LaunchTViewDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,GACX,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAEpE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAK5C,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,WAAW,EACX,KAAK,GAIN;IACC,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAA0B,CAAA;IAC9D,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;IACjD,2EAA2E;IAC3E,yDAAyD;IACzD,MAAM,MAAM,GAAG,KAAK;QAClB,CAAC,CAAC;YACE,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;YAC9B,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;SAC1B;QACH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M;YACT,oBAAC,MAAM,IACL,OAAO,EAAC,WAAW,EACnB,KAAK,EAAC,WAAW,EACjB,OAAO,EAAE,GAAG,EAAE;oBACZ,WAAW,EAAE,CAAA;gBACf,CAAC,aAGM,CACK,CACT,CACV,CAAA;AACH,CAAC"}
@@ -0,0 +1,51 @@
1
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
2
+ import type { AbstractSessionModel, AbstractTrackModel } from '@jbrowse/core/util';
3
+ /** the RPC needs assemblyName to resolve refNameAliases for the file */
4
+ export interface FetchRegion {
5
+ assemblyName: string;
6
+ refName: string;
7
+ start: number;
8
+ end: number;
9
+ }
10
+ /** what CoreGetFeatures needs, reachable from a live track or from its config */
11
+ export interface TviewSource {
12
+ adapterConfig: unknown;
13
+ rpcSessionId: string;
14
+ }
15
+ export declare function sourceFromTrack(track: AbstractTrackModel): TviewSource;
16
+ /**
17
+ * The trackId -> config index, whose shape has changed across hosts still in
18
+ * the wild: v4.0.0 exposes a `tracksById` getter, v4.1-v4.3 a `getTracksById()`
19
+ * method, and newer cores a per-id reactive `getTrackById(id)` (with
20
+ * `getTracksById()` kept but deprecated). All three resolve connection and
21
+ * assembly-sequence tracks; the `tracks` scan is a last resort because it does
22
+ * not, and it subscribes the caller to every track.
23
+ */
24
+ export interface SessionTrackLookup {
25
+ tracks: AnyConfigurationModel[];
26
+ getTrackById?: (id: string) => AnyConfigurationModel | undefined;
27
+ getTracksById?: () => Record<string, AnyConfigurationModel>;
28
+ tracksById?: Record<string, AnyConfigurationModel>;
29
+ }
30
+ export declare function findTrackConf(session: SessionTrackLookup, trackId: string): (import("@jbrowse/mobx-state-tree").ModelInstanceTypeProps<Record<string, any>> & {
31
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
32
+ [x: string]: any;
33
+ } & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject & {
34
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
35
+ [x: string]: any;
36
+ } & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject & any & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
37
+ } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
38
+ } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>) | undefined;
39
+ /**
40
+ * A rebuild runs from the track's config rather than a track model, so it works
41
+ * whether or not the track is still open anywhere in the session.
42
+ */
43
+ export declare function sourceFromConfig(conf: AnyConfigurationModel): TviewSource;
44
+ export declare function fetchTviewPlan({ session, source, region, }: {
45
+ session: AbstractSessionModel;
46
+ source: TviewSource;
47
+ region: FetchRegion;
48
+ }): Promise<{
49
+ plan: import("./tview").TviewPlan;
50
+ rowCount: number;
51
+ }>;
@@ -0,0 +1,43 @@
1
+ import { getConf, readConfObject } from '@jbrowse/core/configuration';
2
+ import { getRpcSessionId } from '@jbrowse/core/util/tracks';
3
+ import { planTviewMsa } from './tview';
4
+ export function sourceFromTrack(track) {
5
+ return {
6
+ adapterConfig: getConf(track, 'adapter'),
7
+ rpcSessionId: getRpcSessionId(track),
8
+ };
9
+ }
10
+ export function findTrackConf(session, trackId) {
11
+ return session.getTrackById
12
+ ? session.getTrackById(trackId)
13
+ : session.getTracksById
14
+ ? session.getTracksById()[trackId]
15
+ : session.tracksById
16
+ ? session.tracksById[trackId]
17
+ : session.tracks.find(t => readConfObject(t, 'trackId') === trackId);
18
+ }
19
+ /**
20
+ * A rebuild runs from the track's config rather than a track model, so it works
21
+ * whether or not the track is still open anywhere in the session.
22
+ */
23
+ export function sourceFromConfig(conf) {
24
+ return {
25
+ adapterConfig: readConfObject(conf, 'adapter'),
26
+ rpcSessionId: `tview-${readConfObject(conf, 'trackId')}`,
27
+ };
28
+ }
29
+ export async function fetchTviewPlan({ session, source, region, }) {
30
+ const { adapterConfig, rpcSessionId } = source;
31
+ const feats = (await session.rpcManager.call(rpcSessionId, 'CoreGetFeatures', {
32
+ adapterConfig,
33
+ sessionId: rpcSessionId,
34
+ regions: [region],
35
+ }));
36
+ const features = feats.filter(f => !!f.get('seq'));
37
+ // only planned, not rendered: a caller may cancel, or find it too large
38
+ return {
39
+ plan: planTviewMsa({ features, ...region }),
40
+ rowCount: features.length,
41
+ };
42
+ }
43
+ //# sourceMappingURL=fetchTviewPlan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchTviewPlan.js","sourceRoot":"","sources":["../../src/LaunchTView/fetchTviewPlan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAuBtC,MAAM,UAAU,eAAe,CAAC,KAAyB;IACvD,OAAO;QACL,aAAa,EAAE,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC;QACxC,YAAY,EAAE,eAAe,CAAC,KAAK,CAAC;KACrC,CAAA;AACH,CAAC;AAiBD,MAAM,UAAU,aAAa,CAAC,OAA2B,EAAE,OAAe;IACxE,OAAO,OAAO,CAAC,YAAY;QACzB,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC;QAC/B,CAAC,CAAC,OAAO,CAAC,aAAa;YACrB,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC;YAClC,CAAC,CAAC,OAAO,CAAC,UAAU;gBAClB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;gBAC7B,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,OAAO,CAAC,CAAA;AAC5E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAA2B;IAC1D,OAAO;QACL,aAAa,EAAE,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC;QAC9C,YAAY,EAAE,SAAS,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE;KACzD,CAAA;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,OAAO,EACP,MAAM,EACN,MAAM,GAKP;IACC,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,MAAM,CAAA;IAC9C,MAAM,KAAK,GAAG,CAAC,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAC1C,YAAY,EACZ,iBAAiB,EACjB;QACE,aAAa;QACb,SAAS,EAAE,YAAY;QACvB,OAAO,EAAE,CAAC,MAAM,CAAC;KAClB,CACF,CAAc,CAAA;IACf,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;IAClD,wEAAwE;IACxE,OAAO;QACL,IAAI,EAAE,YAAY,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC;QAC3C,QAAQ,EAAE,QAAQ,CAAC,MAAM;KAC1B,CAAA;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function LaunchTViewF(pluginManager: PluginManager): void;