@jbrowse/plugin-dotplot-view 2.17.0 → 3.0.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 (173) hide show
  1. package/dist/ComparativeRenderer/index.d.ts +3 -8
  2. package/dist/ComparativeRenderer/index.js +3 -8
  3. package/dist/DotplotDisplay/components/DotplotDisplay.d.ts +2 -3
  4. package/dist/DotplotDisplay/components/DotplotDisplay.js +7 -12
  5. package/dist/DotplotDisplay/index.d.ts +1 -7
  6. package/dist/DotplotDisplay/index.js +2 -12
  7. package/dist/DotplotDisplay/renderDotplotBlock.d.ts +1 -1
  8. package/dist/DotplotDisplay/renderDotplotBlock.js +3 -9
  9. package/dist/DotplotDisplay/stateModelFactory.d.ts +8 -45
  10. package/dist/DotplotDisplay/stateModelFactory.js +57 -100
  11. package/dist/DotplotReadVsRef/DotplotReadVsRef.d.ts +2 -2
  12. package/dist/DotplotReadVsRef/DotplotReadVsRef.js +13 -14
  13. package/dist/DotplotReadVsRef/index.d.ts +1 -1
  14. package/dist/DotplotReadVsRef/index.js +0 -2
  15. package/dist/DotplotRenderer/ComparativeRenderRpc.d.ts +3 -8
  16. package/dist/DotplotRenderer/ComparativeRenderRpc.js +3 -8
  17. package/dist/DotplotRenderer/DotplotRenderer.d.ts +8 -7
  18. package/dist/DotplotRenderer/DotplotRenderer.js +18 -9
  19. package/dist/DotplotRenderer/components/DotplotRendering.d.ts +2 -3
  20. package/dist/DotplotRenderer/components/DotplotRendering.js +2 -5
  21. package/dist/DotplotRenderer/configSchema.d.ts +0 -21
  22. package/dist/DotplotRenderer/configSchema.js +2 -27
  23. package/dist/DotplotRenderer/drawDotplot.d.ts +3 -3
  24. package/dist/DotplotRenderer/drawDotplot.js +3 -6
  25. package/dist/DotplotRenderer/index.d.ts +1 -1
  26. package/dist/DotplotRenderer/index.js +1 -1
  27. package/dist/DotplotView/1dview.d.ts +2 -77
  28. package/dist/DotplotView/1dview.js +4 -33
  29. package/dist/DotplotView/components/Axes.d.ts +5 -6
  30. package/dist/DotplotView/components/Axes.js +26 -40
  31. package/dist/DotplotView/components/CursorIcon.d.ts +3 -4
  32. package/dist/DotplotView/components/CursorIcon.js +3 -5
  33. package/dist/DotplotView/components/DotplotControls.d.ts +2 -3
  34. package/dist/DotplotView/components/DotplotControls.js +94 -97
  35. package/dist/DotplotView/components/DotplotTooltipClick.d.ts +2 -3
  36. package/dist/DotplotView/components/DotplotTooltipClick.js +3 -7
  37. package/dist/DotplotView/components/DotplotTooltipMouseover.d.ts +2 -3
  38. package/dist/DotplotView/components/DotplotTooltipMouseover.js +4 -8
  39. package/dist/DotplotView/components/DotplotView.d.ts +2 -3
  40. package/dist/DotplotView/components/DotplotView.js +80 -92
  41. package/dist/DotplotView/components/DotplotWarnings.d.ts +2 -3
  42. package/dist/DotplotView/components/DotplotWarnings.js +26 -21
  43. package/dist/DotplotView/components/ExportSvgDialog.d.ts +2 -3
  44. package/dist/DotplotView/components/ExportSvgDialog.js +32 -67
  45. package/dist/DotplotView/components/Grid.d.ts +3 -4
  46. package/dist/DotplotView/components/Grid.js +19 -32
  47. package/dist/DotplotView/components/Header.d.ts +2 -3
  48. package/dist/DotplotView/components/Header.js +4 -23
  49. package/dist/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.d.ts +7 -0
  50. package/dist/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +129 -0
  51. package/dist/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +4 -6
  52. package/dist/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.js +17 -48
  53. package/dist/DotplotView/components/ImportForm/TrackSelector.d.ts +7 -0
  54. package/dist/DotplotView/components/ImportForm/TrackSelector.js +23 -0
  55. package/dist/DotplotView/components/ImportForm/getAdapter.d.ts +117 -0
  56. package/dist/DotplotView/components/ImportForm/getAdapter.js +68 -0
  57. package/dist/DotplotView/components/ImportForm/index.d.ts +3 -4
  58. package/dist/DotplotView/components/ImportForm/index.js +47 -97
  59. package/dist/DotplotView/components/ImportForm/util.js +1 -3
  60. package/dist/DotplotView/components/PanButtons.d.ts +2 -3
  61. package/dist/DotplotView/components/PanButtons.js +17 -36
  62. package/dist/DotplotView/components/WarningDialog.d.ts +7 -7
  63. package/dist/DotplotView/components/WarningDialog.js +12 -15
  64. package/dist/DotplotView/components/util.d.ts +2 -7
  65. package/dist/DotplotView/components/util.js +0 -5
  66. package/dist/DotplotView/index.d.ts +1 -1
  67. package/dist/DotplotView/index.js +17 -8
  68. package/dist/DotplotView/model.d.ts +11 -133
  69. package/dist/DotplotView/model.js +46 -222
  70. package/dist/DotplotView/svgcomponents/SVGBackground.d.ts +1 -2
  71. package/dist/DotplotView/svgcomponents/SVGBackground.js +3 -6
  72. package/dist/DotplotView/svgcomponents/SVGDotplotView.d.ts +1 -1
  73. package/dist/DotplotView/svgcomponents/SVGDotplotView.js +6 -24
  74. package/dist/DotplotView/types.d.ts +12 -0
  75. package/dist/DotplotView/types.js +2 -0
  76. package/dist/LaunchDotplotView.d.ts +1 -1
  77. package/dist/LaunchDotplotView.js +1 -4
  78. package/dist/ServerSideRenderedBlockContent.d.ts +2 -2
  79. package/dist/ServerSideRenderedBlockContent.js +11 -37
  80. package/dist/ServerSideSyntenyRendering.d.ts +1 -6
  81. package/dist/ServerSideSyntenyRendering.js +4 -26
  82. package/dist/index.d.ts +1 -1
  83. package/dist/index.js +3 -6
  84. package/dist/util.d.ts +1 -1
  85. package/esm/ComparativeRenderer/index.d.ts +3 -8
  86. package/esm/ComparativeRenderer/index.js +3 -8
  87. package/esm/DotplotDisplay/components/DotplotDisplay.d.ts +2 -3
  88. package/esm/DotplotDisplay/components/DotplotDisplay.js +7 -9
  89. package/esm/DotplotDisplay/index.d.ts +1 -7
  90. package/esm/DotplotDisplay/index.js +2 -12
  91. package/esm/DotplotDisplay/renderDotplotBlock.d.ts +1 -1
  92. package/esm/DotplotDisplay/renderDotplotBlock.js +3 -6
  93. package/esm/DotplotDisplay/stateModelFactory.d.ts +8 -45
  94. package/esm/DotplotDisplay/stateModelFactory.js +58 -101
  95. package/esm/DotplotReadVsRef/DotplotReadVsRef.d.ts +2 -2
  96. package/esm/DotplotReadVsRef/DotplotReadVsRef.js +15 -16
  97. package/esm/DotplotReadVsRef/index.d.ts +1 -1
  98. package/esm/DotplotReadVsRef/index.js +0 -2
  99. package/esm/DotplotRenderer/ComparativeRenderRpc.d.ts +3 -8
  100. package/esm/DotplotRenderer/ComparativeRenderRpc.js +3 -8
  101. package/esm/DotplotRenderer/DotplotRenderer.d.ts +8 -7
  102. package/esm/DotplotRenderer/DotplotRenderer.js +1 -2
  103. package/esm/DotplotRenderer/components/DotplotRendering.d.ts +2 -3
  104. package/esm/DotplotRenderer/components/DotplotRendering.js +2 -2
  105. package/esm/DotplotRenderer/configSchema.d.ts +0 -21
  106. package/esm/DotplotRenderer/configSchema.js +2 -27
  107. package/esm/DotplotRenderer/drawDotplot.d.ts +3 -3
  108. package/esm/DotplotRenderer/drawDotplot.js +4 -7
  109. package/esm/DotplotRenderer/index.d.ts +1 -1
  110. package/esm/DotplotRenderer/index.js +1 -1
  111. package/esm/DotplotView/1dview.d.ts +2 -77
  112. package/esm/DotplotView/1dview.js +4 -33
  113. package/esm/DotplotView/components/Axes.d.ts +5 -6
  114. package/esm/DotplotView/components/Axes.js +26 -37
  115. package/esm/DotplotView/components/CursorIcon.d.ts +3 -4
  116. package/esm/DotplotView/components/CursorIcon.js +3 -5
  117. package/esm/DotplotView/components/DotplotControls.d.ts +2 -3
  118. package/esm/DotplotView/components/DotplotControls.js +94 -97
  119. package/esm/DotplotView/components/DotplotTooltipClick.d.ts +2 -3
  120. package/esm/DotplotView/components/DotplotTooltipClick.js +3 -7
  121. package/esm/DotplotView/components/DotplotTooltipMouseover.d.ts +2 -3
  122. package/esm/DotplotView/components/DotplotTooltipMouseover.js +4 -8
  123. package/esm/DotplotView/components/DotplotView.d.ts +2 -3
  124. package/esm/DotplotView/components/DotplotView.js +63 -85
  125. package/esm/DotplotView/components/DotplotWarnings.d.ts +2 -3
  126. package/esm/DotplotView/components/DotplotWarnings.js +9 -14
  127. package/esm/DotplotView/components/ExportSvgDialog.d.ts +2 -3
  128. package/esm/DotplotView/components/ExportSvgDialog.js +32 -44
  129. package/esm/DotplotView/components/Grid.d.ts +3 -4
  130. package/esm/DotplotView/components/Grid.js +19 -29
  131. package/esm/DotplotView/components/Header.d.ts +2 -3
  132. package/esm/DotplotView/components/Header.js +4 -23
  133. package/esm/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.d.ts +7 -0
  134. package/esm/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +124 -0
  135. package/esm/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +4 -6
  136. package/esm/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.js +17 -25
  137. package/esm/DotplotView/components/ImportForm/TrackSelector.d.ts +7 -0
  138. package/esm/DotplotView/components/ImportForm/TrackSelector.js +18 -0
  139. package/esm/DotplotView/components/ImportForm/getAdapter.d.ts +117 -0
  140. package/esm/DotplotView/components/ImportForm/getAdapter.js +65 -0
  141. package/esm/DotplotView/components/ImportForm/index.d.ts +3 -4
  142. package/esm/DotplotView/components/ImportForm/index.js +48 -75
  143. package/esm/DotplotView/components/ImportForm/util.js +1 -3
  144. package/esm/DotplotView/components/PanButtons.d.ts +2 -3
  145. package/esm/DotplotView/components/PanButtons.js +17 -36
  146. package/esm/DotplotView/components/WarningDialog.d.ts +7 -7
  147. package/esm/DotplotView/components/WarningDialog.js +12 -12
  148. package/esm/DotplotView/components/util.d.ts +2 -7
  149. package/esm/DotplotView/components/util.js +0 -5
  150. package/esm/DotplotView/index.d.ts +1 -1
  151. package/esm/DotplotView/index.js +0 -1
  152. package/esm/DotplotView/model.d.ts +11 -133
  153. package/esm/DotplotView/model.js +30 -216
  154. package/esm/DotplotView/svgcomponents/SVGBackground.d.ts +1 -2
  155. package/esm/DotplotView/svgcomponents/SVGBackground.js +3 -3
  156. package/esm/DotplotView/svgcomponents/SVGDotplotView.d.ts +1 -1
  157. package/esm/DotplotView/svgcomponents/SVGDotplotView.js +6 -24
  158. package/esm/DotplotView/types.d.ts +12 -0
  159. package/esm/DotplotView/types.js +1 -0
  160. package/esm/LaunchDotplotView.d.ts +1 -1
  161. package/esm/LaunchDotplotView.js +1 -4
  162. package/esm/ServerSideRenderedBlockContent.d.ts +2 -2
  163. package/esm/ServerSideRenderedBlockContent.js +11 -14
  164. package/esm/ServerSideSyntenyRendering.d.ts +1 -6
  165. package/esm/ServerSideSyntenyRendering.js +4 -3
  166. package/esm/index.d.ts +1 -1
  167. package/esm/index.js +3 -6
  168. package/esm/util.d.ts +1 -1
  169. package/package.json +2 -4
  170. package/dist/DotplotView/components/ImportForm/ImportCustomTrack.d.ts +0 -11
  171. package/dist/DotplotView/components/ImportForm/ImportCustomTrack.js +0 -194
  172. package/esm/DotplotView/components/ImportForm/ImportCustomTrack.d.ts +0 -11
  173. package/esm/DotplotView/components/ImportForm/ImportCustomTrack.js +0 -169
@@ -0,0 +1,124 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { ErrorMessage, FileSelector } from '@jbrowse/core/ui';
4
+ import HelpIcon from '@mui/icons-material/Help';
5
+ import { Button, FormControlLabel, Grid2, Paper, Radio, RadioGroup, Tooltip, Typography, } from '@mui/material';
6
+ import { observer } from 'mobx-react';
7
+ import { getAdapter } from './getAdapter';
8
+ import { basename, extName, getName, stripGz } from './util';
9
+ const ImportSyntenyOpenCustomTrack = observer(function ({ model, assembly1, assembly2, }) {
10
+ const [swap, setSwap] = useState(false);
11
+ const [bed2Location, setBed2Location] = useState();
12
+ const [bed1Location, setBed1Location] = useState();
13
+ const [fileLocation, setFileLocation] = useState();
14
+ const [indexFileLocation, setIndexFileLocation] = useState();
15
+ const [value, setValue] = useState('');
16
+ const [error, setError] = useState();
17
+ const fileName = getName(fileLocation);
18
+ const radioOption = value || (fileName ? extName(stripGz(fileName)) : '');
19
+ useEffect(() => {
20
+ try {
21
+ if (fileLocation) {
22
+ const fn = fileName ? basename(fileName) : 'MyTrack';
23
+ const trackId = `${fn}-${Date.now()}-sessionTrack`;
24
+ setError(undefined);
25
+ model.setImportFormSyntenyTrack(0, {
26
+ type: 'userOpened',
27
+ value: {
28
+ trackId,
29
+ name: fn,
30
+ assemblyNames: [assembly2, assembly1],
31
+ type: 'SyntenyTrack',
32
+ adapter: getAdapter({
33
+ radioOption,
34
+ assembly1: swap ? assembly2 : assembly1,
35
+ assembly2: swap ? assembly1 : assembly2,
36
+ fileLocation,
37
+ indexFileLocation,
38
+ bed1Location,
39
+ bed2Location,
40
+ }),
41
+ },
42
+ });
43
+ }
44
+ }
45
+ catch (e) {
46
+ console.error(e);
47
+ setError(e);
48
+ }
49
+ }, [
50
+ swap,
51
+ model,
52
+ fileName,
53
+ assembly1,
54
+ assembly2,
55
+ bed1Location,
56
+ bed2Location,
57
+ fileLocation,
58
+ indexFileLocation,
59
+ radioOption,
60
+ ]);
61
+ const helpStrings = {
62
+ '.paf': 'minimap2 target.fa query.fa',
63
+ '.pif.gz': 'minimap2 target.fa query.fa',
64
+ '.out': 'mashmap target.fa query.fa',
65
+ '.delta': 'mummer target.fa query.fa',
66
+ '.chain': 'e.g. queryToTarget.chain',
67
+ };
68
+ return (_jsxs(Paper, { style: { padding: 12 }, children: [error ? _jsx(ErrorMessage, { error: error }) : null, _jsx(Typography, { style: { textAlign: 'center' }, children: "Add a .paf (minimap2), .delta (Mummer), .chain (UCSC liftover), .anchors or .anchors.simple (MCScan), or .pif.gz (jbrowse CLI make-pif) file to view. These file types can also be gzipped." }), _jsx(RadioGroup, { value: radioOption, onChange: event => {
69
+ setValue(event.target.value);
70
+ }, children: _jsx(Grid2, { container: true, justifyContent: "center", children: [
71
+ '.paf',
72
+ '.delta',
73
+ '.out',
74
+ '.chain',
75
+ '.anchors',
76
+ '.anchors.simple',
77
+ '.pif.gz',
78
+ ].map(extension => (_jsx(FormControlLabel, { value: extension, control: _jsx(Radio, {}), label: extension }, extension))) }) }), _jsx(Grid2, { container: true, justifyContent: "center", children: radioOption === '.paf' ||
79
+ radioOption === '.out' ||
80
+ radioOption === '.delta' ||
81
+ radioOption === '.chain' ||
82
+ radioOption === '.pif.gz' ? (_jsxs("div", { style: {
83
+ display: 'flex',
84
+ flexDirection: 'column',
85
+ gap: 10,
86
+ }, children: [_jsx(FileSelector, { name: `${radioOption} location`, inline: true, description: "", location: fileLocation, setLocation: loc => {
87
+ setFileLocation(loc);
88
+ } }), _jsxs("div", { children: [_jsxs("div", { children: ["Verify or click swap", _jsx(Tooltip, { title: _jsx("code", { children: helpStrings[radioOption] }), children: _jsx(HelpIcon, {}) })] }), _jsxs("div", { style: {
89
+ display: 'flex',
90
+ gap: 20,
91
+ }, children: [_jsxs("div", { style: {
92
+ display: 'grid',
93
+ gridTemplateColumns: '1fr 1fr',
94
+ gap: 4,
95
+ alignItems: 'center',
96
+ }, children: [_jsx("div", { children: _jsx("i", { children: swap ? assembly2 : assembly1 }) }), _jsx("div", { children: "query assembly" }), _jsx("div", { children: _jsx("i", { children: swap ? assembly1 : assembly2 }) }), _jsx("div", { children: "target assembly" })] }), _jsx(Button, { variant: "contained", onClick: () => {
97
+ setSwap(!swap);
98
+ }, children: "Swap?" })] })] })] })) : value === '.anchors' || value === '.anchors.simple' ? (_jsxs("div", { children: [_jsxs("div", { style: { margin: 20 }, children: ["Open the ", value, " and .bed files for both genome assemblies from the MCScan (Python version) pipeline", ' ', _jsx("a", { href: "https://github.com/tanghaibao/jcvi/wiki/MCscan-(Python-version)", children: "(more info)" })] }), _jsxs("div", { children: [_jsx(FileSelector, { inline: true, name: value, location: fileLocation, setLocation: loc => {
99
+ setFileLocation(loc);
100
+ } }), _jsx(FileSelector, { inline: true, name: "genome 1 .bed (left column of anchors file)", description: "", location: bed1Location, setLocation: loc => {
101
+ setBed1Location(loc);
102
+ } }), _jsx(FileSelector, { inline: true, name: "genome 2 .bed (right column of anchors file)", description: "", location: bed2Location, setLocation: loc => {
103
+ setBed2Location(loc);
104
+ } })] }), _jsxs("div", { style: {
105
+ margin: 'auto',
106
+ display: 'flex',
107
+ justifyContent: 'center',
108
+ gap: 20,
109
+ }, children: [_jsxs("div", { style: {
110
+ display: 'grid',
111
+ gridTemplateColumns: '1fr 1fr',
112
+ gap: 4,
113
+ alignItems: 'center',
114
+ }, children: [_jsx("div", { children: _jsx("i", { children: swap ? assembly2 : assembly1 }) }), _jsx("div", { children: "bed1 assembly" }), _jsx("div", { children: _jsx("i", { children: swap ? assembly1 : assembly2 }) }), _jsx("div", { children: "bed2 assembly" })] }), _jsx(Button, { variant: "contained", onClick: () => {
115
+ setSwap(!swap);
116
+ }, children: "Swap?" })] })] })) : value === '.pif.gz' ? (_jsxs("div", { style: { display: 'flex' }, children: [_jsx("div", { children: _jsx(FileSelector, { name: `${value} location`, description: "", location: fileLocation, setLocation: loc => {
117
+ setFileLocation(loc);
118
+ } }) }), _jsx("div", { children: _jsx(FileSelector, { name: `${value} index location`, description: "", location: indexFileLocation, setLocation: loc => {
119
+ setIndexFileLocation(loc);
120
+ } }) })] })) : (_jsx(FileSelector, { name: value ? `${value} location` : '', description: "", location: fileLocation, setLocation: loc => {
121
+ setFileLocation(loc);
122
+ } })) })] }));
123
+ });
124
+ export default ImportSyntenyOpenCustomTrack;
@@ -1,9 +1,7 @@
1
- import React from 'react';
2
- import { DotplotViewModel } from '../../model';
3
- declare const Selector: ({ model, assembly1, assembly2, setShowTrackId, }: {
1
+ import type { DotplotViewModel } from '../../model';
2
+ declare const ImportSyntenyTrackSelector: ({ model, assembly1, assembly2, }: {
4
3
  model: DotplotViewModel;
5
4
  assembly1: string;
6
5
  assembly2: string;
7
- setShowTrackId: (arg: string) => void;
8
- }) => React.JSX.Element;
9
- export default Selector;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export default ImportSyntenyTrackSelector;
@@ -1,19 +1,19 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { Select, MenuItem, Paper, Typography } from '@mui/material';
3
- import { getTrackName } from '@jbrowse/core/util/tracks';
4
- import { getSession } from '@jbrowse/core/util';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { readConfObject } from '@jbrowse/core/configuration';
5
4
  import { ErrorMessage } from '@jbrowse/core/ui';
6
- import { readConfObject, } from '@jbrowse/core/configuration';
7
- import { observer } from 'mobx-react';
8
- // icons
9
5
  import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons';
6
+ import { getSession } from '@jbrowse/core/util';
7
+ import { getTrackName } from '@jbrowse/core/util/tracks';
8
+ import { MenuItem, Paper, Select, Typography } from '@mui/material';
9
+ import { observer } from 'mobx-react';
10
10
  function f(track, assembly1, assembly2) {
11
11
  const assemblyNames = readConfObject(track, 'assemblyNames');
12
12
  return (assemblyNames.includes(assembly1) &&
13
13
  assemblyNames.includes(assembly2) &&
14
14
  track.type.includes('Synteny'));
15
15
  }
16
- const Selector = observer(({ model, assembly1, assembly2, setShowTrackId, }) => {
16
+ const ImportSyntenyTrackSelector = observer(function ({ model, assembly1, assembly2, }) {
17
17
  var _a;
18
18
  const session = getSession(model);
19
19
  const { tracks, sessionTracks } = session;
@@ -25,24 +25,16 @@ const Selector = observer(({ model, assembly1, assembly2, setShowTrackId, }) =>
25
25
  const resetTrack = ((_a = filteredTracks[0]) === null || _a === void 0 ? void 0 : _a.trackId) || '';
26
26
  const [value, setValue] = useState(resetTrack);
27
27
  useEffect(() => {
28
- // if assembly1/assembly2 changes, then we will want to use this effect to change
29
- // the state of the useState because it otherwise gets locked to a stale value
30
28
  setValue(resetTrack);
31
29
  }, [resetTrack]);
32
30
  useEffect(() => {
33
- // sets track data in a useEffect because the initial load is needed as well as
34
- // onChange's to the select box
35
- setShowTrackId(value);
36
- }, [value, setShowTrackId]);
37
- return (React.createElement(Paper, { style: { padding: 12 } },
38
- React.createElement(Typography, { paragraph: true }, "Select a track from the select box below, the track will be shown when you hit \"Launch\"."),
39
- React.createElement(Typography, { paragraph: true },
40
- "Note: there is a track selector ",
41
- React.createElement("i", null, "inside"),
42
- " the DotplotView, which can turn on one or more SyntenyTracks (more than one can be displayed at once). Look for the track selector icon ",
43
- React.createElement(TrackSelectorIcon, null)),
44
- filteredTracks.length ? (React.createElement(Select, { value: value, onChange: event => {
45
- setValue(event.target.value);
46
- } }, filteredTracks.map(track => (React.createElement(MenuItem, { key: track.trackId, value: track.trackId }, getTrackName(track, session)))))) : (React.createElement(ErrorMessage, { error: `No synteny tracks found for ${assembly1},${assembly2}` }))));
31
+ model.setImportFormSyntenyTrack(0, {
32
+ type: 'preConfigured',
33
+ value,
34
+ });
35
+ }, [model, value]);
36
+ return (_jsxs(Paper, { style: { padding: 12 }, children: [_jsxs(Typography, { children: ["Select a track from the select box below, the track will be shown when you hit \"Launch\". Note: there is a track selector ", _jsx("i", { children: "inside" }), " the DotplotView, which can turn on one or more SyntenyTracks (more than one can be displayed at once). Look for the track selector icon", ' ', _jsx(TrackSelectorIcon, {})] }), filteredTracks.length ? (_jsx(Select, { value: value, onChange: event => {
37
+ setValue(event.target.value);
38
+ }, children: filteredTracks.map(track => (_jsx(MenuItem, { value: track.trackId, children: getTrackName(track, session) }, track.trackId))) })) : (_jsx(ErrorMessage, { error: `No synteny tracks found for ${assembly1},${assembly2}` }))] }));
47
39
  });
48
- export default Selector;
40
+ export default ImportSyntenyTrackSelector;
@@ -0,0 +1,7 @@
1
+ import type { DotplotViewModel } from '../../model';
2
+ declare const TrackSelector: ({ assembly1, assembly2, model, }: {
3
+ model: DotplotViewModel;
4
+ assembly1: string;
5
+ assembly2: string;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export default TrackSelector;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { FormControl, FormControlLabel, FormLabel, Radio, RadioGroup, } from '@mui/material';
4
+ import { observer } from 'mobx-react';
5
+ import ImportSyntenyOpenCustomTrack from './ImportSyntenyOpenCustomTrack';
6
+ import ImportSyntenyTrackSelector from './ImportSyntenyTrackSelector';
7
+ const TrackSelector = observer(function ({ assembly1, assembly2, model, }) {
8
+ const [choice, setChoice] = useState('tracklist');
9
+ useEffect(() => {
10
+ if (choice === 'none') {
11
+ model.setImportFormSyntenyTrack(0, { type: 'none' });
12
+ }
13
+ }, [model, choice]);
14
+ return (_jsxs(_Fragment, { children: [_jsxs(FormControl, { children: [_jsx(FormLabel, { id: "group-label", children: "(Optional) Select or add a synteny track" }), _jsxs(RadioGroup, { row: true, value: choice, onChange: event => {
15
+ setChoice(event.target.value);
16
+ }, "aria-labelledby": "group-label", children: [_jsx(FormControlLabel, { value: "none", control: _jsx(Radio, {}), label: "None" }), _jsx(FormControlLabel, { value: "tracklist", control: _jsx(Radio, {}), label: "Existing track" }), _jsx(FormControlLabel, { value: "custom", control: _jsx(Radio, {}), label: "New track" })] })] }), choice === 'custom' ? (_jsx(ImportSyntenyOpenCustomTrack, { model: model, assembly2: assembly2, assembly1: assembly1 })) : null, choice === 'tracklist' ? (_jsx(ImportSyntenyTrackSelector, { model: model, assembly1: assembly1, assembly2: assembly2 })) : null] }));
17
+ });
18
+ export default TrackSelector;
@@ -0,0 +1,117 @@
1
+ import type { FileLocation } from '@jbrowse/core/util';
2
+ export declare function getAdapter({ radioOption, assembly1, assembly2, fileLocation, indexFileLocation, bed1Location, bed2Location, }: {
3
+ radioOption: string;
4
+ assembly1: string;
5
+ assembly2: string;
6
+ fileLocation?: FileLocation;
7
+ indexFileLocation?: FileLocation;
8
+ bed1Location?: FileLocation;
9
+ bed2Location?: FileLocation;
10
+ }): {
11
+ type: string;
12
+ pafLocation: FileLocation | undefined;
13
+ queryAssembly: string;
14
+ targetAssembly: string;
15
+ outLocation?: undefined;
16
+ deltaLocation?: undefined;
17
+ chainLocation?: undefined;
18
+ mcscanAnchorsLocation?: undefined;
19
+ bed1Location?: undefined;
20
+ bed2Location?: undefined;
21
+ assemblyNames?: undefined;
22
+ mcscanSimpleAnchorsLocation?: undefined;
23
+ pifGzLocation?: undefined;
24
+ index?: undefined;
25
+ } | {
26
+ type: string;
27
+ outLocation: FileLocation | undefined;
28
+ queryAssembly: string;
29
+ targetAssembly: string;
30
+ pafLocation?: undefined;
31
+ deltaLocation?: undefined;
32
+ chainLocation?: undefined;
33
+ mcscanAnchorsLocation?: undefined;
34
+ bed1Location?: undefined;
35
+ bed2Location?: undefined;
36
+ assemblyNames?: undefined;
37
+ mcscanSimpleAnchorsLocation?: undefined;
38
+ pifGzLocation?: undefined;
39
+ index?: undefined;
40
+ } | {
41
+ type: string;
42
+ deltaLocation: FileLocation | undefined;
43
+ queryAssembly: string;
44
+ targetAssembly: string;
45
+ pafLocation?: undefined;
46
+ outLocation?: undefined;
47
+ chainLocation?: undefined;
48
+ mcscanAnchorsLocation?: undefined;
49
+ bed1Location?: undefined;
50
+ bed2Location?: undefined;
51
+ assemblyNames?: undefined;
52
+ mcscanSimpleAnchorsLocation?: undefined;
53
+ pifGzLocation?: undefined;
54
+ index?: undefined;
55
+ } | {
56
+ type: string;
57
+ chainLocation: FileLocation | undefined;
58
+ queryAssembly: string;
59
+ targetAssembly: string;
60
+ pafLocation?: undefined;
61
+ outLocation?: undefined;
62
+ deltaLocation?: undefined;
63
+ mcscanAnchorsLocation?: undefined;
64
+ bed1Location?: undefined;
65
+ bed2Location?: undefined;
66
+ assemblyNames?: undefined;
67
+ mcscanSimpleAnchorsLocation?: undefined;
68
+ pifGzLocation?: undefined;
69
+ index?: undefined;
70
+ } | {
71
+ type: string;
72
+ mcscanAnchorsLocation: FileLocation | undefined;
73
+ bed1Location: FileLocation | undefined;
74
+ bed2Location: FileLocation | undefined;
75
+ assemblyNames: string[];
76
+ pafLocation?: undefined;
77
+ queryAssembly?: undefined;
78
+ targetAssembly?: undefined;
79
+ outLocation?: undefined;
80
+ deltaLocation?: undefined;
81
+ chainLocation?: undefined;
82
+ mcscanSimpleAnchorsLocation?: undefined;
83
+ pifGzLocation?: undefined;
84
+ index?: undefined;
85
+ } | {
86
+ type: string;
87
+ mcscanSimpleAnchorsLocation: FileLocation | undefined;
88
+ bed1Location: FileLocation | undefined;
89
+ bed2Location: FileLocation | undefined;
90
+ assemblyNames: string[];
91
+ pafLocation?: undefined;
92
+ queryAssembly?: undefined;
93
+ targetAssembly?: undefined;
94
+ outLocation?: undefined;
95
+ deltaLocation?: undefined;
96
+ chainLocation?: undefined;
97
+ mcscanAnchorsLocation?: undefined;
98
+ pifGzLocation?: undefined;
99
+ index?: undefined;
100
+ } | {
101
+ type: string;
102
+ pifGzLocation: FileLocation | undefined;
103
+ index: {
104
+ location: FileLocation | undefined;
105
+ };
106
+ assemblyNames: string[];
107
+ pafLocation?: undefined;
108
+ queryAssembly?: undefined;
109
+ targetAssembly?: undefined;
110
+ outLocation?: undefined;
111
+ deltaLocation?: undefined;
112
+ chainLocation?: undefined;
113
+ mcscanAnchorsLocation?: undefined;
114
+ bed1Location?: undefined;
115
+ bed2Location?: undefined;
116
+ mcscanSimpleAnchorsLocation?: undefined;
117
+ };
@@ -0,0 +1,65 @@
1
+ export function getAdapter({ radioOption, assembly1, assembly2, fileLocation, indexFileLocation, bed1Location, bed2Location, }) {
2
+ if (radioOption === '.paf') {
3
+ return {
4
+ type: 'PAFAdapter',
5
+ pafLocation: fileLocation,
6
+ queryAssembly: assembly1,
7
+ targetAssembly: assembly2,
8
+ };
9
+ }
10
+ else if (radioOption === '.out') {
11
+ return {
12
+ type: 'MashMapAdapter',
13
+ outLocation: fileLocation,
14
+ queryAssembly: assembly1,
15
+ targetAssembly: assembly2,
16
+ };
17
+ }
18
+ else if (radioOption === '.delta') {
19
+ return {
20
+ type: 'DeltaAdapter',
21
+ deltaLocation: fileLocation,
22
+ queryAssembly: assembly1,
23
+ targetAssembly: assembly2,
24
+ };
25
+ }
26
+ else if (radioOption === '.chain') {
27
+ return {
28
+ type: 'ChainAdapter',
29
+ chainLocation: fileLocation,
30
+ queryAssembly: assembly1,
31
+ targetAssembly: assembly2,
32
+ };
33
+ }
34
+ else if (radioOption === '.anchors') {
35
+ return {
36
+ type: 'MCScanAnchorsAdapter',
37
+ mcscanAnchorsLocation: fileLocation,
38
+ bed1Location,
39
+ bed2Location,
40
+ assemblyNames: [assembly1, assembly2],
41
+ };
42
+ }
43
+ else if (radioOption === '.anchors.simple') {
44
+ return {
45
+ type: 'MCScanSimpleAnchorsAdapter',
46
+ mcscanSimpleAnchorsLocation: fileLocation,
47
+ bed1Location,
48
+ bed2Location,
49
+ assemblyNames: [assembly1, assembly2],
50
+ };
51
+ }
52
+ else if (radioOption === '.pif.gz') {
53
+ return {
54
+ type: 'PairwiseIndexedPAFAdapter',
55
+ pifGzLocation: fileLocation,
56
+ index: {
57
+ location: indexFileLocation,
58
+ },
59
+ assemblyNames: [assembly1, assembly2],
60
+ };
61
+ }
62
+ else {
63
+ throw new Error(`Unknown to detect type ${radioOption} from filename (select radio button to clarify)`);
64
+ }
65
+ }
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
- import { DotplotViewModel } from '../../model';
3
- declare const DotplotImportForm: ({ model }: {
1
+ import type { DotplotViewModel } from '../../model';
2
+ declare const DotplotImportForm: ({ model, }: {
4
3
  model: DotplotViewModel;
5
- }) => React.JSX.Element;
4
+ }) => import("react/jsx-runtime").JSX.Element;
6
5
  export default DotplotImportForm;
@@ -1,12 +1,12 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { Button, Container, FormControl, FormLabel, FormControlLabel, Grid, Paper, Radio, RadioGroup, Typography, } from '@mui/material';
3
- import { makeStyles } from 'tss-react/mui';
4
- import { observer } from 'mobx-react';
5
- import { transaction } from 'mobx';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { AssemblySelector, ErrorMessage } from '@jbrowse/core/ui';
6
4
  import { getSession, isSessionWithAddTracks } from '@jbrowse/core/util';
7
- import { ErrorMessage, AssemblySelector } from '@jbrowse/core/ui';
8
- import ImportCustomTrack from './ImportCustomTrack';
9
- import ImportSyntenyTrackSelector from './ImportSyntenyTrackSelector';
5
+ import { Button, Container, FormControl, Grid2, Paper, Typography, } from '@mui/material';
6
+ import { toJS, transaction } from 'mobx';
7
+ import { observer } from 'mobx-react';
8
+ import { makeStyles } from 'tss-react/mui';
9
+ import TrackSelector from './TrackSelector';
10
10
  const useStyles = makeStyles()(theme => ({
11
11
  importFormContainer: {
12
12
  padding: theme.spacing(4),
@@ -17,82 +17,55 @@ const useStyles = makeStyles()(theme => ({
17
17
  margin: '0 auto',
18
18
  },
19
19
  }));
20
- function TrackSelector({ setSessionTrackData, setShowTrackId, sessionTrackData, assembly1, assembly2, model, }) {
21
- const [choice, setChoice] = useState('tracklist');
22
- useEffect(() => {
23
- if (choice === 'none') {
24
- setSessionTrackData(undefined);
25
- setShowTrackId(undefined);
20
+ function doSubmit({ model, assembly1, assembly2, }) {
21
+ const session = getSession(model);
22
+ const { importFormSyntenyTrackSelections } = model;
23
+ model.setError(undefined);
24
+ transaction(() => {
25
+ if (isSessionWithAddTracks(session)) {
26
+ toJS(importFormSyntenyTrackSelections).map((f, idx) => {
27
+ var _a;
28
+ if (f.type === 'userOpened') {
29
+ session.addTrackConf(f.value);
30
+ model.toggleTrack((_a = f.value) === null || _a === void 0 ? void 0 : _a.trackId);
31
+ }
32
+ else if (f.type === 'preConfigured') {
33
+ model.showTrack(f.value, idx);
34
+ }
35
+ });
26
36
  }
27
- }, [choice, setSessionTrackData, setShowTrackId]);
28
- return (React.createElement(React.Fragment, null,
29
- React.createElement(FormControl, null,
30
- React.createElement(FormLabel, { id: "group-label" }, "(Optional) Select or add a synteny track"),
31
- React.createElement(RadioGroup, { row: true, value: choice, onChange: event => {
32
- setChoice(event.target.value);
33
- }, "aria-labelledby": "group-label" },
34
- React.createElement(FormControlLabel, { value: "none", control: React.createElement(Radio, null), label: "None" }),
35
- React.createElement(FormControlLabel, { value: "tracklist", control: React.createElement(Radio, null), label: "Existing track" }),
36
- React.createElement(FormControlLabel, { value: "custom", control: React.createElement(Radio, null), label: "New track" }))),
37
- choice === 'custom' ? (React.createElement(ImportCustomTrack, { setSessionTrackData: setSessionTrackData, sessionTrackData: sessionTrackData, assembly2: assembly2, assembly1: assembly1 })) : null,
38
- choice === 'tracklist' ? (React.createElement(ImportSyntenyTrackSelector, { model: model, assembly1: assembly1, assembly2: assembly2, setShowTrackId: setShowTrackId })) : null));
37
+ model.showAllRegions();
38
+ model.setAssemblyNames(assembly2, assembly1);
39
+ });
39
40
  }
40
- const DotplotImportForm = observer(({ model }) => {
41
+ const DotplotImportForm = observer(function ({ model, }) {
41
42
  const { classes } = useStyles();
42
43
  const session = getSession(model);
43
44
  const { assemblyNames } = session;
44
45
  const [assembly2, setAssembly2] = useState(assemblyNames[0] || '');
45
46
  const [assembly1, setAssembly1] = useState(assemblyNames[0] || '');
46
47
  const [error, setError] = useState();
47
- const [sessionTrackData, setSessionTrackData] = useState();
48
- const [showTrackId, setShowTrackId] = useState();
49
- function onOpenClick() {
50
- try {
51
- if (!isSessionWithAddTracks(session)) {
52
- return;
53
- }
54
- setError(undefined);
55
- model.setError(undefined);
56
- transaction(() => {
57
- if (sessionTrackData) {
58
- session.addTrackConf(sessionTrackData);
59
- model.toggleTrack(sessionTrackData.trackId);
60
- }
61
- else if (showTrackId) {
62
- model.showTrack(showTrackId);
63
- }
64
- model.setViews([
65
- { bpPerPx: 0.1, offsetPx: 0 },
66
- { bpPerPx: 0.1, offsetPx: 0 },
67
- ]);
68
- model.setAssemblyNames(assembly2, assembly1);
69
- });
70
- }
71
- catch (e) {
72
- console.error(e);
73
- setError(e);
74
- }
75
- }
76
- // this is a combination of any displayed error message we have
77
48
  const displayError = error || model.error;
78
- return (React.createElement(Container, { className: classes.importFormContainer },
79
- displayError ? React.createElement(ErrorMessage, { error: displayError }) : null,
80
- React.createElement(Grid, { container: true, spacing: 1, justifyContent: "center", alignItems: "center", className: classes.assemblySelector },
81
- React.createElement(Grid, { item: true },
82
- React.createElement(Paper, { style: { padding: 12 } },
83
- React.createElement(Typography, { style: { textAlign: 'center' } }, "Select assemblies for dotplot view"),
84
- React.createElement(Grid, { container: true, spacing: 1, justifyContent: "center", alignItems: "center" },
85
- React.createElement(Grid, { item: true },
86
- React.createElement(AssemblySelector, { selected: assembly1, onChange: val => {
87
- setAssembly1(val);
88
- }, session: session })),
89
- React.createElement(Grid, { item: true },
90
- React.createElement(AssemblySelector, { selected: assembly2, onChange: val => {
49
+ return (_jsxs(Container, { className: classes.importFormContainer, children: [displayError ? _jsx(ErrorMessage, { error: displayError }) : null, _jsxs(Paper, { style: { padding: 12 }, children: [_jsx(Typography, { style: { textAlign: 'center' }, children: "Select assemblies for dotplot view" }), _jsxs(Grid2, { container: true, spacing: 1, justifyContent: "center", alignItems: "center", children: [_jsx(AssemblySelector, { helperText: "x-axis assembly", selected: assembly2, session: session, onChange: val => {
91
50
  setAssembly2(val);
92
- }, session: session })),
93
- React.createElement(Grid, { item: true },
94
- React.createElement(FormControl, null,
95
- React.createElement(Button, { onClick: onOpenClick, variant: "contained", color: "primary" }, "Launch"))))),
96
- React.createElement(TrackSelector, { setShowTrackId: setShowTrackId, assembly2: assembly2, assembly1: assembly1, setSessionTrackData: setSessionTrackData, sessionTrackData: sessionTrackData, model: model })))));
51
+ } }), _jsx(AssemblySelector, { helperText: "y-axis assembly", selected: assembly1, session: session, onChange: val => {
52
+ setAssembly1(val);
53
+ } }), _jsx(FormControl, { children: _jsx(Button, { onClick: () => {
54
+ ;
55
+ (async () => {
56
+ try {
57
+ setError(undefined);
58
+ doSubmit({
59
+ assembly1,
60
+ assembly2,
61
+ model,
62
+ });
63
+ }
64
+ catch (e) {
65
+ console.error(e);
66
+ setError(e);
67
+ }
68
+ })();
69
+ }, variant: "contained", color: "primary", children: "Launch" }) })] }), _jsx(TrackSelector, { assembly2: assembly2, assembly1: assembly1, model: model })] })] }));
97
70
  });
98
71
  export default DotplotImportForm;
@@ -1,10 +1,8 @@
1
1
  export function getName(sessionTrackData) {
2
2
  return sessionTrackData
3
- ? // @ts-expect-error
3
+ ?
4
4
  sessionTrackData.uri ||
5
- // @ts-expect-error
6
5
  sessionTrackData.localPath ||
7
- // @ts-expect-error
8
6
  sessionTrackData.name
9
7
  : undefined;
10
8
  }
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
- import { DotplotViewModel } from '../model';
1
+ import type { DotplotViewModel } from '../model';
3
2
  declare const PanButtons: ({ model, }: {
4
3
  model: DotplotViewModel;
5
- }) => React.JSX.Element;
4
+ }) => import("react/jsx-runtime").JSX.Element;
6
5
  export default PanButtons;