@jbrowse/plugin-linear-genome-view 2.7.2 → 2.9.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.
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +18 -11
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +25 -2
- package/dist/BaseLinearDisplay/models/renderSvg.d.ts +1 -1
- package/dist/BaseLinearDisplay/models/renderSvg.js +2 -1
- package/dist/BasicTrack/configSchema.d.ts +5 -0
- package/dist/FeatureTrack/configSchema.d.ts +5 -0
- package/dist/LaunchLinearGenomeView/index.js +16 -14
- package/dist/LinearBasicDisplay/model.d.ts +3 -1
- package/dist/LinearGenomeView/components/CenterLine.js +1 -1
- package/dist/LinearGenomeView/components/ImportForm.js +26 -74
- package/dist/LinearGenomeView/components/ImportFormRefNameAutocomplete.d.ts +12 -0
- package/dist/LinearGenomeView/components/ImportFormRefNameAutocomplete.js +29 -0
- package/dist/LinearGenomeView/components/OverviewScalebar.js +1 -1
- package/dist/LinearGenomeView/components/SearchBox.js +18 -54
- package/dist/LinearGenomeView/model.d.ts +12 -1
- package/dist/LinearGenomeView/model.js +16 -0
- package/dist/index.d.ts +702 -6
- package/dist/index.js +2 -2
- package/dist/searchUtils.d.ts +26 -0
- package/dist/searchUtils.js +90 -0
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +18 -11
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +1 -1
- package/esm/BaseLinearDisplay/models/renderSvg.d.ts +1 -1
- package/esm/BaseLinearDisplay/models/renderSvg.js +1 -1
- package/esm/BasicTrack/configSchema.d.ts +5 -0
- package/esm/FeatureTrack/configSchema.d.ts +5 -0
- package/esm/LaunchLinearGenomeView/index.js +16 -14
- package/esm/LinearBasicDisplay/model.d.ts +3 -1
- package/esm/LinearGenomeView/components/CenterLine.js +1 -1
- package/esm/LinearGenomeView/components/ImportForm.js +26 -74
- package/esm/LinearGenomeView/components/ImportFormRefNameAutocomplete.d.ts +12 -0
- package/esm/LinearGenomeView/components/ImportFormRefNameAutocomplete.js +24 -0
- package/esm/LinearGenomeView/components/OverviewScalebar.js +1 -1
- package/esm/LinearGenomeView/components/SearchBox.js +19 -55
- package/esm/LinearGenomeView/model.d.ts +12 -1
- package/esm/LinearGenomeView/model.js +16 -0
- package/esm/index.d.ts +702 -6
- package/esm/index.js +2 -2
- package/esm/searchUtils.d.ts +26 -0
- package/esm/searchUtils.js +79 -0
- package/package.json +2 -2
|
@@ -69,7 +69,11 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
69
69
|
setMessage(messageText: string): void;
|
|
70
70
|
setRendered(props: {
|
|
71
71
|
reactElement: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
72
|
-
features: Map<string, Feature>;
|
|
72
|
+
features: Map<string, Feature>; /**
|
|
73
|
+
* #getter
|
|
74
|
+
* a CompositeMap of `featureId -> feature obj` that
|
|
75
|
+
* just looks in all the block data for that feature
|
|
76
|
+
*/
|
|
73
77
|
layout: any;
|
|
74
78
|
maxHeightReached: boolean;
|
|
75
79
|
renderProps: any;
|
|
@@ -128,7 +132,9 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
128
132
|
message: string | undefined;
|
|
129
133
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
130
134
|
onHorizontalScroll?: Function | undefined;
|
|
131
|
-
blockState?: Record<string, any> | undefined;
|
|
135
|
+
blockState?: Record<string, any> | undefined; /**
|
|
136
|
+
* #property
|
|
137
|
+
*/
|
|
132
138
|
}>;
|
|
133
139
|
readonly DisplayBlurb: React.FC<{
|
|
134
140
|
model: {
|
|
@@ -136,7 +142,9 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
136
142
|
type: string;
|
|
137
143
|
rpcDriverName: string | undefined;
|
|
138
144
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
139
|
-
rendererTypeName: string;
|
|
145
|
+
rendererTypeName: string; /**
|
|
146
|
+
* #getter
|
|
147
|
+
*/
|
|
140
148
|
error: unknown;
|
|
141
149
|
message: string | undefined;
|
|
142
150
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
@@ -144,9 +152,7 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
144
152
|
type: import("mobx-state-tree").ISimpleType<string>;
|
|
145
153
|
rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
146
154
|
}, {
|
|
147
|
-
rendererTypeName: string;
|
|
148
|
-
* #getter
|
|
149
|
-
*/
|
|
155
|
+
rendererTypeName: string;
|
|
150
156
|
error: unknown;
|
|
151
157
|
message: string | undefined;
|
|
152
158
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
@@ -179,10 +185,7 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
179
185
|
} & {
|
|
180
186
|
readonly currentBytesRequested: number;
|
|
181
187
|
readonly currentFeatureScreenDensity: number;
|
|
182
|
-
readonly maxFeatureScreenDensity: any;
|
|
183
|
-
* #property
|
|
184
|
-
* updated via autorun
|
|
185
|
-
*/
|
|
188
|
+
readonly maxFeatureScreenDensity: any;
|
|
186
189
|
readonly featureDensityStatsReady: boolean;
|
|
187
190
|
readonly maxAllowableBytes: number;
|
|
188
191
|
} & {
|
|
@@ -358,7 +361,11 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
358
361
|
setMessage(messageText: string): void;
|
|
359
362
|
setRendered(props: {
|
|
360
363
|
reactElement: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
361
|
-
features: Map<string, Feature>;
|
|
364
|
+
features: Map<string, Feature>; /**
|
|
365
|
+
* #getter
|
|
366
|
+
* a CompositeMap of `featureId -> feature obj` that
|
|
367
|
+
* just looks in all the block data for that feature
|
|
368
|
+
*/
|
|
362
369
|
layout: any;
|
|
363
370
|
maxHeightReached: boolean;
|
|
364
371
|
renderProps: any;
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
@@ -16,7 +39,6 @@ const MenuOpen_1 = __importDefault(require("@mui/icons-material/MenuOpen"));
|
|
|
16
39
|
const BaseLinearDisplay_1 = require("../components/BaseLinearDisplay");
|
|
17
40
|
const serverSideRenderedBlock_1 = __importDefault(require("./serverSideRenderedBlock"));
|
|
18
41
|
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
19
|
-
const renderSvg_1 = __importDefault(require("./renderSvg"));
|
|
20
42
|
const TrackHeightMixin_1 = __importDefault(require("./TrackHeightMixin"));
|
|
21
43
|
const FeatureDensityMixin_1 = __importDefault(require("./FeatureDensityMixin"));
|
|
22
44
|
/**
|
|
@@ -296,7 +318,8 @@ function stateModelFactory() {
|
|
|
296
318
|
* #method
|
|
297
319
|
*/
|
|
298
320
|
async renderSvg(opts) {
|
|
299
|
-
|
|
321
|
+
const { renderBaseLinearDisplaySvg } = await Promise.resolve().then(() => __importStar(require('./renderSvg')));
|
|
322
|
+
return renderBaseLinearDisplaySvg(self, opts);
|
|
300
323
|
},
|
|
301
324
|
afterAttach() {
|
|
302
325
|
// watch the parent's blocks to update our block state when they change,
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { ThemeOptions } from '@mui/material';
|
|
3
3
|
import { ExportSvgOptions } from '../../LinearGenomeView';
|
|
4
4
|
import { BaseLinearDisplayModel } from './BaseLinearDisplayModel';
|
|
5
|
-
export
|
|
5
|
+
export declare function renderBaseLinearDisplaySvg(self: BaseLinearDisplayModel, opts: ExportSvgOptions & {
|
|
6
6
|
overrideHeight: number;
|
|
7
7
|
theme: ThemeOptions;
|
|
8
8
|
}): Promise<React.JSX.Element>;
|
|
@@ -26,6 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.renderBaseLinearDisplaySvg = void 0;
|
|
29
30
|
const react_1 = __importDefault(require("react"));
|
|
30
31
|
const util_1 = require("@jbrowse/core/util");
|
|
31
32
|
const serverSideRenderedBlock_1 = __importStar(require("./serverSideRenderedBlock"));
|
|
@@ -79,4 +80,4 @@ async function renderBaseLinearDisplaySvg(self, opts) {
|
|
|
79
80
|
react_1.default.createElement(util_1.ReactRendering, { rendering: rendering })))));
|
|
80
81
|
})));
|
|
81
82
|
}
|
|
82
|
-
exports.
|
|
83
|
+
exports.renderBaseLinearDisplaySvg = renderBaseLinearDisplaySvg;
|
|
@@ -58,6 +58,11 @@ declare const configSchema: (pluginManager: PluginManager) => import("@jbrowse/c
|
|
|
58
58
|
defaultValue: number;
|
|
59
59
|
description: string;
|
|
60
60
|
};
|
|
61
|
+
maxDepth: {
|
|
62
|
+
type: string;
|
|
63
|
+
defaultValue: number;
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
61
66
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
62
67
|
formatAbout: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
63
68
|
config: {
|
|
@@ -58,6 +58,11 @@ declare const configSchema: (pluginManager: PluginManager) => import("@jbrowse/c
|
|
|
58
58
|
defaultValue: number;
|
|
59
59
|
description: string;
|
|
60
60
|
};
|
|
61
|
+
maxDepth: {
|
|
62
|
+
type: string;
|
|
63
|
+
defaultValue: number;
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
61
66
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
62
67
|
formatAbout: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
63
68
|
config: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const util_1 = require("@jbrowse/core/util");
|
|
4
|
+
const searchUtils_1 = require("..//searchUtils");
|
|
4
5
|
exports.default = (pluginManager) => {
|
|
5
6
|
pluginManager.addToExtensionPoint('LaunchView-LinearGenomeView',
|
|
6
7
|
// @ts-expect-error
|
|
@@ -16,21 +17,9 @@ exports.default = (pluginManager) => {
|
|
|
16
17
|
if (!asm) {
|
|
17
18
|
throw new Error(`Assembly "${assembly}" not found when launching linear genome view`);
|
|
18
19
|
}
|
|
19
|
-
await
|
|
20
|
+
await (0, searchUtils_1.handleSelectedRegion)({ input: loc, model: view, assembly: asm });
|
|
20
21
|
const idsNotFound = [];
|
|
21
|
-
tracks.forEach(track =>
|
|
22
|
-
try {
|
|
23
|
-
view.showTrack(track);
|
|
24
|
-
}
|
|
25
|
-
catch (e) {
|
|
26
|
-
if (`${e}`.match('Could not resolve identifier')) {
|
|
27
|
-
idsNotFound.push(track);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
throw e;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
});
|
|
22
|
+
tracks.forEach(track => tryTrack(view, track, idsNotFound));
|
|
34
23
|
if (idsNotFound.length) {
|
|
35
24
|
throw new Error(`Could not resolve identifiers: ${idsNotFound.join(',')}`);
|
|
36
25
|
}
|
|
@@ -41,3 +30,16 @@ exports.default = (pluginManager) => {
|
|
|
41
30
|
}
|
|
42
31
|
});
|
|
43
32
|
};
|
|
33
|
+
function tryTrack(model, trackId, idsNotFound) {
|
|
34
|
+
try {
|
|
35
|
+
model.showTrack(trackId);
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
if (`${e}`.match('Could not resolve identifier')) {
|
|
39
|
+
idsNotFound.push(trackId);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
throw e;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -219,7 +219,9 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
219
219
|
featureIdUnderMouse: string | undefined;
|
|
220
220
|
contextMenuFeature: import("@jbrowse/core/util").Feature | undefined;
|
|
221
221
|
} & {
|
|
222
|
-
readonly blockType: "dynamicBlocks" | "staticBlocks";
|
|
222
|
+
readonly blockType: "dynamicBlocks" | "staticBlocks"; /**
|
|
223
|
+
* #getter
|
|
224
|
+
*/
|
|
223
225
|
readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
224
226
|
} & {
|
|
225
227
|
readonly renderDelay: number;
|
|
@@ -30,7 +30,7 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
|
30
30
|
centerLineContainer: {
|
|
31
31
|
background: 'transparent',
|
|
32
32
|
height: '100%',
|
|
33
|
-
zIndex: 5,
|
|
33
|
+
zIndex: 5, // above the track but under menu
|
|
34
34
|
position: 'absolute',
|
|
35
35
|
border: `1px ${theme.palette.action.active} dashed`,
|
|
36
36
|
borderTop: 'none',
|
|
@@ -34,9 +34,8 @@ const material_1 = require("@mui/material");
|
|
|
34
34
|
const ui_1 = require("@jbrowse/core/ui");
|
|
35
35
|
// icons
|
|
36
36
|
const Close_1 = __importDefault(require("@mui/icons-material/Close"));
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const util_2 = require("./util");
|
|
37
|
+
const searchUtils_1 = require("../../searchUtils");
|
|
38
|
+
const ImportFormRefNameAutocomplete_1 = __importDefault(require("./ImportFormRefNameAutocomplete"));
|
|
40
39
|
const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
41
40
|
importFormContainer: {
|
|
42
41
|
padding: theme.spacing(2),
|
|
@@ -52,11 +51,10 @@ const LinearGenomeViewImportForm = (0, mobx_react_1.observer)(function ({ model,
|
|
|
52
51
|
var _a;
|
|
53
52
|
const { classes } = useStyles();
|
|
54
53
|
const session = (0, util_1.getSession)(model);
|
|
55
|
-
const { assemblyNames, assemblyManager
|
|
56
|
-
const {
|
|
54
|
+
const { assemblyNames, assemblyManager } = session;
|
|
55
|
+
const { error } = model;
|
|
57
56
|
const [selectedAsm, setSelectedAsm] = (0, react_1.useState)(assemblyNames[0]);
|
|
58
57
|
const [option, setOption] = (0, react_1.useState)();
|
|
59
|
-
const searchScope = model.searchScope(selectedAsm);
|
|
60
58
|
const assembly = assemblyManager.get(selectedAsm);
|
|
61
59
|
const assemblyError = assemblyNames.length
|
|
62
60
|
? assembly === null || assembly === void 0 ? void 0 : assembly.error
|
|
@@ -74,74 +72,37 @@ const LinearGenomeViewImportForm = (0, mobx_react_1.observer)(function ({ model,
|
|
|
74
72
|
(0, react_1.useEffect)(() => {
|
|
75
73
|
setValue(r0);
|
|
76
74
|
}, [r0, selectedAsm]);
|
|
77
|
-
async function navToOption(option) {
|
|
78
|
-
const location = option.getLocation();
|
|
79
|
-
const trackId = option.getTrackId();
|
|
80
|
-
if (location) {
|
|
81
|
-
await model.navToLocString(location, selectedAsm);
|
|
82
|
-
if (trackId) {
|
|
83
|
-
model.showTrack(trackId);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
// gets a string as input, or use stored option results from previous query,
|
|
88
|
-
// then re-query and
|
|
89
|
-
// 1) if it has multiple results: pop a dialog
|
|
90
|
-
// 2) if it's a single result navigate to it
|
|
91
|
-
// 3) else assume it's a locstring and navigate to it
|
|
92
|
-
async function handleSelectedRegion(input) {
|
|
93
|
-
var _a;
|
|
94
|
-
try {
|
|
95
|
-
if ((option === null || option === void 0 ? void 0 : option.getDisplayString()) === input && option.hasLocation()) {
|
|
96
|
-
await navToOption(option);
|
|
97
|
-
}
|
|
98
|
-
else if ((_a = option === null || option === void 0 ? void 0 : option.results) === null || _a === void 0 ? void 0 : _a.length) {
|
|
99
|
-
model.setSearchResults(option.results, option.getLabel(), selectedAsm);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
const [ref, rest] = (0, util_2.splitLast)(input, ':');
|
|
103
|
-
const allRefs = (assembly === null || assembly === void 0 ? void 0 : assembly.allRefNamesWithLowerCase) || [];
|
|
104
|
-
if (allRefs.includes(input) ||
|
|
105
|
-
(allRefs.includes(ref) && !Number.isNaN(Number.parseInt(rest, 10)))) {
|
|
106
|
-
await model.navToLocString(input, selectedAsm);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
const results = await (0, util_2.fetchResults)({
|
|
110
|
-
queryString: input,
|
|
111
|
-
searchType: 'exact',
|
|
112
|
-
searchScope,
|
|
113
|
-
rankSearchResults,
|
|
114
|
-
textSearchManager,
|
|
115
|
-
assembly,
|
|
116
|
-
});
|
|
117
|
-
if (results.length > 1) {
|
|
118
|
-
model.setSearchResults(results, input.toLowerCase(), selectedAsm);
|
|
119
|
-
}
|
|
120
|
-
else if (results.length === 1) {
|
|
121
|
-
await navToOption(results[0]);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
await model.navToLocString(input, selectedAsm);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
catch (e) {
|
|
130
|
-
console.error(e);
|
|
131
|
-
session.notify(`${e}`, 'warning');
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
75
|
// implementation notes:
|
|
135
76
|
// having this wrapped in a form allows intuitive use of enter key to submit
|
|
136
77
|
return (react_1.default.createElement("div", { className: classes.container },
|
|
137
78
|
displayError ? react_1.default.createElement(ui_1.ErrorMessage, { error: displayError }) : null,
|
|
138
79
|
react_1.default.createElement(material_1.Container, { className: classes.importFormContainer },
|
|
139
80
|
react_1.default.createElement("form", { onSubmit: async (event) => {
|
|
81
|
+
var _a;
|
|
140
82
|
event.preventDefault();
|
|
141
83
|
model.setError(undefined);
|
|
142
84
|
if (value) {
|
|
143
85
|
// has it's own error handling
|
|
144
|
-
|
|
86
|
+
try {
|
|
87
|
+
if ((option === null || option === void 0 ? void 0 : option.getDisplayString()) === value &&
|
|
88
|
+
option.hasLocation()) {
|
|
89
|
+
await (0, searchUtils_1.navToOption)({
|
|
90
|
+
option,
|
|
91
|
+
model,
|
|
92
|
+
assemblyName: selectedAsm,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
else if ((_a = option === null || option === void 0 ? void 0 : option.results) === null || _a === void 0 ? void 0 : _a.length) {
|
|
96
|
+
model.setSearchResults(option.results, option.getLabel(), selectedAsm);
|
|
97
|
+
}
|
|
98
|
+
else if (assembly) {
|
|
99
|
+
await (0, searchUtils_1.handleSelectedRegion)({ input: value, assembly, model });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (e) {
|
|
103
|
+
console.error(e);
|
|
104
|
+
session.notify(`${e}`, 'warning');
|
|
105
|
+
}
|
|
145
106
|
}
|
|
146
107
|
} },
|
|
147
108
|
react_1.default.createElement(material_1.Grid, { container: true, spacing: 1, justifyContent: "center", alignItems: "center" },
|
|
@@ -149,16 +110,7 @@ const LinearGenomeViewImportForm = (0, mobx_react_1.observer)(function ({ model,
|
|
|
149
110
|
react_1.default.createElement(material_1.FormControl, null,
|
|
150
111
|
react_1.default.createElement(ui_1.AssemblySelector, { onChange: val => setSelectedAsm(val), localStorageKey: "lgv", session: session, selected: selectedAsm }))),
|
|
151
112
|
react_1.default.createElement(material_1.Grid, { item: true }, selectedAsm ? (assemblyError ? (react_1.default.createElement(Close_1.default, { style: { color: 'red' } })) : assemblyLoaded ? (react_1.default.createElement(material_1.FormControl, null,
|
|
152
|
-
react_1.default.createElement(
|
|
153
|
-
queryString,
|
|
154
|
-
assembly,
|
|
155
|
-
textSearchManager,
|
|
156
|
-
rankSearchResults,
|
|
157
|
-
searchScope,
|
|
158
|
-
}), model: model, assemblyName: selectedAsm, value: value, minWidth: 270, onChange: str => setValue(str), onSelect: val => setOption(val), TextFieldProps: {
|
|
159
|
-
variant: 'outlined',
|
|
160
|
-
helperText: 'Enter sequence name, feature name, or location',
|
|
161
|
-
} }))) : (react_1.default.createElement(material_1.CircularProgress, { size: 20, disableShrink: true }))) : null),
|
|
113
|
+
react_1.default.createElement(ImportFormRefNameAutocomplete_1.default, { value: value, setValue: setValue, selectedAsm: selectedAsm, setOption: setOption, model: model }))) : (react_1.default.createElement(material_1.CircularProgress, { size: 20, disableShrink: true }))) : null),
|
|
162
114
|
react_1.default.createElement(material_1.Grid, { item: true },
|
|
163
115
|
react_1.default.createElement(material_1.FormControl, null,
|
|
164
116
|
react_1.default.createElement(material_1.Button, { type: "submit", disabled: !value, className: classes.button, variant: "contained", color: "primary" }, "Open")),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
|
|
3
|
+
import { LinearGenomeViewModel } from '..';
|
|
4
|
+
type LGV = LinearGenomeViewModel;
|
|
5
|
+
declare const ImportFormRefNameAutocomplete: ({ model, selectedAsm, value, setValue, setOption, }: {
|
|
6
|
+
value: string;
|
|
7
|
+
setValue: (arg: string) => void;
|
|
8
|
+
model: LGV;
|
|
9
|
+
selectedAsm: string;
|
|
10
|
+
setOption: (arg: BaseResult) => void;
|
|
11
|
+
}) => React.JSX.Element;
|
|
12
|
+
export default ImportFormRefNameAutocomplete;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 react_1 = __importDefault(require("react"));
|
|
7
|
+
const mobx_react_1 = require("mobx-react");
|
|
8
|
+
const util_1 = require("@jbrowse/core/util");
|
|
9
|
+
// locals
|
|
10
|
+
const RefNameAutocomplete_1 = __importDefault(require("./RefNameAutocomplete"));
|
|
11
|
+
const util_2 = require("./util");
|
|
12
|
+
const ImportFormRefNameAutocomplete = (0, mobx_react_1.observer)(function ({ model, selectedAsm, value, setValue, setOption, }) {
|
|
13
|
+
const session = (0, util_1.getSession)(model);
|
|
14
|
+
const { assemblyManager, textSearchManager } = session;
|
|
15
|
+
const { rankSearchResults } = model;
|
|
16
|
+
const searchScope = model.searchScope(selectedAsm);
|
|
17
|
+
const assembly = assemblyManager.get(selectedAsm);
|
|
18
|
+
return (react_1.default.createElement(RefNameAutocomplete_1.default, { fetchResults: queryString => (0, util_2.fetchResults)({
|
|
19
|
+
queryString,
|
|
20
|
+
assembly,
|
|
21
|
+
textSearchManager,
|
|
22
|
+
rankSearchResults,
|
|
23
|
+
searchScope,
|
|
24
|
+
}), model: model, assemblyName: selectedAsm, value: value, minWidth: 270, onChange: str => setValue(str), onSelect: val => setOption(val), TextFieldProps: {
|
|
25
|
+
variant: 'outlined',
|
|
26
|
+
helperText: 'Enter sequence name, feature name, or location',
|
|
27
|
+
} }));
|
|
28
|
+
});
|
|
29
|
+
exports.default = ImportFormRefNameAutocomplete;
|
|
@@ -225,7 +225,7 @@ const OverviewScalebar = (0, mobx_react_1.observer)(function ({ model, children,
|
|
|
225
225
|
overview.showAllRegions();
|
|
226
226
|
return overview;
|
|
227
227
|
}, [
|
|
228
|
-
JSON.stringify(displayedRegions),
|
|
228
|
+
JSON.stringify(displayedRegions), // eslint-disable-line react-hooks/exhaustive-deps
|
|
229
229
|
model.minimumBlockWidth,
|
|
230
230
|
modWidth,
|
|
231
231
|
displayedRegions,
|
|
@@ -12,6 +12,7 @@ const util_1 = require("@jbrowse/core/util");
|
|
|
12
12
|
const RefNameAutocomplete_1 = __importDefault(require("./RefNameAutocomplete"));
|
|
13
13
|
const util_2 = require("./util");
|
|
14
14
|
const __1 = require("..");
|
|
15
|
+
const searchUtils_1 = require("../../searchUtils");
|
|
15
16
|
const useStyles = (0, mui_1.makeStyles)()(() => ({
|
|
16
17
|
headerRefName: {
|
|
17
18
|
minWidth: 100,
|
|
@@ -26,65 +27,28 @@ const SearchBox = (0, mobx_react_1.observer)(function ({ model, showHelp, }) {
|
|
|
26
27
|
const assemblyName = assemblyNames[0];
|
|
27
28
|
const assembly = assemblyManager.get(assemblyName);
|
|
28
29
|
const searchScope = model.searchScope(assemblyName);
|
|
29
|
-
async
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (trackId) {
|
|
35
|
-
model.showTrack(trackId);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// gets a string as input, or use stored option results from previous query,
|
|
40
|
-
// then re-query and
|
|
41
|
-
// 1) if it has multiple results: pop a dialog
|
|
42
|
-
// 2) if it's a single result navigate to it
|
|
43
|
-
// 3) else assume it's a locstring and navigate to it
|
|
44
|
-
async function handleSelectedRegion(option) {
|
|
45
|
-
var _a;
|
|
46
|
-
try {
|
|
47
|
-
if (option.hasLocation()) {
|
|
48
|
-
await navToOption(option);
|
|
49
|
-
}
|
|
50
|
-
else if ((_a = option.results) === null || _a === void 0 ? void 0 : _a.length) {
|
|
51
|
-
model.setSearchResults(option.results, option.getLabel());
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
const input = option.getLabel();
|
|
55
|
-
const [ref, rest] = (0, util_2.splitLast)(input, ':');
|
|
56
|
-
const allRefs = (assembly === null || assembly === void 0 ? void 0 : assembly.allRefNamesWithLowerCase) || [];
|
|
57
|
-
if (allRefs.includes(input) ||
|
|
58
|
-
(allRefs.includes(ref) && !Number.isNaN(Number.parseInt(rest, 10)))) {
|
|
59
|
-
await model.navToLocString(input, assemblyName);
|
|
30
|
+
return (react_1.default.createElement(RefNameAutocomplete_1.default, { showHelp: showHelp, onSelect: async (option) => {
|
|
31
|
+
var _a;
|
|
32
|
+
try {
|
|
33
|
+
if (option.hasLocation()) {
|
|
34
|
+
await (0, searchUtils_1.navToOption)({ option, model, assemblyName });
|
|
60
35
|
}
|
|
61
|
-
else {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
textSearchManager,
|
|
36
|
+
else if ((_a = option.results) === null || _a === void 0 ? void 0 : _a.length) {
|
|
37
|
+
model.setSearchResults(option.results, option.getLabel());
|
|
38
|
+
}
|
|
39
|
+
else if (assembly) {
|
|
40
|
+
await (0, searchUtils_1.handleSelectedRegion)({
|
|
41
|
+
input: option.getLabel(),
|
|
68
42
|
assembly,
|
|
43
|
+
model,
|
|
69
44
|
});
|
|
70
|
-
if (results.length > 1) {
|
|
71
|
-
model.setSearchResults(results, input.toLowerCase());
|
|
72
|
-
}
|
|
73
|
-
else if (results.length === 1) {
|
|
74
|
-
await navToOption(results[0]);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
await model.navToLocString(input, assemblyName);
|
|
78
|
-
}
|
|
79
45
|
}
|
|
80
46
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return (react_1.default.createElement(RefNameAutocomplete_1.default, { showHelp: showHelp, onSelect: handleSelectedRegion, assemblyName: assemblyName, fetchResults: queryString => (0, util_2.fetchResults)({
|
|
47
|
+
catch (e) {
|
|
48
|
+
console.error(e);
|
|
49
|
+
(0, util_1.getSession)(model).notify(`${e}`, 'warning');
|
|
50
|
+
}
|
|
51
|
+
}, assemblyName: assemblyName, fetchResults: queryString => (0, util_2.fetchResults)({
|
|
88
52
|
queryString,
|
|
89
53
|
searchScope,
|
|
90
54
|
rankSearchResults,
|
|
@@ -6,6 +6,7 @@ import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
|
|
|
6
6
|
import { BlockSet, BaseBlock } from '@jbrowse/core/util/blockTypes';
|
|
7
7
|
import { Instance } from 'mobx-state-tree';
|
|
8
8
|
import PluginManager from '@jbrowse/core/PluginManager';
|
|
9
|
+
import { Assembly } from '@jbrowse/core/assemblyManager/assembly';
|
|
9
10
|
export interface BpOffset {
|
|
10
11
|
refName?: string;
|
|
11
12
|
index: number;
|
|
@@ -292,7 +293,7 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
292
293
|
/**
|
|
293
294
|
* #action
|
|
294
295
|
*/
|
|
295
|
-
toggleTrack(trackId: string):
|
|
296
|
+
toggleTrack(trackId: string): boolean;
|
|
296
297
|
/**
|
|
297
298
|
* #action
|
|
298
299
|
*/
|
|
@@ -463,6 +464,16 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
463
464
|
* navigating to the locstring
|
|
464
465
|
*/
|
|
465
466
|
navToLocString(input: string, optAssemblyName?: string): Promise<void>;
|
|
467
|
+
/**
|
|
468
|
+
* #action
|
|
469
|
+
* Performs a text index search, and navigates to it immediately if a
|
|
470
|
+
* single result is returned. Will pop up a search dialog if multiple
|
|
471
|
+
* results are returned
|
|
472
|
+
*/
|
|
473
|
+
navToSearchString({ input, assembly, }: {
|
|
474
|
+
input: string;
|
|
475
|
+
assembly: Assembly;
|
|
476
|
+
}): Promise<void>;
|
|
466
477
|
/**
|
|
467
478
|
* #action
|
|
468
479
|
* Similar to `navToLocString`, but accepts parsed location objects
|
|
@@ -53,6 +53,7 @@ const MenuOpen_1 = __importDefault(require("@mui/icons-material/MenuOpen"));
|
|
|
53
53
|
const MiniControls_1 = __importDefault(require("./components/MiniControls"));
|
|
54
54
|
const Header_1 = __importDefault(require("./components/Header"));
|
|
55
55
|
const util_2 = require("./util");
|
|
56
|
+
const searchUtils_1 = require("../searchUtils");
|
|
56
57
|
// lazies
|
|
57
58
|
const ReturnToImportFormDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('@jbrowse/core/ui/ReturnToImportFormDialog'))));
|
|
58
59
|
const SequenceSearchDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SequenceSearchDialog'))));
|
|
@@ -624,7 +625,9 @@ function stateModelFactory(pluginManager) {
|
|
|
624
625
|
// if none had that configuration, turn one on
|
|
625
626
|
if (!hiddenCount) {
|
|
626
627
|
self.showTrack(trackId);
|
|
628
|
+
return true;
|
|
627
629
|
}
|
|
630
|
+
return false;
|
|
628
631
|
},
|
|
629
632
|
/**
|
|
630
633
|
* #action
|
|
@@ -1106,6 +1109,19 @@ function stateModelFactory(pluginManager) {
|
|
|
1106
1109
|
}
|
|
1107
1110
|
return this.navToLocations((0, util_2.parseLocStrings)(input, assemblyName, isValidRefName), assemblyName);
|
|
1108
1111
|
},
|
|
1112
|
+
/**
|
|
1113
|
+
* #action
|
|
1114
|
+
* Performs a text index search, and navigates to it immediately if a
|
|
1115
|
+
* single result is returned. Will pop up a search dialog if multiple
|
|
1116
|
+
* results are returned
|
|
1117
|
+
*/
|
|
1118
|
+
async navToSearchString({ input, assembly, }) {
|
|
1119
|
+
await (0, searchUtils_1.handleSelectedRegion)({
|
|
1120
|
+
input,
|
|
1121
|
+
assembly,
|
|
1122
|
+
model: self,
|
|
1123
|
+
});
|
|
1124
|
+
},
|
|
1109
1125
|
/**
|
|
1110
1126
|
* #action
|
|
1111
1127
|
* Similar to `navToLocString`, but accepts parsed location objects
|