@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.
- package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +2 -1
- package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +4 -2
- package/dist/LGVSyntenyDisplay/components/util.d.ts +4 -1
- package/dist/LGVSyntenyDisplay/components/util.js +7 -15
- package/dist/LGVSyntenyDisplay/model.d.ts +26 -14
- package/dist/LGVSyntenyDisplay/model.js +23 -1
- package/dist/LaunchLinearSyntenyView.js +41 -11
- package/dist/LinearComparativeDisplay/stateModelFactory.d.ts +42 -14
- package/dist/LinearComparativeDisplay/stateModelFactory.js +20 -10
- package/dist/LinearComparativeView/components/Header.d.ts +2 -3
- package/dist/LinearComparativeView/components/Header.js +72 -62
- package/dist/LinearComparativeView/components/HeaderSearchBoxes.d.ts +6 -0
- package/dist/LinearComparativeView/components/HeaderSearchBoxes.js +34 -0
- package/dist/LinearComparativeView/components/LinearComparativeRenderArea.d.ts +6 -0
- package/dist/LinearComparativeView/components/LinearComparativeRenderArea.js +61 -0
- package/dist/LinearComparativeView/components/LinearComparativeView.d.ts +2 -4
- package/dist/LinearComparativeView/components/LinearComparativeView.js +3 -67
- package/dist/LinearComparativeView/components/Rubberband.js +1 -1
- package/dist/LinearComparativeView/index.js +3 -0
- package/dist/LinearComparativeView/model.d.ts +265 -12
- package/dist/LinearComparativeView/model.js +45 -75
- package/dist/LinearSyntenyDisplay/afterAttach.js +5 -4
- package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +47 -32
- package/dist/LinearSyntenyDisplay/components/SyntenyContextMenu.js +10 -6
- package/dist/LinearSyntenyDisplay/components/util.d.ts +7 -2
- package/dist/LinearSyntenyDisplay/components/util.js +12 -14
- package/dist/LinearSyntenyDisplay/drawSynteny.d.ts +1 -1
- package/dist/LinearSyntenyDisplay/drawSynteny.js +29 -25
- package/dist/LinearSyntenyDisplay/index.js +1 -1
- package/dist/LinearSyntenyDisplay/model.d.ts +48 -10
- package/dist/LinearSyntenyDisplay/model.js +38 -15
- package/dist/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.d.ts → AddCustomTrack.d.ts} +2 -3
- package/dist/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.js → AddCustomTrack.js} +3 -3
- package/dist/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.js +195 -0
- package/dist/LinearSyntenyView/components/ImportForm/Spacer.d.ts +2 -0
- package/dist/LinearSyntenyView/components/ImportForm/Spacer.js +10 -0
- package/dist/LinearSyntenyView/components/ImportForm/TrackSelector.d.ts +10 -0
- package/dist/LinearSyntenyView/components/ImportForm/{ImportSyntenyTrackSelector.js → TrackSelector.js} +15 -20
- package/dist/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.d.ts +14 -0
- package/dist/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.js +52 -0
- package/dist/LinearSyntenyView/components/LinearSyntenyView.js +3 -3
- package/dist/LinearSyntenyView/index.js +1 -1
- package/dist/LinearSyntenyView/model.d.ts +267 -9
- package/dist/LinearSyntenyView/model.js +2 -2
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.d.ts +12 -0
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.js +19 -0
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +1 -3
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +36 -27
- package/dist/LinearSyntenyViewHelper/index.d.ts +2 -0
- package/dist/LinearSyntenyViewHelper/index.js +25 -0
- package/dist/LinearSyntenyViewHelper/stateModelFactory.d.ts +30 -0
- package/dist/LinearSyntenyViewHelper/stateModelFactory.js +105 -0
- package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +14 -0
- package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +100 -0
- package/dist/SyntenyFeatureDetail/index.d.ts +2 -0
- package/dist/SyntenyFeatureDetail/index.js +56 -0
- package/dist/index.js +4 -0
- package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +2 -1
- package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +4 -2
- package/esm/LGVSyntenyDisplay/components/util.d.ts +4 -1
- package/esm/LGVSyntenyDisplay/components/util.js +8 -16
- package/esm/LGVSyntenyDisplay/model.d.ts +26 -14
- package/esm/LGVSyntenyDisplay/model.js +25 -3
- package/esm/LaunchLinearSyntenyView.js +41 -11
- package/esm/LinearComparativeDisplay/stateModelFactory.d.ts +42 -14
- package/esm/LinearComparativeDisplay/stateModelFactory.js +21 -11
- package/esm/LinearComparativeView/components/Header.d.ts +2 -3
- package/esm/LinearComparativeView/components/Header.js +73 -63
- package/esm/LinearComparativeView/components/HeaderSearchBoxes.d.ts +6 -0
- package/esm/LinearComparativeView/components/HeaderSearchBoxes.js +29 -0
- package/esm/LinearComparativeView/components/LinearComparativeRenderArea.d.ts +6 -0
- package/esm/LinearComparativeView/components/LinearComparativeRenderArea.js +56 -0
- package/esm/LinearComparativeView/components/LinearComparativeView.d.ts +2 -4
- package/esm/LinearComparativeView/components/LinearComparativeView.js +3 -67
- package/esm/LinearComparativeView/components/Rubberband.js +1 -1
- package/esm/LinearComparativeView/index.js +3 -0
- package/esm/LinearComparativeView/model.d.ts +265 -12
- package/esm/LinearComparativeView/model.js +47 -77
- package/esm/LinearSyntenyDisplay/afterAttach.js +5 -4
- package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +48 -33
- package/esm/LinearSyntenyDisplay/components/SyntenyContextMenu.js +10 -6
- package/esm/LinearSyntenyDisplay/components/util.d.ts +7 -2
- package/esm/LinearSyntenyDisplay/components/util.js +12 -14
- package/esm/LinearSyntenyDisplay/drawSynteny.d.ts +1 -1
- package/esm/LinearSyntenyDisplay/drawSynteny.js +29 -25
- package/esm/LinearSyntenyDisplay/index.js +1 -1
- package/esm/LinearSyntenyDisplay/model.d.ts +48 -10
- package/esm/LinearSyntenyDisplay/model.js +38 -15
- package/esm/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.d.ts → AddCustomTrack.d.ts} +2 -3
- package/esm/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.js → AddCustomTrack.js} +3 -3
- package/esm/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.js +167 -0
- package/esm/LinearSyntenyView/components/ImportForm/Spacer.d.ts +2 -0
- package/esm/LinearSyntenyView/components/ImportForm/Spacer.js +4 -0
- package/esm/LinearSyntenyView/components/ImportForm/TrackSelector.d.ts +10 -0
- package/esm/LinearSyntenyView/components/ImportForm/{ImportSyntenyTrackSelector.js → TrackSelector.js} +15 -20
- package/esm/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.d.ts +14 -0
- package/esm/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.js +23 -0
- package/esm/LinearSyntenyView/components/LinearSyntenyView.js +3 -3
- package/esm/LinearSyntenyView/index.js +1 -1
- package/esm/LinearSyntenyView/model.d.ts +267 -9
- package/esm/LinearSyntenyView/model.js +2 -2
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.d.ts +12 -0
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.js +13 -0
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +1 -3
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +38 -29
- package/esm/LinearSyntenyViewHelper/index.d.ts +2 -0
- package/esm/LinearSyntenyViewHelper/index.js +19 -0
- package/esm/LinearSyntenyViewHelper/stateModelFactory.d.ts +30 -0
- package/esm/LinearSyntenyViewHelper/stateModelFactory.js +102 -0
- package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +14 -0
- package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +72 -0
- package/esm/SyntenyFeatureDetail/index.d.ts +2 -0
- package/esm/SyntenyFeatureDetail/index.js +27 -0
- package/esm/index.js +4 -0
- package/package.json +3 -3
- package/dist/LinearSyntenyView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +0 -9
- package/dist/LinearSyntenyView/components/ImportForm/index.js +0 -138
- package/esm/LinearSyntenyView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +0 -9
- package/esm/LinearSyntenyView/components/ImportForm/index.js +0 -110
- /package/dist/LinearSyntenyView/components/ImportForm/{index.d.ts → LinearSyntenyImportForm.d.ts} +0 -0
- /package/esm/LinearSyntenyView/components/ImportForm/{index.d.ts → LinearSyntenyImportForm.d.ts} +0 -0
package/esm/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.d.ts → AddCustomTrack.d.ts}
RENAMED
|
@@ -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,
|
|
6
|
-
sessionTrackData: Conf;
|
|
5
|
+
declare const ImportCustomTrack: ({ assembly1, assembly2, setUserOpenedSyntenyTrack, }: {
|
|
7
6
|
assembly1: string;
|
|
8
7
|
assembly2: string;
|
|
9
|
-
|
|
8
|
+
setUserOpenedSyntenyTrack: (arg: Conf) => void;
|
|
10
9
|
}) => React.JSX.Element;
|
|
11
10
|
export default ImportCustomTrack;
|
package/esm/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.js → AddCustomTrack.js}
RENAMED
|
@@ -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,
|
|
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
|
-
|
|
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
|
-
|
|
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,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
|
|
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(
|
|
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
|
-
//
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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,
|
|
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
|
|
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
|
|
6
|
-
const LinearSyntenyView = observer(({ model })
|
|
7
|
-
return !model.initialized ? (React.createElement(
|
|
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({
|