@jbrowse/plugin-linear-comparative-view 3.1.0 → 3.3.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 (29) hide show
  1. package/dist/LinearComparativeView/components/Rubberband.js +5 -5
  2. package/dist/LinearComparativeView/components/VerticalGuide.js +3 -6
  3. package/dist/LinearComparativeView/model.d.ts +54 -4
  4. package/dist/LinearComparativeView/model.js +7 -2
  5. package/dist/LinearReadVsRef/LinearReadVsRef.js +2 -2
  6. package/dist/LinearSyntenyView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +2 -2
  7. package/dist/LinearSyntenyView/components/ImportForm/LeftPanel.d.ts +11 -0
  8. package/dist/LinearSyntenyView/components/ImportForm/LeftPanel.js +58 -0
  9. package/dist/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.js +18 -52
  10. package/dist/LinearSyntenyView/components/LinearSyntenyView.d.ts +2 -3
  11. package/dist/LinearSyntenyView/components/LinearSyntenyView.js +1 -1
  12. package/dist/LinearSyntenyView/model.d.ts +55 -5
  13. package/dist/LinearSyntenyView/model.js +3 -3
  14. package/dist/LinearSyntenyViewHelper/stateModelFactory.js +2 -2
  15. package/esm/LinearComparativeView/components/Rubberband.js +5 -5
  16. package/esm/LinearComparativeView/components/VerticalGuide.js +4 -7
  17. package/esm/LinearComparativeView/model.d.ts +54 -4
  18. package/esm/LinearComparativeView/model.js +7 -2
  19. package/esm/LinearReadVsRef/LinearReadVsRef.js +2 -2
  20. package/esm/LinearSyntenyView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +3 -3
  21. package/esm/LinearSyntenyView/components/ImportForm/LeftPanel.d.ts +11 -0
  22. package/esm/LinearSyntenyView/components/ImportForm/LeftPanel.js +53 -0
  23. package/esm/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.js +21 -55
  24. package/esm/LinearSyntenyView/components/LinearSyntenyView.d.ts +2 -3
  25. package/esm/LinearSyntenyView/components/LinearSyntenyView.js +1 -1
  26. package/esm/LinearSyntenyView/model.d.ts +55 -5
  27. package/esm/LinearSyntenyView/model.js +3 -3
  28. package/esm/LinearSyntenyViewHelper/stateModelFactory.js +2 -2
  29. package/package.json +7 -7
@@ -18,7 +18,7 @@ const useStyles = (0, mui_1.makeStyles)()(theme => {
18
18
  height: '100%',
19
19
  background: (0, material_1.alpha)(theme.palette.tertiary.main, 0.7),
20
20
  position: 'absolute',
21
- zIndex: 10,
21
+ zIndex: 900,
22
22
  textAlign: 'center',
23
23
  overflow: 'hidden',
24
24
  },
@@ -81,13 +81,13 @@ const LinearComparativeRubberband = (0, mobx_react_1.observer)(function Rubberba
81
81
  clientY,
82
82
  });
83
83
  (0, mobx_1.transaction)(() => {
84
- model.views.forEach(view => {
84
+ for (const view of model.views) {
85
85
  const args = computeOffsets(offsetX, view);
86
86
  if (args) {
87
87
  const { leftOffset, rightOffset } = args;
88
88
  view.setOffsets(leftOffset, rightOffset);
89
89
  }
90
- });
90
+ }
91
91
  });
92
92
  setGuideX(undefined);
93
93
  }
@@ -125,9 +125,9 @@ const LinearComparativeRubberband = (0, mobx_react_1.observer)(function Rubberba
125
125
  function mouseOut() {
126
126
  setGuideX(undefined);
127
127
  (0, mobx_1.transaction)(() => {
128
- model.views.forEach(view => {
128
+ for (const view of model.views) {
129
129
  view.setOffsets(undefined, undefined);
130
- });
130
+ }
131
131
  });
132
132
  }
133
133
  function handleClose() {
@@ -11,19 +11,16 @@ const useStyles = (0, mui_1.makeStyles)()({
11
11
  height: '100%',
12
12
  width: 1,
13
13
  position: 'absolute',
14
- zIndex: 10,
15
- },
16
- sm: {
17
- fontSize: 10,
14
+ background: 'red',
15
+ zIndex: 1001,
18
16
  },
19
17
  });
20
18
  const VerticalGuide = (0, mobx_react_1.observer)(function ({ model, coordX, }) {
21
19
  const { classes } = useStyles();
22
20
  return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { open: true, placement: "top", title: model.views
23
21
  .map(view => view.pxToBp(coordX))
24
- .map((elt, idx) => ((0, jsx_runtime_1.jsx)(material_1.Typography, { className: classes.sm, children: (0, util_1.stringify)(elt, true) }, [JSON.stringify(elt), idx].join('-')))), arrow: true, children: (0, jsx_runtime_1.jsx)("div", { className: classes.guide, style: {
22
+ .map((elt, idx) => ((0, jsx_runtime_1.jsx)("div", { children: (0, util_1.stringify)(elt, true) }, [JSON.stringify(elt), idx].join('-')))), arrow: true, children: (0, jsx_runtime_1.jsx)("div", { className: classes.guide, style: {
25
23
  left: coordX,
26
- background: 'red',
27
24
  } }) }));
28
25
  });
29
26
  exports.default = VerticalGuide;
@@ -49,6 +49,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
49
49
  highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType>>, [undefined]>;
50
50
  colorByCDS: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
51
51
  showTrackOutlines: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
52
+ init: import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState | undefined, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState | undefined, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState | undefined>;
52
53
  }, {
53
54
  width: number;
54
55
  } & {
@@ -77,6 +78,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
77
78
  readonly interRegionPaddingWidth: number;
78
79
  readonly assemblyNames: string[];
79
80
  readonly stickyViewHeaders: boolean;
81
+ readonly rubberbandTop: number;
80
82
  readonly pinnedTracksTop: number;
81
83
  } & {
82
84
  scaleBarDisplayPrefix(): string | undefined;
@@ -163,6 +165,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
163
165
  setDraggingTrackId(idx?: string): void;
164
166
  setScaleFactor(factor: number): void;
165
167
  clearView(): void;
168
+ setInit(arg?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState): void;
166
169
  exportSvg(opts?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").ExportSvgOptions): Promise<void>;
167
170
  } & {
168
171
  slide: (viewWidths: number) => void;
@@ -183,7 +186,6 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
183
186
  readonly coarseVisibleLocStrings: string;
184
187
  } & {
185
188
  setCoarseDynamicBlocks(blocks: import("@jbrowse/core/util/blockTypes").BlockSet): void;
186
- afterAttach(): void;
187
189
  } & {
188
190
  moveTo(start?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset, end?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset): void;
189
191
  navToLocString(input: string, optAssemblyName?: string): Promise<void>;
@@ -191,6 +193,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
191
193
  input: string;
192
194
  assembly: import("@jbrowse/core/assemblyManager/assembly").Assembly;
193
195
  }): Promise<void>;
196
+ navToLocation(parsedLocString: import("@jbrowse/core/util").ParsedLocString, assemblyName?: string): Promise<void>;
194
197
  navToLocations(parsedLocStrings: import("@jbrowse/core/util").ParsedLocString[], assemblyName?: string): Promise<void>;
195
198
  navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation): void;
196
199
  navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation[]): void;
@@ -229,6 +232,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
229
232
  } | undefined;
230
233
  } & {
231
234
  afterCreate(): void;
235
+ afterAttach(): void;
232
236
  }, import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
233
237
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
234
238
  displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
@@ -251,7 +255,28 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
251
255
  highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType>>, [undefined]>;
252
256
  colorByCDS: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
253
257
  showTrackOutlines: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
254
- }>>, import("mobx-state-tree")._NotCustomized>>;
258
+ init: import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState | undefined, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState | undefined, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState | undefined>;
259
+ }>>, {
260
+ id: string;
261
+ type: string;
262
+ displayName: string | undefined;
263
+ tracks: any[];
264
+ minimized: boolean;
265
+ displayedRegions: import("@jbrowse/core/util").Region[];
266
+ offsetPx: number;
267
+ bpPerPx: number;
268
+ hideHeader: boolean;
269
+ hideHeaderOverview: boolean;
270
+ hideNoTracksActive: boolean;
271
+ trackSelectorType: string;
272
+ showCenterLine: boolean;
273
+ showCytobandsSetting: boolean;
274
+ trackLabels: string;
275
+ showGridlines: boolean;
276
+ highlight: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType[];
277
+ colorByCDS: boolean;
278
+ showTrackOutlines: boolean;
279
+ }>>;
255
280
  viewTrackConfigs: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
256
281
  }, {
257
282
  width: number;
@@ -339,6 +364,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
339
364
  highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType>>, [undefined]>;
340
365
  colorByCDS: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
341
366
  showTrackOutlines: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
367
+ init: import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState | undefined, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState | undefined, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState | undefined>;
342
368
  }, {
343
369
  width: number;
344
370
  } & {
@@ -367,6 +393,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
367
393
  readonly interRegionPaddingWidth: number;
368
394
  readonly assemblyNames: string[];
369
395
  readonly stickyViewHeaders: boolean;
396
+ readonly rubberbandTop: number;
370
397
  readonly pinnedTracksTop: number;
371
398
  } & {
372
399
  scaleBarDisplayPrefix(): string | undefined;
@@ -453,6 +480,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
453
480
  setDraggingTrackId(idx?: string): void;
454
481
  setScaleFactor(factor: number): void;
455
482
  clearView(): void;
483
+ setInit(arg?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState): void;
456
484
  exportSvg(opts?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").ExportSvgOptions): Promise<void>;
457
485
  } & {
458
486
  slide: (viewWidths: number) => void;
@@ -473,7 +501,6 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
473
501
  readonly coarseVisibleLocStrings: string;
474
502
  } & {
475
503
  setCoarseDynamicBlocks(blocks: import("@jbrowse/core/util/blockTypes").BlockSet): void;
476
- afterAttach(): void;
477
504
  } & {
478
505
  moveTo(start?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset, end?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset): void;
479
506
  navToLocString(input: string, optAssemblyName?: string): Promise<void>;
@@ -481,6 +508,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
481
508
  input: string;
482
509
  assembly: import("@jbrowse/core/assemblyManager/assembly").Assembly;
483
510
  }): Promise<void>;
511
+ navToLocation(parsedLocString: import("@jbrowse/core/util").ParsedLocString, assemblyName?: string): Promise<void>;
484
512
  navToLocations(parsedLocStrings: import("@jbrowse/core/util").ParsedLocString[], assemblyName?: string): Promise<void>;
485
513
  navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation): void;
486
514
  navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation[]): void;
@@ -519,6 +547,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
519
547
  } | undefined;
520
548
  } & {
521
549
  afterCreate(): void;
550
+ afterAttach(): void;
522
551
  }, import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
523
552
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
524
553
  displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
@@ -541,7 +570,28 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
541
570
  highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType>>, [undefined]>;
542
571
  colorByCDS: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
543
572
  showTrackOutlines: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
544
- }>>, import("mobx-state-tree")._NotCustomized>>;
573
+ init: import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState | undefined, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState | undefined, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState | undefined>;
574
+ }>>, {
575
+ id: string;
576
+ type: string;
577
+ displayName: string | undefined;
578
+ tracks: any[];
579
+ minimized: boolean;
580
+ displayedRegions: import("@jbrowse/core/util").Region[];
581
+ offsetPx: number;
582
+ bpPerPx: number;
583
+ hideHeader: boolean;
584
+ hideHeaderOverview: boolean;
585
+ hideNoTracksActive: boolean;
586
+ trackSelectorType: string;
587
+ showCenterLine: boolean;
588
+ showCytobandsSetting: boolean;
589
+ trackLabels: string;
590
+ showGridlines: boolean;
591
+ highlight: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType[];
592
+ colorByCDS: boolean;
593
+ showTrackOutlines: boolean;
594
+ }>>;
545
595
  viewTrackConfigs: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
546
596
  }>>, import("mobx-state-tree")._NotCustomized>;
547
597
  export type LinearComparativeViewStateModel = ReturnType<typeof stateModelFactory>;
@@ -102,18 +102,23 @@ function stateModelFactory(pluginManager) {
102
102
  }
103
103
  },
104
104
  onSubviewAction(actionName, path, args) {
105
- self.views.forEach(view => {
105
+ for (const view of self.views) {
106
106
  const ret = (0, mobx_state_tree_1.getPath)(view);
107
107
  if (!ret.endsWith(path)) {
108
108
  view[actionName](args === null || args === void 0 ? void 0 : args[0]);
109
109
  }
110
- });
110
+ }
111
111
  },
112
112
  setWidth(newWidth) {
113
113
  self.width = newWidth;
114
114
  },
115
115
  setViews(views) {
116
116
  self.views = (0, mobx_state_tree_1.cast)(views);
117
+ const levels = [];
118
+ for (let i = 0; i < views.length - 1; i++) {
119
+ levels.push({ level: i });
120
+ }
121
+ self.levels = (0, mobx_state_tree_1.cast)(levels);
117
122
  },
118
123
  removeView(view) {
119
124
  self.views.remove(view);
@@ -101,12 +101,12 @@ function ReadVsRefDialog({ track, feature: preFeature, handleClose, }) {
101
101
  };
102
102
  const totalLength = flags & 2048 ? getLength(suppAlns[0].CIGAR) : getLength(cigar);
103
103
  const features = [feat, ...suppAlns];
104
- features.forEach((f, idx) => {
104
+ for (const [idx, f] of features.entries()) {
105
105
  f.refName = assembly.getCanonicalRefName(f.refName) || f.refName;
106
106
  f.syntenyId = idx;
107
107
  f.mate.syntenyId = idx;
108
108
  f.mate.uniqueId = `${f.uniqueId}_mate`;
109
- });
109
+ }
110
110
  features.sort((a, b) => a.clipPos - b.clipPos);
111
111
  const featSeq = feature.get('seq');
112
112
  const configFeatureStore = [...features, ...features.map(f => f.mate)];
@@ -73,7 +73,7 @@ const ImportSyntenyOpenCustomTrack = (0, mobx_react_1.observer)(function ({ mode
73
73
  };
74
74
  return ((0, jsx_runtime_1.jsxs)(material_1.Paper, { style: { padding: 12 }, children: [error ? (0, jsx_runtime_1.jsx)(ui_1.ErrorMessage, { error: error }) : null, (0, jsx_runtime_1.jsx)(material_1.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." }), (0, jsx_runtime_1.jsx)(material_1.RadioGroup, { value: radioOption, onChange: event => {
75
75
  setValue(event.target.value);
76
- }, children: (0, jsx_runtime_1.jsx)(material_1.Grid2, { container: true, justifyContent: "center", children: [
76
+ }, children: (0, jsx_runtime_1.jsx)(material_1.Grid, { container: true, justifyContent: "center", children: [
77
77
  '.paf',
78
78
  '.delta',
79
79
  '.out',
@@ -81,7 +81,7 @@ const ImportSyntenyOpenCustomTrack = (0, mobx_react_1.observer)(function ({ mode
81
81
  '.anchors',
82
82
  '.anchors.simple',
83
83
  '.pif.gz',
84
- ].map(extension => ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: extension, control: (0, jsx_runtime_1.jsx)(material_1.Radio, {}), label: extension }, extension))) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid2, { container: true, justifyContent: "center", children: radioOption === '.paf' ||
84
+ ].map(extension => ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: extension, control: (0, jsx_runtime_1.jsx)(material_1.Radio, {}), label: extension }, extension))) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { container: true, justifyContent: "center", children: radioOption === '.paf' ||
85
85
  radioOption === '.out' ||
86
86
  radioOption === '.delta' ||
87
87
  radioOption === '.chain' ||
@@ -0,0 +1,11 @@
1
+ import type { LinearSyntenyViewModel } from '../../model';
2
+ declare const LeftPanel: ({ model, selectedAssemblyNames, setSelectedAssemblyNames, selectedRow, setSelectedRow, defaultAssemblyName, onLaunch, }: {
3
+ model: LinearSyntenyViewModel;
4
+ selectedAssemblyNames: string[];
5
+ setSelectedAssemblyNames: (names: string[]) => void;
6
+ selectedRow: number;
7
+ setSelectedRow: (row: number) => void;
8
+ defaultAssemblyName: string;
9
+ onLaunch: () => void;
10
+ }) => import("react/jsx-runtime").JSX.Element;
11
+ export default LeftPanel;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const ui_1 = require("@jbrowse/core/ui");
8
+ const util_1 = require("@jbrowse/core/util");
9
+ const ArrowForwardIos_1 = __importDefault(require("@mui/icons-material/ArrowForwardIos"));
10
+ const Close_1 = __importDefault(require("@mui/icons-material/Close"));
11
+ const material_1 = require("@mui/material");
12
+ const mobx_react_1 = require("mobx-react");
13
+ const mui_1 = require("tss-react/mui");
14
+ const useStyles = (0, mui_1.makeStyles)()(theme => ({
15
+ mb: {
16
+ marginBottom: 10,
17
+ },
18
+ button: {
19
+ margin: theme.spacing(2),
20
+ },
21
+ rel: {
22
+ position: 'relative',
23
+ },
24
+ synbutton: {
25
+ position: 'absolute',
26
+ top: 30,
27
+ },
28
+ bg: {
29
+ background: theme.palette.divider,
30
+ },
31
+ }));
32
+ const AssemblyRows = (0, mobx_react_1.observer)(function ({ selectedRow, selectedAssemblyNames, setSelectedRow, setSelectedAssemblyNames, model, }) {
33
+ const { classes, cx } = useStyles();
34
+ const session = (0, util_1.getSession)(model);
35
+ return selectedAssemblyNames.map((assemblyName, idx) => ((0, jsx_runtime_1.jsxs)("div", { className: classes.rel, children: [(0, jsx_runtime_1.jsxs)("span", { children: ["Row ", idx + 1, ": "] }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { disabled: selectedAssemblyNames.length <= 2, onClick: () => {
36
+ model.importFormRemoveRow(idx);
37
+ setSelectedAssemblyNames(selectedAssemblyNames
38
+ .map((asm, idx2) => (idx2 === idx ? undefined : asm))
39
+ .filter(util_1.notEmpty));
40
+ if (selectedRow >= selectedAssemblyNames.length - 2) {
41
+ setSelectedRow(0);
42
+ }
43
+ }, children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }), (0, jsx_runtime_1.jsx)(ui_1.AssemblySelector, { helperText: "", selected: assemblyName, onChange: newAssembly => {
44
+ setSelectedAssemblyNames(selectedAssemblyNames.map((asm, idx2) => idx2 === idx ? newAssembly : asm));
45
+ }, session: session }), idx !== selectedAssemblyNames.length - 1 ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, { "data-testid": "synbutton", className: cx(classes.synbutton, idx === selectedRow ? classes.bg : undefined), onClick: () => {
46
+ setSelectedRow(idx);
47
+ }, children: (0, jsx_runtime_1.jsx)(ArrowForwardIos_1.default, {}) })) : null] }, `${assemblyName}-${idx}`)));
48
+ });
49
+ const LeftPanel = (0, mobx_react_1.observer)(function ({ model, selectedAssemblyNames, setSelectedAssemblyNames, selectedRow, setSelectedRow, defaultAssemblyName, onLaunch, }) {
50
+ const { classes } = useStyles();
51
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: classes.mb, children: "Select assemblies for linear synteny view" }), (0, jsx_runtime_1.jsx)(AssemblyRows, { model: model, selectedAssemblyNames: selectedAssemblyNames, setSelectedAssemblyNames: setSelectedAssemblyNames, selectedRow: selectedRow, setSelectedRow: setSelectedRow }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { className: classes.button, variant: "contained", color: "secondary", onClick: () => {
52
+ setSelectedAssemblyNames([
53
+ ...selectedAssemblyNames,
54
+ defaultAssemblyName,
55
+ ]);
56
+ }, children: "Add row" }), (0, jsx_runtime_1.jsx)(material_1.Button, { className: classes.button, onClick: onLaunch, variant: "contained", color: "primary", children: "Launch" })] })] }));
57
+ });
58
+ exports.default = LeftPanel;
@@ -7,37 +7,20 @@ const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const react_1 = require("react");
8
8
  const ui_1 = require("@jbrowse/core/ui");
9
9
  const util_1 = require("@jbrowse/core/util");
10
- const ArrowForwardIos_1 = __importDefault(require("@mui/icons-material/ArrowForwardIos"));
11
- const Close_1 = __importDefault(require("@mui/icons-material/Close"));
12
10
  const material_1 = require("@mui/material");
13
11
  const mobx_react_1 = require("mobx-react");
14
12
  const mui_1 = require("tss-react/mui");
15
13
  const ImportSyntenyTrackSelectorArea_1 = __importDefault(require("./ImportSyntenyTrackSelectorArea"));
14
+ const LeftPanel_1 = __importDefault(require("./LeftPanel"));
16
15
  const doSubmit_1 = require("./doSubmit");
17
16
  const useStyles = (0, mui_1.makeStyles)()(theme => ({
18
17
  importFormContainer: {
19
18
  padding: theme.spacing(4),
20
19
  },
21
- button: {
22
- margin: theme.spacing(2),
23
- },
24
- rel: {
25
- position: 'relative',
26
- },
27
- synbutton: {
28
- position: 'absolute',
29
- top: 30,
30
- },
31
20
  flex: {
32
21
  display: 'flex',
33
22
  gap: 90,
34
23
  },
35
- mb: {
36
- marginBottom: 10,
37
- },
38
- bg: {
39
- background: theme.palette.divider,
40
- },
41
24
  rightPanel: {
42
25
  flexGrow: 11,
43
26
  },
@@ -47,7 +30,7 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
47
30
  },
48
31
  }));
49
32
  const LinearSyntenyViewImportForm = (0, mobx_react_1.observer)(function ({ model, }) {
50
- const { classes, cx } = useStyles();
33
+ const { classes } = useStyles();
51
34
  const session = (0, util_1.getSession)(model);
52
35
  const { assemblyNames } = session;
53
36
  const defaultAssemblyName = assemblyNames[0] || '';
@@ -57,38 +40,21 @@ const LinearSyntenyViewImportForm = (0, mobx_react_1.observer)(function ({ model
57
40
  defaultAssemblyName,
58
41
  ]);
59
42
  const [error, setError] = (0, react_1.useState)();
60
- return ((0, jsx_runtime_1.jsxs)(material_1.Container, { className: classes.importFormContainer, children: [error ? (0, jsx_runtime_1.jsx)(ui_1.ErrorMessage, { error: error }) : null, (0, jsx_runtime_1.jsxs)("div", { className: classes.flex, children: [(0, jsx_runtime_1.jsxs)("div", { className: classes.leftPanel, children: [(0, jsx_runtime_1.jsx)("div", { className: classes.mb, children: "Select assemblies for linear synteny view" }), selectedAssemblyNames.map((assemblyName, idx) => ((0, jsx_runtime_1.jsxs)("div", { className: classes.rel, children: [(0, jsx_runtime_1.jsxs)("span", { children: ["Row ", idx + 1, ": "] }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { disabled: selectedAssemblyNames.length <= 2, onClick: () => {
61
- model.importFormRemoveRow(idx);
62
- setSelectedAssemblyNames(selectedAssemblyNames
63
- .map((asm, idx2) => (idx2 === idx ? undefined : asm))
64
- .filter(util_1.notEmpty));
65
- if (selectedRow >= selectedAssemblyNames.length - 2) {
66
- setSelectedRow(0);
67
- }
68
- }, children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }), (0, jsx_runtime_1.jsx)(ui_1.AssemblySelector, { helperText: "", selected: assemblyName, onChange: newAssembly => {
69
- setSelectedAssemblyNames(selectedAssemblyNames.map((asm, idx2) => idx2 === idx ? newAssembly : asm));
70
- }, session: session }), idx !== selectedAssemblyNames.length - 1 ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, { "data-testid": "synbutton", className: cx(classes.synbutton, idx === selectedRow ? classes.bg : undefined), onClick: () => {
71
- setSelectedRow(idx);
72
- }, children: (0, jsx_runtime_1.jsx)(ArrowForwardIos_1.default, {}) })) : null] }, `${assemblyName}-${idx}`))), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { className: classes.button, variant: "contained", color: "secondary", onClick: () => {
73
- setSelectedAssemblyNames([
74
- ...selectedAssemblyNames,
75
- defaultAssemblyName,
76
- ]);
77
- }, children: "Add row" }), (0, jsx_runtime_1.jsx)(material_1.Button, { className: classes.button, onClick: () => {
78
- ;
79
- (async () => {
80
- try {
81
- setError(undefined);
82
- await (0, doSubmit_1.doSubmit)({
83
- selectedAssemblyNames,
84
- model,
85
- });
86
- }
87
- catch (e) {
88
- console.error(e);
89
- setError(e);
90
- }
91
- })();
92
- }, variant: "contained", color: "primary", children: "Launch" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: classes.rightPanel, children: [(0, jsx_runtime_1.jsxs)("div", { children: ["Synteny dataset to display between row ", selectedRow + 1, " and", ' ', selectedRow + 2] }), (0, jsx_runtime_1.jsx)(ImportSyntenyTrackSelectorArea_1.default, { model: model, selectedRow: selectedRow, assembly1: selectedAssemblyNames[selectedRow], assembly2: selectedAssemblyNames[selectedRow + 1] })] })] })] }));
43
+ const handleLaunch = async () => {
44
+ try {
45
+ setError(undefined);
46
+ await (0, doSubmit_1.doSubmit)({
47
+ selectedAssemblyNames,
48
+ model,
49
+ });
50
+ }
51
+ catch (e) {
52
+ console.error(e);
53
+ setError(e);
54
+ }
55
+ };
56
+ return ((0, jsx_runtime_1.jsxs)(material_1.Container, { className: classes.importFormContainer, children: [error ? (0, jsx_runtime_1.jsx)(ui_1.ErrorMessage, { error: error }) : null, (0, jsx_runtime_1.jsxs)("div", { className: classes.flex, children: [(0, jsx_runtime_1.jsx)("div", { className: classes.leftPanel, children: (0, jsx_runtime_1.jsx)(LeftPanel_1.default, { model: model, selectedAssemblyNames: selectedAssemblyNames, setSelectedAssemblyNames: setSelectedAssemblyNames, selectedRow: selectedRow, setSelectedRow: setSelectedRow, defaultAssemblyName: defaultAssemblyName, onLaunch: () => {
57
+ handleLaunch();
58
+ } }) }), (0, jsx_runtime_1.jsxs)("div", { className: classes.rightPanel, children: [(0, jsx_runtime_1.jsxs)("div", { children: ["Synteny dataset to display between row ", selectedRow + 1, " and", ' ', selectedRow + 2] }), (0, jsx_runtime_1.jsx)(ImportSyntenyTrackSelectorArea_1.default, { model: model, selectedRow: selectedRow, assembly1: selectedAssemblyNames[selectedRow], assembly2: selectedAssemblyNames[selectedRow + 1] })] })] })] }));
93
59
  });
94
60
  exports.default = LinearSyntenyViewImportForm;
@@ -1,6 +1,5 @@
1
1
  import type { LinearSyntenyViewModel } from '../model';
2
- type LSV = LinearSyntenyViewModel;
3
- declare const LinearSyntenyView: ({ model }: {
4
- model: LSV;
2
+ declare const LinearSyntenyView: ({ model, }: {
3
+ model: LinearSyntenyViewModel;
5
4
  }) => import("react/jsx-runtime").JSX.Element;
6
5
  export default LinearSyntenyView;
@@ -41,7 +41,7 @@ const react_1 = require("react");
41
41
  const mobx_react_1 = require("mobx-react");
42
42
  const LinearComparativeView_1 = __importDefault(require("../../LinearComparativeView/components/LinearComparativeView"));
43
43
  const LinearSyntenyImportForm = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./ImportForm/LinearSyntenyImportForm'))));
44
- const LinearSyntenyView = (0, mobx_react_1.observer)(function ({ model }) {
44
+ const LinearSyntenyView = (0, mobx_react_1.observer)(function ({ model, }) {
45
45
  return !model.initialized ? ((0, jsx_runtime_1.jsx)(LinearSyntenyImportForm, { model: model })) : ((0, jsx_runtime_1.jsx)(LinearComparativeView_1.default, { model: model }));
46
46
  });
47
47
  exports.default = LinearSyntenyView;