@jbrowse/plugin-linear-comparative-view 2.15.4 → 2.16.1

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 (121) hide show
  1. package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +2 -1
  2. package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +4 -2
  3. package/dist/LGVSyntenyDisplay/components/util.d.ts +4 -1
  4. package/dist/LGVSyntenyDisplay/components/util.js +7 -15
  5. package/dist/LGVSyntenyDisplay/model.d.ts +26 -14
  6. package/dist/LGVSyntenyDisplay/model.js +23 -1
  7. package/dist/LaunchLinearSyntenyView.js +41 -11
  8. package/dist/LinearComparativeDisplay/stateModelFactory.d.ts +42 -14
  9. package/dist/LinearComparativeDisplay/stateModelFactory.js +20 -10
  10. package/dist/LinearComparativeView/components/Header.d.ts +2 -3
  11. package/dist/LinearComparativeView/components/Header.js +72 -62
  12. package/dist/LinearComparativeView/components/HeaderSearchBoxes.d.ts +6 -0
  13. package/dist/LinearComparativeView/components/HeaderSearchBoxes.js +34 -0
  14. package/dist/LinearComparativeView/components/LinearComparativeRenderArea.d.ts +6 -0
  15. package/dist/LinearComparativeView/components/LinearComparativeRenderArea.js +61 -0
  16. package/dist/LinearComparativeView/components/LinearComparativeView.d.ts +2 -4
  17. package/dist/LinearComparativeView/components/LinearComparativeView.js +3 -67
  18. package/dist/LinearComparativeView/components/Rubberband.js +1 -1
  19. package/dist/LinearComparativeView/index.js +3 -0
  20. package/dist/LinearComparativeView/model.d.ts +265 -12
  21. package/dist/LinearComparativeView/model.js +45 -75
  22. package/dist/LinearSyntenyDisplay/afterAttach.js +5 -4
  23. package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +47 -32
  24. package/dist/LinearSyntenyDisplay/components/SyntenyContextMenu.js +10 -6
  25. package/dist/LinearSyntenyDisplay/components/util.d.ts +7 -2
  26. package/dist/LinearSyntenyDisplay/components/util.js +12 -14
  27. package/dist/LinearSyntenyDisplay/drawSynteny.d.ts +1 -1
  28. package/dist/LinearSyntenyDisplay/drawSynteny.js +29 -25
  29. package/dist/LinearSyntenyDisplay/index.js +1 -1
  30. package/dist/LinearSyntenyDisplay/model.d.ts +48 -10
  31. package/dist/LinearSyntenyDisplay/model.js +38 -15
  32. package/dist/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.d.ts → AddCustomTrack.d.ts} +2 -3
  33. package/dist/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.js → AddCustomTrack.js} +3 -3
  34. package/dist/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.js +195 -0
  35. package/dist/LinearSyntenyView/components/ImportForm/Spacer.d.ts +2 -0
  36. package/dist/LinearSyntenyView/components/ImportForm/Spacer.js +10 -0
  37. package/dist/LinearSyntenyView/components/ImportForm/TrackSelector.d.ts +10 -0
  38. package/dist/LinearSyntenyView/components/ImportForm/{ImportSyntenyTrackSelector.js → TrackSelector.js} +15 -20
  39. package/dist/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.d.ts +14 -0
  40. package/dist/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.js +52 -0
  41. package/dist/LinearSyntenyView/components/LinearSyntenyView.js +3 -3
  42. package/dist/LinearSyntenyView/index.js +1 -1
  43. package/dist/LinearSyntenyView/model.d.ts +267 -9
  44. package/dist/LinearSyntenyView/model.js +2 -2
  45. package/dist/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.d.ts +12 -0
  46. package/dist/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.js +19 -0
  47. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +1 -3
  48. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +36 -27
  49. package/dist/LinearSyntenyViewHelper/index.d.ts +2 -0
  50. package/dist/LinearSyntenyViewHelper/index.js +25 -0
  51. package/dist/LinearSyntenyViewHelper/stateModelFactory.d.ts +30 -0
  52. package/dist/LinearSyntenyViewHelper/stateModelFactory.js +105 -0
  53. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +14 -0
  54. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +100 -0
  55. package/dist/SyntenyFeatureDetail/index.d.ts +2 -0
  56. package/dist/SyntenyFeatureDetail/index.js +56 -0
  57. package/dist/index.js +4 -0
  58. package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +2 -1
  59. package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +4 -2
  60. package/esm/LGVSyntenyDisplay/components/util.d.ts +4 -1
  61. package/esm/LGVSyntenyDisplay/components/util.js +8 -16
  62. package/esm/LGVSyntenyDisplay/model.d.ts +26 -14
  63. package/esm/LGVSyntenyDisplay/model.js +25 -3
  64. package/esm/LaunchLinearSyntenyView.js +41 -11
  65. package/esm/LinearComparativeDisplay/stateModelFactory.d.ts +42 -14
  66. package/esm/LinearComparativeDisplay/stateModelFactory.js +21 -11
  67. package/esm/LinearComparativeView/components/Header.d.ts +2 -3
  68. package/esm/LinearComparativeView/components/Header.js +73 -63
  69. package/esm/LinearComparativeView/components/HeaderSearchBoxes.d.ts +6 -0
  70. package/esm/LinearComparativeView/components/HeaderSearchBoxes.js +29 -0
  71. package/esm/LinearComparativeView/components/LinearComparativeRenderArea.d.ts +6 -0
  72. package/esm/LinearComparativeView/components/LinearComparativeRenderArea.js +56 -0
  73. package/esm/LinearComparativeView/components/LinearComparativeView.d.ts +2 -4
  74. package/esm/LinearComparativeView/components/LinearComparativeView.js +3 -67
  75. package/esm/LinearComparativeView/components/Rubberband.js +1 -1
  76. package/esm/LinearComparativeView/index.js +3 -0
  77. package/esm/LinearComparativeView/model.d.ts +265 -12
  78. package/esm/LinearComparativeView/model.js +47 -77
  79. package/esm/LinearSyntenyDisplay/afterAttach.js +5 -4
  80. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +48 -33
  81. package/esm/LinearSyntenyDisplay/components/SyntenyContextMenu.js +10 -6
  82. package/esm/LinearSyntenyDisplay/components/util.d.ts +7 -2
  83. package/esm/LinearSyntenyDisplay/components/util.js +12 -14
  84. package/esm/LinearSyntenyDisplay/drawSynteny.d.ts +1 -1
  85. package/esm/LinearSyntenyDisplay/drawSynteny.js +29 -25
  86. package/esm/LinearSyntenyDisplay/index.js +1 -1
  87. package/esm/LinearSyntenyDisplay/model.d.ts +48 -10
  88. package/esm/LinearSyntenyDisplay/model.js +38 -15
  89. package/esm/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.d.ts → AddCustomTrack.d.ts} +2 -3
  90. package/esm/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.js → AddCustomTrack.js} +3 -3
  91. package/esm/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.js +167 -0
  92. package/esm/LinearSyntenyView/components/ImportForm/Spacer.d.ts +2 -0
  93. package/esm/LinearSyntenyView/components/ImportForm/Spacer.js +4 -0
  94. package/esm/LinearSyntenyView/components/ImportForm/TrackSelector.d.ts +10 -0
  95. package/esm/LinearSyntenyView/components/ImportForm/{ImportSyntenyTrackSelector.js → TrackSelector.js} +15 -20
  96. package/esm/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.d.ts +14 -0
  97. package/esm/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.js +23 -0
  98. package/esm/LinearSyntenyView/components/LinearSyntenyView.js +3 -3
  99. package/esm/LinearSyntenyView/index.js +1 -1
  100. package/esm/LinearSyntenyView/model.d.ts +267 -9
  101. package/esm/LinearSyntenyView/model.js +2 -2
  102. package/esm/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.d.ts +12 -0
  103. package/esm/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.js +13 -0
  104. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +1 -3
  105. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +38 -29
  106. package/esm/LinearSyntenyViewHelper/index.d.ts +2 -0
  107. package/esm/LinearSyntenyViewHelper/index.js +19 -0
  108. package/esm/LinearSyntenyViewHelper/stateModelFactory.d.ts +30 -0
  109. package/esm/LinearSyntenyViewHelper/stateModelFactory.js +102 -0
  110. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +14 -0
  111. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +72 -0
  112. package/esm/SyntenyFeatureDetail/index.d.ts +2 -0
  113. package/esm/SyntenyFeatureDetail/index.js +27 -0
  114. package/esm/index.js +4 -0
  115. package/package.json +3 -3
  116. package/dist/LinearSyntenyView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +0 -9
  117. package/dist/LinearSyntenyView/components/ImportForm/index.js +0 -138
  118. package/esm/LinearSyntenyView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +0 -9
  119. package/esm/LinearSyntenyView/components/ImportForm/index.js +0 -110
  120. /package/dist/LinearSyntenyView/components/ImportForm/{index.d.ts → LinearSyntenyImportForm.d.ts} +0 -0
  121. /package/esm/LinearSyntenyView/components/ImportForm/{index.d.ts → LinearSyntenyImportForm.d.ts} +0 -0
@@ -2,10 +2,9 @@ import React from 'react';
2
2
  import { SnapshotIn } from 'mobx-state-tree';
3
3
  import { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
4
  type Conf = SnapshotIn<AnyConfigurationModel>;
5
- declare const ImportCustomTrack: ({ assembly1, assembly2, setSessionTrackData, }: {
6
- sessionTrackData: Conf;
5
+ declare const ImportCustomTrack: ({ assembly1, assembly2, setUserOpenedSyntenyTrack, }: {
7
6
  assembly1: string;
8
7
  assembly2: string;
9
- setSessionTrackData: (arg: Conf) => void;
8
+ setUserOpenedSyntenyTrack: (arg: Conf) => void;
10
9
  }) => React.JSX.Element;
11
10
  export default ImportCustomTrack;
@@ -66,7 +66,7 @@ function getAdapter({ radioOption, assembly1, assembly2, fileLocation, indexFile
66
66
  throw new Error(`Unknown to detect type ${radioOption} from filename (select radio button to clarify)`);
67
67
  }
68
68
  }
69
- const ImportCustomTrack = observer(function ({ assembly1, assembly2, setSessionTrackData, }) {
69
+ const ImportCustomTrack = observer(function ({ assembly1, assembly2, setUserOpenedSyntenyTrack, }) {
70
70
  const [bed2Location, setBed2Location] = useState();
71
71
  const [bed1Location, setBed1Location] = useState();
72
72
  const [fileLocation, setFileLocation] = useState();
@@ -81,7 +81,7 @@ const ImportCustomTrack = observer(function ({ assembly1, assembly2, setSessionT
81
81
  const fn = fileName ? basename(fileName) : 'MyTrack';
82
82
  const trackId = `${fn}-${Date.now()}`;
83
83
  setError(undefined);
84
- setSessionTrackData({
84
+ setUserOpenedSyntenyTrack({
85
85
  trackId,
86
86
  name: fn,
87
87
  assemblyNames: [assembly2, assembly1],
@@ -111,7 +111,7 @@ const ImportCustomTrack = observer(function ({ assembly1, assembly2, setSessionT
111
111
  fileLocation,
112
112
  indexFileLocation,
113
113
  radioOption,
114
- setSessionTrackData,
114
+ setUserOpenedSyntenyTrack,
115
115
  ]);
116
116
  return (React.createElement(Paper, { style: { padding: 12 } },
117
117
  error ? React.createElement(ErrorMessage, { error: error }) : null,
@@ -0,0 +1,167 @@
1
+ import React, { useState } from 'react';
2
+ import { Button, Container, IconButton } from '@mui/material';
3
+ import { makeStyles } from 'tss-react/mui';
4
+ import { observer } from 'mobx-react';
5
+ import { getSession, isSessionWithAddTracks, notEmpty, } from '@jbrowse/core/util';
6
+ import { ErrorMessage, AssemblySelector } from '@jbrowse/core/ui';
7
+ // icons
8
+ import CloseIcon from '@mui/icons-material/Close';
9
+ import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
10
+ import TrackSelector from './TrackSelectorUtil';
11
+ import Spacer from './Spacer';
12
+ const useStyles = makeStyles()(theme => ({
13
+ importFormContainer: {
14
+ padding: theme.spacing(4),
15
+ },
16
+ button: {
17
+ margin: theme.spacing(2),
18
+ },
19
+ rel: {
20
+ position: 'relative',
21
+ },
22
+ synbutton: {
23
+ position: 'absolute',
24
+ top: 30,
25
+ },
26
+ flex: {
27
+ display: 'flex',
28
+ },
29
+ mb: {
30
+ marginBottom: 10,
31
+ },
32
+ bg: {
33
+ background: theme.palette.divider,
34
+ },
35
+ fixedWidth: {
36
+ width: 700,
37
+ },
38
+ }));
39
+ const LinearSyntenyViewImportForm = observer(function ({ model, }) {
40
+ const { classes, cx } = useStyles();
41
+ const session = getSession(model);
42
+ const { assemblyNames } = session;
43
+ const defaultAssemblyName = assemblyNames[0] || '';
44
+ const [selectedRow, setSelectedRow] = useState(0);
45
+ const [selectedAssemblyNames, setSelectedAssemblyNames] = useState([
46
+ defaultAssemblyName,
47
+ defaultAssemblyName,
48
+ ]);
49
+ const [error, setError] = useState();
50
+ const [userOpenedSyntenyTracksToShow, setUserOpenedSyntenyTracksToShow] = useState([]);
51
+ const [preConfiguredSyntenyTracksToShow, setPreConfiguredSyntenyTracksToShow,] = useState([]);
52
+ return (React.createElement(Container, { className: classes.importFormContainer },
53
+ error ? React.createElement(ErrorMessage, { error: error }) : null,
54
+ React.createElement("div", { className: classes.flex },
55
+ React.createElement(Spacer, null),
56
+ React.createElement("div", null,
57
+ React.createElement("div", { className: classes.mb }, "Select assemblies for linear synteny view"),
58
+ selectedAssemblyNames.map((assemblyName, idx) => (React.createElement("div", { key: `${assemblyName}-${idx}`, className: classes.rel },
59
+ React.createElement("span", null,
60
+ "Row ",
61
+ idx + 1,
62
+ ": "),
63
+ React.createElement(IconButton, { disabled: selectedAssemblyNames.length <= 2, onClick: () => {
64
+ setSelectedAssemblyNames(selectedAssemblyNames
65
+ .map((asm, idx2) => (idx2 === idx ? undefined : asm))
66
+ .filter(notEmpty));
67
+ setPreConfiguredSyntenyTracksToShow(preConfiguredSyntenyTracksToShow
68
+ .map((asm, idx2) => (idx2 === idx ? undefined : asm))
69
+ .filter(notEmpty));
70
+ setUserOpenedSyntenyTracksToShow(userOpenedSyntenyTracksToShow
71
+ .map((asm, idx2) => (idx2 === idx ? undefined : asm))
72
+ .filter(notEmpty));
73
+ if (selectedRow >= selectedAssemblyNames.length - 2) {
74
+ setSelectedRow(0);
75
+ }
76
+ } },
77
+ React.createElement(CloseIcon, null)),
78
+ React.createElement(AssemblySelector, { helperText: "", selected: assemblyName, onChange: newAssembly => {
79
+ setSelectedAssemblyNames(selectedAssemblyNames.map((asm, idx2) => idx2 === idx ? newAssembly : asm));
80
+ }, session: session }),
81
+ idx !== selectedAssemblyNames.length - 1 ? (React.createElement(IconButton, { className: cx(classes.synbutton, idx === selectedRow ? classes.bg : undefined), onClick: () => {
82
+ setSelectedRow(idx);
83
+ } },
84
+ React.createElement(ArrowForwardIosIcon, null))) : null))),
85
+ React.createElement("div", null,
86
+ React.createElement(Button, { className: classes.button, variant: "contained", color: "secondary", onClick: () => {
87
+ setSelectedAssemblyNames([
88
+ ...selectedAssemblyNames,
89
+ defaultAssemblyName,
90
+ ]);
91
+ } }, "Add row"),
92
+ React.createElement(Button, { className: classes.button, onClick: () => {
93
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
94
+ ;
95
+ (async () => {
96
+ try {
97
+ setError(undefined);
98
+ await doSubmit({
99
+ userOpenedSyntenyTracksToShow,
100
+ preConfiguredSyntenyTracksToShow,
101
+ selectedAssemblyNames,
102
+ model,
103
+ });
104
+ }
105
+ catch (e) {
106
+ console.error(e);
107
+ setError(e);
108
+ }
109
+ })();
110
+ }, variant: "contained", color: "primary" }, "Launch"))),
111
+ React.createElement(Spacer, null),
112
+ React.createElement("div", { className: classes.fixedWidth },
113
+ React.createElement("div", null,
114
+ "Synteny dataset to display between row ",
115
+ selectedRow + 1,
116
+ " and",
117
+ ' ',
118
+ selectedRow + 2),
119
+ React.createElement(TrackSelector, { model: model, preConfiguredSyntenyTrack: preConfiguredSyntenyTracksToShow[selectedRow], assembly1: selectedAssemblyNames[selectedRow], assembly2: selectedAssemblyNames[selectedRow + 1], setPreConfiguredSyntenyTrack: arg => {
120
+ const clone = [...preConfiguredSyntenyTracksToShow];
121
+ clone[selectedRow] = arg;
122
+ setPreConfiguredSyntenyTracksToShow(clone);
123
+ }, setUserOpenedSyntenyTrack: arg => {
124
+ const clone = [...userOpenedSyntenyTracksToShow];
125
+ clone[selectedRow] = arg;
126
+ setUserOpenedSyntenyTracksToShow(clone);
127
+ } }))),
128
+ React.createElement(Spacer, null)));
129
+ });
130
+ async function doSubmit({ selectedAssemblyNames, model, preConfiguredSyntenyTracksToShow, userOpenedSyntenyTracksToShow, }) {
131
+ const session = getSession(model);
132
+ const { assemblyManager } = session;
133
+ model.setViews(await Promise.all(selectedAssemblyNames.map(async (assemblyName) => {
134
+ const asm = await assemblyManager.waitForAssembly(assemblyName);
135
+ if (!asm) {
136
+ throw new Error(`Assembly "${assemblyName}" failed to load`);
137
+ }
138
+ return {
139
+ type: 'LinearGenomeView',
140
+ bpPerPx: 1,
141
+ offsetPx: 0,
142
+ hideHeader: true,
143
+ displayedRegions: asm.regions,
144
+ };
145
+ })));
146
+ for (const view of model.views) {
147
+ view.setWidth(model.width);
148
+ view.showAllRegions();
149
+ }
150
+ if (!isSessionWithAddTracks(session)) {
151
+ session.notify("Can't add tracks", 'warning');
152
+ }
153
+ else {
154
+ userOpenedSyntenyTracksToShow.map((f, idx) => {
155
+ if (f) {
156
+ session.addTrackConf(f);
157
+ model.toggleTrack(f.trackId, idx);
158
+ }
159
+ });
160
+ }
161
+ preConfiguredSyntenyTracksToShow.map((f, idx) => {
162
+ if (f) {
163
+ model.showTrack(f, idx);
164
+ }
165
+ });
166
+ }
167
+ export default LinearSyntenyViewImportForm;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export default function Spacer(): React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export default function Spacer() {
3
+ return React.createElement("div", { style: { flexGrow: 1 } });
4
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { LinearSyntenyViewModel } from '../../model';
3
+ declare const ImportSyntenyTrackSelector: ({ model, assembly1, assembly2, preConfiguredSyntenyTrack, setPreConfiguredSyntenyTrack, }: {
4
+ model: LinearSyntenyViewModel;
5
+ assembly1: string;
6
+ assembly2: string;
7
+ preConfiguredSyntenyTrack: string | undefined;
8
+ setPreConfiguredSyntenyTrack: (arg: string) => void;
9
+ }) => React.JSX.Element;
10
+ export default ImportSyntenyTrackSelector;
@@ -5,35 +5,30 @@ import { getTrackName } from '@jbrowse/core/util/tracks';
5
5
  import { ErrorMessage } from '@jbrowse/core/ui';
6
6
  import { readConfObject, } from '@jbrowse/core/configuration';
7
7
  import { observer } from 'mobx-react';
8
- function f(track, assembly1, assembly2) {
9
- const assemblyNames = readConfObject(track, 'assemblyNames');
10
- return (assemblyNames.includes(assembly1) &&
11
- assemblyNames.includes(assembly2) &&
12
- track.type.includes('Synteny'));
13
- }
14
- const Selector = observer(({ model, assembly1, assembly2, setShowTrackId, }) => {
8
+ const ImportSyntenyTrackSelector = observer(function ({ model, assembly1, assembly2, preConfiguredSyntenyTrack, setPreConfiguredSyntenyTrack, }) {
15
9
  var _a;
16
10
  const session = getSession(model);
17
11
  const { tracks = [], sessionTracks = [] } = session;
18
12
  const allTracks = [...tracks, ...sessionTracks];
19
- const filteredTracks = allTracks.filter(t => f(t, assembly2, assembly1));
13
+ const filteredTracks = allTracks.filter(track => {
14
+ const assemblyNames = readConfObject(track, 'assemblyNames');
15
+ return (assemblyNames.includes(assembly1) &&
16
+ assemblyNames.includes(assembly2) &&
17
+ track.type.includes('Synteny'));
18
+ });
20
19
  const resetTrack = ((_a = filteredTracks[0]) === null || _a === void 0 ? void 0 : _a.trackId) || '';
21
20
  const [value, setValue] = useState(resetTrack);
22
21
  useEffect(() => {
23
- // if assembly1/assembly2 changes, then we will want to use this effect to
24
- // change the state of the useState because it otherwise gets locked to a
25
- // stale value
26
- setValue(resetTrack);
27
- }, [resetTrack]);
28
- useEffect(() => {
29
- // sets track data in a useEffect because the initial load is needed as well
30
- // as onChange's to the select box
31
- setShowTrackId(value);
32
- }, [value, setShowTrackId]);
22
+ // sets track data in a useEffect because the initial load is needed as
23
+ // well as onChange's to the select box
24
+ if (value !== preConfiguredSyntenyTrack) {
25
+ setPreConfiguredSyntenyTrack(value);
26
+ }
27
+ }, [value, preConfiguredSyntenyTrack, setPreConfiguredSyntenyTrack]);
33
28
  return (React.createElement(Paper, { style: { padding: 12 } },
34
- React.createElement(Typography, { paragraph: true }, "Select a track from the select box below, the track will be shown when you hit \"Launch\"."),
29
+ React.createElement(Typography, null, "Select a track from the select box below, the track will be shown when you hit \"Launch\"."),
35
30
  filteredTracks.length ? (React.createElement(Select, { value: value, onChange: event => {
36
31
  setValue(event.target.value);
37
32
  } }, 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}` }))));
38
33
  });
39
- export default Selector;
34
+ export default ImportSyntenyTrackSelector;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { SnapshotIn } from 'mobx-state-tree';
3
+ import { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
+ import { LinearSyntenyViewModel } from '../../model';
5
+ type Conf = SnapshotIn<AnyConfigurationModel>;
6
+ export default function TrackSelector({ model, assembly1, assembly2, preConfiguredSyntenyTrack, setPreConfiguredSyntenyTrack, setUserOpenedSyntenyTrack, }: {
7
+ model: LinearSyntenyViewModel;
8
+ assembly1: string;
9
+ assembly2: string;
10
+ preConfiguredSyntenyTrack: string | undefined;
11
+ setUserOpenedSyntenyTrack: (arg: Conf) => void;
12
+ setPreConfiguredSyntenyTrack: (arg?: string) => void;
13
+ }): React.JSX.Element;
14
+ export {};
@@ -0,0 +1,23 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { FormControl, FormControlLabel, Radio, RadioGroup } from '@mui/material';
3
+ import ImportCustomTrack from './AddCustomTrack';
4
+ import ImportSyntenyTrackSelector from './TrackSelector';
5
+ export default function TrackSelector({ model, assembly1, assembly2, preConfiguredSyntenyTrack, setPreConfiguredSyntenyTrack, setUserOpenedSyntenyTrack, }) {
6
+ const [choice, setChoice] = useState('tracklist');
7
+ useEffect(() => {
8
+ if (choice === 'none') {
9
+ setPreConfiguredSyntenyTrack(undefined);
10
+ setUserOpenedSyntenyTrack(undefined);
11
+ }
12
+ }, [choice, setPreConfiguredSyntenyTrack, setUserOpenedSyntenyTrack]);
13
+ return (React.createElement("div", null,
14
+ React.createElement(FormControl, null,
15
+ React.createElement(RadioGroup, { row: true, value: choice, onChange: event => {
16
+ setChoice(event.target.value);
17
+ }, "aria-labelledby": "group-label" },
18
+ React.createElement(FormControlLabel, { value: "none", control: React.createElement(Radio, null), label: "None" }),
19
+ React.createElement(FormControlLabel, { value: "tracklist", control: React.createElement(Radio, null), label: "Existing track" }),
20
+ React.createElement(FormControlLabel, { value: "custom", control: React.createElement(Radio, null), label: "New track" }))),
21
+ choice === 'custom' ? (React.createElement(ImportCustomTrack, { setUserOpenedSyntenyTrack: setUserOpenedSyntenyTrack, assembly2: assembly2, assembly1: assembly1 })) : null,
22
+ choice === 'tracklist' ? (React.createElement(ImportSyntenyTrackSelector, { key: `${assembly1}-${assembly2}`, model: model, assembly1: assembly1, assembly2: assembly2, preConfiguredSyntenyTrack: preConfiguredSyntenyTrack, setPreConfiguredSyntenyTrack: setPreConfiguredSyntenyTrack })) : null));
23
+ }
@@ -2,8 +2,8 @@ import React, { lazy } from 'react';
2
2
  import { observer } from 'mobx-react';
3
3
  // locals
4
4
  import LinearComparativeViewComponent from '../../LinearComparativeView/components/LinearComparativeView';
5
- const ImportForm = lazy(() => import('./ImportForm'));
6
- const LinearSyntenyView = observer(({ model }) => {
7
- return !model.initialized ? (React.createElement(ImportForm, { model: model })) : (React.createElement(LinearComparativeViewComponent, { model: model }));
5
+ const LinearSyntenyImportForm = lazy(() => import('./ImportForm/LinearSyntenyImportForm'));
6
+ const LinearSyntenyView = observer(function ({ model }) {
7
+ return !model.initialized ? (React.createElement(LinearSyntenyImportForm, { model: model })) : (React.createElement(LinearComparativeViewComponent, { model: model }));
8
8
  });
9
9
  export default LinearSyntenyView;
@@ -1,6 +1,6 @@
1
1
  import { lazy } from 'react';
2
- import modelFactory from './model';
3
2
  import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType';
3
+ import modelFactory from './model';
4
4
  export default function LinearSyntenyViewF(pluginManager) {
5
5
  pluginManager.addViewType(() => {
6
6
  return new ViewType({