@jbrowse/plugin-linear-genome-view 1.7.10 → 1.7.11
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 +1 -1
- package/dist/LinearBareDisplay/model.d.ts +1 -1
- package/dist/LinearBasicDisplay/model.d.ts +1 -2
- package/dist/LinearBasicDisplay/model.js +2 -2
- package/dist/LinearGenomeView/components/Header.d.ts +0 -1
- package/dist/LinearGenomeView/components/Header.js +2 -3
- package/dist/LinearGenomeView/components/ImportForm.d.ts +0 -1
- package/dist/LinearGenomeView/components/ImportForm.js +40 -70
- package/dist/LinearGenomeView/components/OverviewScaleBar.d.ts +21 -5
- package/dist/LinearGenomeView/components/OverviewScaleBar.js +23 -16
- package/dist/LinearGenomeView/components/SearchBox.js +36 -72
- package/dist/LinearGenomeView/components/SearchResultsDialog.d.ts +1 -1
- package/dist/LinearGenomeView/components/SearchResultsDialog.js +0 -1
- package/dist/LinearGenomeView/components/util.d.ts +12 -0
- package/dist/LinearGenomeView/components/util.js +59 -0
- package/dist/index.d.ts +3 -3
- package/package.json +2 -2
- package/src/LinearBasicDisplay/model.ts +2 -4
- package/src/LinearGenomeView/components/Header.tsx +3 -3
- package/src/LinearGenomeView/components/ImportForm.tsx +18 -25
- package/src/LinearGenomeView/components/OverviewScaleBar.tsx +39 -30
- package/src/LinearGenomeView/components/SearchBox.tsx +18 -29
- package/src/LinearGenomeView/components/SearchResultsDialog.tsx +0 -1
- package/src/LinearGenomeView/components/util.ts +43 -0
|
@@ -130,7 +130,7 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
|
|
|
130
130
|
estimatedRegionStatsP: Promise<Stats> | undefined;
|
|
131
131
|
estimatedRegionStats: Stats | undefined;
|
|
132
132
|
} & {
|
|
133
|
-
readonly blockType: "
|
|
133
|
+
readonly blockType: "dynamicBlocks" | "staticBlocks";
|
|
134
134
|
readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
135
135
|
} & {
|
|
136
136
|
/**
|
|
@@ -118,7 +118,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
118
118
|
estimatedRegionStatsP: Promise<import("@jbrowse/core/data_adapters/BaseAdapter").Stats> | undefined;
|
|
119
119
|
estimatedRegionStats: import("@jbrowse/core/data_adapters/BaseAdapter").Stats | undefined;
|
|
120
120
|
} & {
|
|
121
|
-
readonly blockType: "
|
|
121
|
+
readonly blockType: "dynamicBlocks" | "staticBlocks";
|
|
122
122
|
readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
123
123
|
} & {
|
|
124
124
|
readonly renderDelay: number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
|
|
3
2
|
import { MenuItem } from '@jbrowse/core/ui';
|
|
4
3
|
import { Instance } from 'mobx-state-tree';
|
|
@@ -124,7 +123,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
|
|
|
124
123
|
estimatedRegionStatsP: Promise<import("@jbrowse/core/data_adapters/BaseAdapter").Stats> | undefined;
|
|
125
124
|
estimatedRegionStats: import("@jbrowse/core/data_adapters/BaseAdapter").Stats | undefined;
|
|
126
125
|
} & {
|
|
127
|
-
readonly blockType: "
|
|
126
|
+
readonly blockType: "dynamicBlocks" | "staticBlocks";
|
|
128
127
|
readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
129
128
|
} & {
|
|
130
129
|
readonly renderDelay: number;
|
|
@@ -62,7 +62,7 @@ var stateModelFactory = function stateModelFactory(configSchema) {
|
|
|
62
62
|
get showDescriptions() {
|
|
63
63
|
var _self$trackShowDescri;
|
|
64
64
|
|
|
65
|
-
return (_self$trackShowDescri = self.trackShowDescriptions) !== null && _self$trackShowDescri !== void 0 ? _self$trackShowDescri : (0, _configuration.getConf)(self, ['renderer', '
|
|
65
|
+
return (_self$trackShowDescri = self.trackShowDescriptions) !== null && _self$trackShowDescri !== void 0 ? _self$trackShowDescri : (0, _configuration.getConf)(self, ['renderer', 'showDescriptions']);
|
|
66
66
|
},
|
|
67
67
|
|
|
68
68
|
get maxHeight() {
|
|
@@ -129,7 +129,7 @@ var stateModelFactory = function stateModelFactory(configSchema) {
|
|
|
129
129
|
type: 'checkbox',
|
|
130
130
|
checked: self.showDescriptions,
|
|
131
131
|
onClick: function onClick() {
|
|
132
|
-
self.toggleShowDescriptions();
|
|
132
|
+
return self.toggleShowDescriptions();
|
|
133
133
|
}
|
|
134
134
|
}, {
|
|
135
135
|
label: 'Display mode',
|
|
@@ -99,13 +99,12 @@ function PanControls(_ref2) {
|
|
|
99
99
|
var RegionWidth = (0, _mobxReact.observer)(function (_ref3) {
|
|
100
100
|
var model = _ref3.model;
|
|
101
101
|
var classes = useStyles();
|
|
102
|
-
var coarseTotalBp = model.coarseTotalBp
|
|
103
|
-
bpPerPx = model.bpPerPx;
|
|
102
|
+
var coarseTotalBp = model.coarseTotalBp;
|
|
104
103
|
return /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
105
104
|
variant: "body2",
|
|
106
105
|
color: "textSecondary",
|
|
107
106
|
className: classes.bp
|
|
108
|
-
}, (0, _util.
|
|
107
|
+
}, (0, _util.getBpDisplayStr)(coarseTotalBp));
|
|
109
108
|
});
|
|
110
109
|
|
|
111
110
|
var Controls = function Controls(_ref4) {
|
|
@@ -11,8 +11,6 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
11
11
|
|
|
12
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
13
|
|
|
14
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
-
|
|
16
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
15
|
|
|
18
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -35,6 +33,8 @@ var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
|
|
|
35
33
|
|
|
36
34
|
var _RefNameAutocomplete = _interopRequireDefault(require("./RefNameAutocomplete"));
|
|
37
35
|
|
|
36
|
+
var _util2 = require("./util");
|
|
37
|
+
|
|
38
38
|
var _ = require("..");
|
|
39
39
|
|
|
40
40
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -98,106 +98,68 @@ var ImportForm = (0, _mobxReact.observer)(function (_ref) {
|
|
|
98
98
|
|
|
99
99
|
var option = new _BaseResults.default({
|
|
100
100
|
label: value
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
function fetchResults(_x, _x2) {
|
|
104
|
-
return _fetchResults.apply(this, arguments);
|
|
105
|
-
} // gets a string as input, or use stored option results from previous query,
|
|
101
|
+
}); // gets a string as input, or use stored option results from previous query,
|
|
106
102
|
// then re-query and
|
|
107
103
|
// 1) if it has multiple results: pop a dialog
|
|
108
104
|
// 2) if it's a single result navigate to it
|
|
109
105
|
// 3) else assume it's a locstring and navigate to it
|
|
110
106
|
|
|
111
|
-
|
|
112
|
-
function _fetchResults() {
|
|
113
|
-
_fetchResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(query, searchType) {
|
|
114
|
-
var _assembly$allRefNames;
|
|
115
|
-
|
|
116
|
-
var textSearchResults, refNameResults;
|
|
117
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
118
|
-
while (1) {
|
|
119
|
-
switch (_context.prev = _context.next) {
|
|
120
|
-
case 0:
|
|
121
|
-
if (!textSearchManager) {
|
|
122
|
-
console.warn('No text search manager');
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
_context.next = 3;
|
|
126
|
-
return textSearchManager === null || textSearchManager === void 0 ? void 0 : textSearchManager.search({
|
|
127
|
-
queryString: query,
|
|
128
|
-
searchType: searchType
|
|
129
|
-
}, searchScope, rankSearchResults);
|
|
130
|
-
|
|
131
|
-
case 3:
|
|
132
|
-
textSearchResults = _context.sent;
|
|
133
|
-
refNameResults = assembly === null || assembly === void 0 ? void 0 : (_assembly$allRefNames = assembly.allRefNames) === null || _assembly$allRefNames === void 0 ? void 0 : _assembly$allRefNames.filter(function (refName) {
|
|
134
|
-
return refName.startsWith(query);
|
|
135
|
-
}).map(function (r) {
|
|
136
|
-
return new _BaseResults.default({
|
|
137
|
-
label: r
|
|
138
|
-
});
|
|
139
|
-
}).slice(0, 10);
|
|
140
|
-
return _context.abrupt("return", [].concat((0, _toConsumableArray2.default)(refNameResults || []), (0, _toConsumableArray2.default)(textSearchResults || [])));
|
|
141
|
-
|
|
142
|
-
case 6:
|
|
143
|
-
case "end":
|
|
144
|
-
return _context.stop();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}, _callee);
|
|
148
|
-
}));
|
|
149
|
-
return _fetchResults.apply(this, arguments);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function handleSelectedRegion(_x3) {
|
|
107
|
+
function handleSelectedRegion(_x) {
|
|
153
108
|
return _handleSelectedRegion.apply(this, arguments);
|
|
154
109
|
}
|
|
155
110
|
|
|
156
111
|
function _handleSelectedRegion() {
|
|
157
|
-
_handleSelectedRegion = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
112
|
+
_handleSelectedRegion = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(input) {
|
|
158
113
|
var trackId, location, _location$split, _location$split2, ref, rest, allRefs, results;
|
|
159
114
|
|
|
160
|
-
return _regenerator.default.wrap(function
|
|
115
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
161
116
|
while (1) {
|
|
162
|
-
switch (
|
|
117
|
+
switch (_context.prev = _context.next) {
|
|
163
118
|
case 0:
|
|
164
119
|
if (option) {
|
|
165
|
-
|
|
120
|
+
_context.next = 2;
|
|
166
121
|
break;
|
|
167
122
|
}
|
|
168
123
|
|
|
169
|
-
return
|
|
124
|
+
return _context.abrupt("return");
|
|
170
125
|
|
|
171
126
|
case 2:
|
|
172
127
|
trackId = option.getTrackId();
|
|
173
128
|
location = input || option.getLocation() || '';
|
|
174
129
|
_location$split = location.split(':'), _location$split2 = (0, _slicedToArray2.default)(_location$split, 2), ref = _location$split2[0], rest = _location$split2[1];
|
|
175
130
|
allRefs = (assembly === null || assembly === void 0 ? void 0 : assembly.allRefNames) || [];
|
|
176
|
-
|
|
131
|
+
_context.prev = 6;
|
|
177
132
|
|
|
178
133
|
if (!(allRefs.includes(location) || allRefs.includes(ref) && rest !== undefined && !Number.isNaN(parseInt(rest, 10)))) {
|
|
179
|
-
|
|
134
|
+
_context.next = 11;
|
|
180
135
|
break;
|
|
181
136
|
}
|
|
182
137
|
|
|
183
138
|
model.navToLocString(location, selectedAsm);
|
|
184
|
-
|
|
139
|
+
_context.next = 22;
|
|
185
140
|
break;
|
|
186
141
|
|
|
187
142
|
case 11:
|
|
188
|
-
|
|
189
|
-
return
|
|
143
|
+
_context.next = 13;
|
|
144
|
+
return (0, _util2.fetchResults)({
|
|
145
|
+
queryString: input,
|
|
146
|
+
searchType: 'exact',
|
|
147
|
+
searchScope: searchScope,
|
|
148
|
+
rankSearchResults: rankSearchResults,
|
|
149
|
+
textSearchManager: textSearchManager,
|
|
150
|
+
assembly: assembly
|
|
151
|
+
});
|
|
190
152
|
|
|
191
153
|
case 13:
|
|
192
|
-
results =
|
|
154
|
+
results = _context.sent;
|
|
193
155
|
|
|
194
156
|
if (!(results.length > 1)) {
|
|
195
|
-
|
|
157
|
+
_context.next = 19;
|
|
196
158
|
break;
|
|
197
159
|
}
|
|
198
160
|
|
|
199
161
|
model.setSearchResults(results, input.toLowerCase());
|
|
200
|
-
return
|
|
162
|
+
return _context.abrupt("return");
|
|
201
163
|
|
|
202
164
|
case 19:
|
|
203
165
|
if (results.length === 1) {
|
|
@@ -213,21 +175,21 @@ var ImportForm = (0, _mobxReact.observer)(function (_ref) {
|
|
|
213
175
|
}
|
|
214
176
|
|
|
215
177
|
case 22:
|
|
216
|
-
|
|
178
|
+
_context.next = 28;
|
|
217
179
|
break;
|
|
218
180
|
|
|
219
181
|
case 24:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
console.error(
|
|
223
|
-
session.notify("".concat(
|
|
182
|
+
_context.prev = 24;
|
|
183
|
+
_context.t0 = _context["catch"](6);
|
|
184
|
+
console.error(_context.t0);
|
|
185
|
+
session.notify("".concat(_context.t0), 'warning');
|
|
224
186
|
|
|
225
187
|
case 28:
|
|
226
188
|
case "end":
|
|
227
|
-
return
|
|
189
|
+
return _context.stop();
|
|
228
190
|
}
|
|
229
191
|
}
|
|
230
|
-
},
|
|
192
|
+
}, _callee, null, [[6, 24]]);
|
|
231
193
|
}));
|
|
232
194
|
return _handleSelectedRegion.apply(this, arguments);
|
|
233
195
|
}
|
|
@@ -276,7 +238,15 @@ var ImportForm = (0, _mobxReact.observer)(function (_ref) {
|
|
|
276
238
|
color: 'red'
|
|
277
239
|
}
|
|
278
240
|
}) : value ? /*#__PURE__*/_react.default.createElement(_RefNameAutocomplete.default, {
|
|
279
|
-
fetchResults: fetchResults
|
|
241
|
+
fetchResults: function fetchResults(queryString) {
|
|
242
|
+
return (0, _util2.fetchResults)({
|
|
243
|
+
queryString: queryString,
|
|
244
|
+
assembly: assembly,
|
|
245
|
+
textSearchManager: textSearchManager,
|
|
246
|
+
rankSearchResults: rankSearchResults,
|
|
247
|
+
searchScope: searchScope
|
|
248
|
+
});
|
|
249
|
+
},
|
|
280
250
|
model: model,
|
|
281
251
|
assemblyName: assemblyError ? undefined : selectedAsm,
|
|
282
252
|
value: value // note: minWidth 270 accomodates full width of helperText
|
|
@@ -18,7 +18,10 @@ declare const Cytobands: ({ overview, block, assembly, }: {
|
|
|
18
18
|
error: Error | undefined;
|
|
19
19
|
regions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
|
|
20
20
|
refNameAliases: {
|
|
21
|
-
[
|
|
21
|
+
[x: string]: string;
|
|
22
|
+
} | undefined;
|
|
23
|
+
lowerCaseRefNameAliases: {
|
|
24
|
+
[x: string]: string;
|
|
22
25
|
} | undefined;
|
|
23
26
|
cytobands: import("@jbrowse/core/util").Feature[] | undefined;
|
|
24
27
|
} & {
|
|
@@ -37,17 +40,22 @@ declare const Cytobands: ({ overview, block, assembly, }: {
|
|
|
37
40
|
isValidRefName(refName: string): boolean;
|
|
38
41
|
} & {
|
|
39
42
|
setLoading(): void;
|
|
40
|
-
setLoaded({ adapterRegionsWithAssembly, refNameAliases, cytobands, }: {
|
|
43
|
+
setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: {
|
|
41
44
|
adapterRegionsWithAssembly: import("@jbrowse/core/util").Region[];
|
|
42
45
|
refNameAliases: {
|
|
43
46
|
[x: string]: string;
|
|
44
47
|
};
|
|
48
|
+
lowerCaseRefNameAliases: {
|
|
49
|
+
[x: string]: string;
|
|
50
|
+
};
|
|
45
51
|
cytobands: import("@jbrowse/core/util").Feature[];
|
|
46
52
|
}): void;
|
|
47
53
|
setError(e: Error): void;
|
|
48
54
|
setRegions(regions: import("@jbrowse/core/util").Region[]): void;
|
|
49
55
|
setRefNameAliases(refNameAliases: {
|
|
50
56
|
[x: string]: string;
|
|
57
|
+
}, lowerCaseRefNameAliases: {
|
|
58
|
+
[x: string]: string;
|
|
51
59
|
}): void;
|
|
52
60
|
setCytobands(cytobands: import("@jbrowse/core/util").Feature[]): void;
|
|
53
61
|
afterAttach(): void;
|
|
@@ -72,7 +80,10 @@ declare const Cytobands: ({ overview, block, assembly, }: {
|
|
|
72
80
|
error: Error | undefined;
|
|
73
81
|
regions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
|
|
74
82
|
refNameAliases: {
|
|
75
|
-
[
|
|
83
|
+
[x: string]: string;
|
|
84
|
+
} | undefined;
|
|
85
|
+
lowerCaseRefNameAliases: {
|
|
86
|
+
[x: string]: string;
|
|
76
87
|
} | undefined;
|
|
77
88
|
cytobands: import("@jbrowse/core/util").Feature[] | undefined;
|
|
78
89
|
} & {
|
|
@@ -91,17 +102,22 @@ declare const Cytobands: ({ overview, block, assembly, }: {
|
|
|
91
102
|
isValidRefName(refName: string): boolean;
|
|
92
103
|
} & {
|
|
93
104
|
setLoading(): void;
|
|
94
|
-
setLoaded({ adapterRegionsWithAssembly, refNameAliases, cytobands, }: {
|
|
105
|
+
setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: {
|
|
95
106
|
adapterRegionsWithAssembly: import("@jbrowse/core/util").Region[];
|
|
96
107
|
refNameAliases: {
|
|
97
108
|
[x: string]: string;
|
|
98
109
|
};
|
|
110
|
+
lowerCaseRefNameAliases: {
|
|
111
|
+
[x: string]: string;
|
|
112
|
+
};
|
|
99
113
|
cytobands: import("@jbrowse/core/util").Feature[];
|
|
100
114
|
}): void;
|
|
101
115
|
setError(e: Error): void;
|
|
102
116
|
setRegions(regions: import("@jbrowse/core/util").Region[]): void;
|
|
103
117
|
setRefNameAliases(refNameAliases: {
|
|
104
118
|
[x: string]: string;
|
|
119
|
+
}, lowerCaseRefNameAliases: {
|
|
120
|
+
[x: string]: string;
|
|
105
121
|
}): void;
|
|
106
122
|
setCytobands(cytobands: import("@jbrowse/core/util").Feature[]): void;
|
|
107
123
|
afterAttach(): void;
|
|
@@ -122,7 +138,7 @@ declare const Cytobands: ({ overview, block, assembly, }: {
|
|
|
122
138
|
}>;
|
|
123
139
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) | undefined;
|
|
124
140
|
block: ContentBlock;
|
|
125
|
-
}) => JSX.Element
|
|
141
|
+
}) => JSX.Element;
|
|
126
142
|
declare function OverviewScaleBar({ model, children, }: {
|
|
127
143
|
model: LGV;
|
|
128
144
|
children: React.ReactNode;
|
|
@@ -150,15 +150,11 @@ var colorMap = {
|
|
|
150
150
|
stalk: 'rgb(127,127,127)',
|
|
151
151
|
acen: '#800'
|
|
152
152
|
};
|
|
153
|
-
|
|
153
|
+
|
|
154
|
+
function getCytobands(assembly, refName) {
|
|
154
155
|
var _assembly$cytobands;
|
|
155
156
|
|
|
156
|
-
|
|
157
|
-
block = _ref2.block,
|
|
158
|
-
assembly = _ref2.assembly;
|
|
159
|
-
var offsetPx = block.offsetPx,
|
|
160
|
-
reversed = block.reversed;
|
|
161
|
-
var cytobands = assembly === null || assembly === void 0 ? void 0 : (_assembly$cytobands = assembly.cytobands) === null || _assembly$cytobands === void 0 ? void 0 : _assembly$cytobands.map(function (f) {
|
|
157
|
+
return (assembly === null || assembly === void 0 ? void 0 : (_assembly$cytobands = assembly.cytobands) === null || _assembly$cytobands === void 0 ? void 0 : _assembly$cytobands.map(function (f) {
|
|
162
158
|
return {
|
|
163
159
|
refName: assembly.getCanonicalRefName(f.get('refName')),
|
|
164
160
|
start: f.get('start'),
|
|
@@ -166,8 +162,18 @@ var Cytobands = (0, _mobxReact.observer)(function (_ref2) {
|
|
|
166
162
|
type: f.get('type')
|
|
167
163
|
};
|
|
168
164
|
}).filter(function (f) {
|
|
169
|
-
return f.refName ===
|
|
170
|
-
})
|
|
165
|
+
return f.refName === refName;
|
|
166
|
+
})) || [];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
var Cytobands = (0, _mobxReact.observer)(function (_ref2) {
|
|
170
|
+
var overview = _ref2.overview,
|
|
171
|
+
block = _ref2.block,
|
|
172
|
+
assembly = _ref2.assembly;
|
|
173
|
+
var offsetPx = block.offsetPx,
|
|
174
|
+
reversed = block.reversed;
|
|
175
|
+
var cytobands = getCytobands(assembly, block.refName);
|
|
176
|
+
var coords = cytobands.map(function (f) {
|
|
171
177
|
var refName = f.refName,
|
|
172
178
|
start = f.start,
|
|
173
179
|
end = f.end,
|
|
@@ -184,9 +190,9 @@ var Cytobands = (0, _mobxReact.observer)(function (_ref2) {
|
|
|
184
190
|
var lcap = reversed ? arr.length - 1 : 0;
|
|
185
191
|
var rcap = reversed ? 0 : arr.length - 1;
|
|
186
192
|
var firstCent = true;
|
|
187
|
-
return
|
|
193
|
+
return /*#__PURE__*/_react.default.createElement("g", {
|
|
188
194
|
transform: "translate(-".concat(offsetPx, ")")
|
|
189
|
-
},
|
|
195
|
+
}, coords.map(function (_ref3, index) {
|
|
190
196
|
var _ref4 = (0, _slicedToArray2.default)(_ref3, 3),
|
|
191
197
|
start = _ref4[0],
|
|
192
198
|
end = _ref4[1],
|
|
@@ -233,7 +239,7 @@ var Cytobands = (0, _mobxReact.observer)(function (_ref2) {
|
|
|
233
239
|
fill: colorMap[type]
|
|
234
240
|
});
|
|
235
241
|
}
|
|
236
|
-
}))
|
|
242
|
+
}));
|
|
237
243
|
});
|
|
238
244
|
exports.Cytobands = Cytobands;
|
|
239
245
|
var OverviewBox = (0, _mobxReact.observer)(function (_ref5) {
|
|
@@ -266,20 +272,21 @@ var OverviewBox = (0, _mobxReact.observer)(function (_ref5) {
|
|
|
266
272
|
tickLabels.push(reversed ? end - offsetLabel : start + offsetLabel);
|
|
267
273
|
}
|
|
268
274
|
|
|
275
|
+
var canDisplayCytobands = showCytobands && getCytobands(assembly, block.refName).length;
|
|
269
276
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
270
277
|
style: {
|
|
271
278
|
left: block.offsetPx + 3,
|
|
272
|
-
color:
|
|
279
|
+
color: canDisplayCytobands ? 'black' : refNameColor
|
|
273
280
|
},
|
|
274
281
|
className: classes.scaleBarRefName
|
|
275
282
|
}, refName), /*#__PURE__*/_react.default.createElement("div", {
|
|
276
|
-
className: (0, _clsx.default)(classes.scaleBarContig,
|
|
283
|
+
className: (0, _clsx.default)(classes.scaleBarContig, canDisplayCytobands ? undefined : reversed ? classes.scaleBarContigReverse : classes.scaleBarContigForward, !canDisplayCytobands ? classes.scaleBarBorder : undefined),
|
|
277
284
|
style: {
|
|
278
285
|
left: block.offsetPx + cytobandOffset,
|
|
279
286
|
width: block.widthPx,
|
|
280
287
|
borderColor: refNameColor
|
|
281
288
|
}
|
|
282
|
-
}, !
|
|
289
|
+
}, !canDisplayCytobands ? tickLabels.map(function (tickLabel, labelIdx) {
|
|
283
290
|
return /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
284
291
|
key: "".concat(JSON.stringify(block), "-").concat(tickLabel, "-").concat(labelIdx),
|
|
285
292
|
className: classes.scaleBarLabel,
|
|
@@ -290,7 +297,7 @@ var OverviewBox = (0, _mobxReact.observer)(function (_ref5) {
|
|
|
290
297
|
color: refNameColor
|
|
291
298
|
}
|
|
292
299
|
}, (0, _util.getTickDisplayStr)(tickLabel, bpPerPx));
|
|
293
|
-
}) : null,
|
|
300
|
+
}) : null, canDisplayCytobands ? /*#__PURE__*/_react.default.createElement("svg", {
|
|
294
301
|
style: {
|
|
295
302
|
width: '100%'
|
|
296
303
|
}
|
|
@@ -11,8 +11,6 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
11
11
|
|
|
12
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
13
|
|
|
14
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
-
|
|
16
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
15
|
|
|
18
16
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -21,8 +19,6 @@ var _mobxReact = require("mobx-react");
|
|
|
21
19
|
|
|
22
20
|
var _core = require("@material-ui/core");
|
|
23
21
|
|
|
24
|
-
var _BaseResults = _interopRequireDefault(require("@jbrowse/core/TextSearch/BaseResults"));
|
|
25
|
-
|
|
26
22
|
var _util = require("@jbrowse/core/util");
|
|
27
23
|
|
|
28
24
|
var _RefNameAutocomplete = _interopRequireDefault(require("./RefNameAutocomplete"));
|
|
@@ -52,101 +48,61 @@ function SearchBox(_ref) {
|
|
|
52
48
|
rankSearchResults = model.rankSearchResults;
|
|
53
49
|
var assemblyName = assemblyNames[0];
|
|
54
50
|
var assembly = assemblyManager.get(assemblyName);
|
|
55
|
-
var searchScope = model.searchScope(assemblyName);
|
|
56
|
-
|
|
57
|
-
function fetchResults(_x, _x2) {
|
|
58
|
-
return _fetchResults.apply(this, arguments);
|
|
59
|
-
} // gets a string as input, or use stored option results from previous query,
|
|
51
|
+
var searchScope = model.searchScope(assemblyName); // gets a string as input, or use stored option results from previous query,
|
|
60
52
|
// then re-query and
|
|
61
53
|
// 1) if it has multiple results: pop a dialog
|
|
62
54
|
// 2) if it's a single result navigate to it
|
|
63
55
|
// 3) else assume it's a locstring and navigate to it
|
|
64
56
|
|
|
65
|
-
|
|
66
|
-
function _fetchResults() {
|
|
67
|
-
_fetchResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(query, searchType) {
|
|
68
|
-
var _assembly$allRefNames;
|
|
69
|
-
|
|
70
|
-
var textSearchResults, refNameResults;
|
|
71
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
72
|
-
while (1) {
|
|
73
|
-
switch (_context.prev = _context.next) {
|
|
74
|
-
case 0:
|
|
75
|
-
if (!textSearchManager) {
|
|
76
|
-
console.warn('No text search manager');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
_context.next = 3;
|
|
80
|
-
return textSearchManager === null || textSearchManager === void 0 ? void 0 : textSearchManager.search({
|
|
81
|
-
queryString: query,
|
|
82
|
-
searchType: searchType
|
|
83
|
-
}, searchScope, rankSearchResults);
|
|
84
|
-
|
|
85
|
-
case 3:
|
|
86
|
-
textSearchResults = _context.sent;
|
|
87
|
-
refNameResults = assembly === null || assembly === void 0 ? void 0 : (_assembly$allRefNames = assembly.allRefNames) === null || _assembly$allRefNames === void 0 ? void 0 : _assembly$allRefNames.filter(function (refName) {
|
|
88
|
-
return refName.startsWith(query);
|
|
89
|
-
}).map(function (r) {
|
|
90
|
-
return new _BaseResults.default({
|
|
91
|
-
label: r
|
|
92
|
-
});
|
|
93
|
-
}).slice(0, 10);
|
|
94
|
-
return _context.abrupt("return", (0, _util2.dedupe)([].concat((0, _toConsumableArray2.default)(refNameResults || []), (0, _toConsumableArray2.default)(textSearchResults || [])), function (elt) {
|
|
95
|
-
return elt.getId();
|
|
96
|
-
}));
|
|
97
|
-
|
|
98
|
-
case 6:
|
|
99
|
-
case "end":
|
|
100
|
-
return _context.stop();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}, _callee);
|
|
104
|
-
}));
|
|
105
|
-
return _fetchResults.apply(this, arguments);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function handleSelectedRegion(_x3) {
|
|
57
|
+
function handleSelectedRegion(_x) {
|
|
109
58
|
return _handleSelectedRegion.apply(this, arguments);
|
|
110
59
|
}
|
|
111
60
|
|
|
112
61
|
function _handleSelectedRegion() {
|
|
113
|
-
_handleSelectedRegion = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
62
|
+
_handleSelectedRegion = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(option) {
|
|
114
63
|
var trackId, location, label, _location$split, _location$split2, ref, rest, allRefs, results;
|
|
115
64
|
|
|
116
|
-
return _regenerator.default.wrap(function
|
|
65
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
117
66
|
while (1) {
|
|
118
|
-
switch (
|
|
67
|
+
switch (_context.prev = _context.next) {
|
|
119
68
|
case 0:
|
|
120
69
|
trackId = option.getTrackId();
|
|
121
70
|
location = option.getLocation();
|
|
122
71
|
label = option.getLabel();
|
|
123
72
|
_location$split = location.split(':'), _location$split2 = (0, _slicedToArray2.default)(_location$split, 2), ref = _location$split2[0], rest = _location$split2[1];
|
|
124
73
|
allRefs = (assembly === null || assembly === void 0 ? void 0 : assembly.allRefNames) || [];
|
|
125
|
-
|
|
74
|
+
_context.prev = 5;
|
|
126
75
|
|
|
127
76
|
if (!(allRefs.includes(location) || allRefs.includes(ref) && rest !== undefined && !Number.isNaN(parseInt(rest, 10)))) {
|
|
128
|
-
|
|
77
|
+
_context.next = 10;
|
|
129
78
|
break;
|
|
130
79
|
}
|
|
131
80
|
|
|
132
81
|
model.navToLocString(location, assemblyName);
|
|
133
|
-
|
|
82
|
+
_context.next = 21;
|
|
134
83
|
break;
|
|
135
84
|
|
|
136
85
|
case 10:
|
|
137
|
-
|
|
138
|
-
return
|
|
86
|
+
_context.next = 12;
|
|
87
|
+
return (0, _util2.fetchResults)({
|
|
88
|
+
queryString: label,
|
|
89
|
+
searchType: 'exact',
|
|
90
|
+
searchScope: searchScope,
|
|
91
|
+
rankSearchResults: rankSearchResults,
|
|
92
|
+
textSearchManager: textSearchManager,
|
|
93
|
+
assembly: assembly
|
|
94
|
+
});
|
|
139
95
|
|
|
140
96
|
case 12:
|
|
141
|
-
results =
|
|
97
|
+
results = _context.sent;
|
|
142
98
|
|
|
143
99
|
if (!(results.length > 1)) {
|
|
144
|
-
|
|
100
|
+
_context.next = 18;
|
|
145
101
|
break;
|
|
146
102
|
}
|
|
147
103
|
|
|
148
104
|
model.setSearchResults(results, label.toLowerCase());
|
|
149
|
-
return
|
|
105
|
+
return _context.abrupt("return");
|
|
150
106
|
|
|
151
107
|
case 18:
|
|
152
108
|
if (results.length === 1) {
|
|
@@ -162,21 +118,21 @@ function SearchBox(_ref) {
|
|
|
162
118
|
}
|
|
163
119
|
|
|
164
120
|
case 21:
|
|
165
|
-
|
|
121
|
+
_context.next = 27;
|
|
166
122
|
break;
|
|
167
123
|
|
|
168
124
|
case 23:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
console.error(
|
|
172
|
-
session.notify("".concat(
|
|
125
|
+
_context.prev = 23;
|
|
126
|
+
_context.t0 = _context["catch"](5);
|
|
127
|
+
console.error(_context.t0);
|
|
128
|
+
session.notify("".concat(_context.t0), 'warning');
|
|
173
129
|
|
|
174
130
|
case 27:
|
|
175
131
|
case "end":
|
|
176
|
-
return
|
|
132
|
+
return _context.stop();
|
|
177
133
|
}
|
|
178
134
|
}
|
|
179
|
-
},
|
|
135
|
+
}, _callee, null, [[5, 23]]);
|
|
180
136
|
}));
|
|
181
137
|
return _handleSelectedRegion.apply(this, arguments);
|
|
182
138
|
}
|
|
@@ -185,7 +141,15 @@ function SearchBox(_ref) {
|
|
|
185
141
|
showHelp: showHelp,
|
|
186
142
|
onSelect: handleSelectedRegion,
|
|
187
143
|
assemblyName: assemblyName,
|
|
188
|
-
fetchResults: fetchResults
|
|
144
|
+
fetchResults: function fetchResults(queryString) {
|
|
145
|
+
return (0, _util2.fetchResults)({
|
|
146
|
+
queryString: queryString,
|
|
147
|
+
searchScope: searchScope,
|
|
148
|
+
rankSearchResults: rankSearchResults,
|
|
149
|
+
textSearchManager: textSearchManager,
|
|
150
|
+
assembly: assembly
|
|
151
|
+
});
|
|
152
|
+
},
|
|
189
153
|
model: model,
|
|
190
154
|
TextFieldProps: {
|
|
191
155
|
variant: 'outlined',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { LinearGenomeViewModel } from '../..';
|
|
3
|
-
export declare const useStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"
|
|
3
|
+
export declare const useStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"dialogContent" | "closeButton">;
|
|
4
4
|
export default function SearchResultsDialog({ model, optAssemblyName, handleClose, }: {
|
|
5
5
|
model: LinearGenomeViewModel;
|
|
6
6
|
optAssemblyName?: string;
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
+
import { Assembly } from '@jbrowse/core/assemblyManager/assembly';
|
|
2
|
+
import { SearchType } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
1
3
|
import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
|
|
4
|
+
import { SearchScope } from '@jbrowse/core/TextSearch/TextSearchManager';
|
|
5
|
+
import { TextSearchManager } from '@jbrowse/core/util';
|
|
2
6
|
export declare function dedupe(results: BaseResult[] | undefined, cb: (result: BaseResult) => string): BaseResult[];
|
|
7
|
+
export declare function fetchResults({ queryString, searchType, searchScope, rankSearchResults, textSearchManager, assembly, }: {
|
|
8
|
+
queryString: string;
|
|
9
|
+
searchScope: SearchScope;
|
|
10
|
+
rankSearchResults: (results: BaseResult[]) => BaseResult[];
|
|
11
|
+
searchType?: SearchType;
|
|
12
|
+
textSearchManager?: TextSearchManager;
|
|
13
|
+
assembly?: Assembly;
|
|
14
|
+
}): Promise<BaseResult[]>;
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.dedupe = dedupe;
|
|
9
|
+
exports.fetchResults = fetchResults;
|
|
10
|
+
|
|
11
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
+
|
|
13
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
14
|
+
|
|
15
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
16
|
+
|
|
17
|
+
var _BaseResults = _interopRequireDefault(require("@jbrowse/core/TextSearch/BaseResults"));
|
|
7
18
|
|
|
8
19
|
function dedupe() {
|
|
9
20
|
var results = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
@@ -13,4 +24,52 @@ function dedupe() {
|
|
|
13
24
|
return cb(t) === cb(elt);
|
|
14
25
|
});
|
|
15
26
|
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function fetchResults(_x) {
|
|
30
|
+
return _fetchResults.apply(this, arguments);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function _fetchResults() {
|
|
34
|
+
_fetchResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
35
|
+
var _assembly$allRefNames;
|
|
36
|
+
|
|
37
|
+
var queryString, searchType, searchScope, rankSearchResults, textSearchManager, assembly, textSearchResults, refNameResults;
|
|
38
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
39
|
+
while (1) {
|
|
40
|
+
switch (_context.prev = _context.next) {
|
|
41
|
+
case 0:
|
|
42
|
+
queryString = _ref.queryString, searchType = _ref.searchType, searchScope = _ref.searchScope, rankSearchResults = _ref.rankSearchResults, textSearchManager = _ref.textSearchManager, assembly = _ref.assembly;
|
|
43
|
+
|
|
44
|
+
if (!textSearchManager) {
|
|
45
|
+
console.warn('No text search manager');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
_context.next = 4;
|
|
49
|
+
return textSearchManager === null || textSearchManager === void 0 ? void 0 : textSearchManager.search({
|
|
50
|
+
queryString: queryString,
|
|
51
|
+
searchType: searchType
|
|
52
|
+
}, searchScope, rankSearchResults);
|
|
53
|
+
|
|
54
|
+
case 4:
|
|
55
|
+
textSearchResults = _context.sent;
|
|
56
|
+
refNameResults = assembly === null || assembly === void 0 ? void 0 : (_assembly$allRefNames = assembly.allRefNames) === null || _assembly$allRefNames === void 0 ? void 0 : _assembly$allRefNames.filter(function (ref) {
|
|
57
|
+
return ref.toLowerCase().startsWith(queryString.toLowerCase());
|
|
58
|
+
}).slice(0, 10).map(function (r) {
|
|
59
|
+
return new _BaseResults.default({
|
|
60
|
+
label: r
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
return _context.abrupt("return", dedupe([].concat((0, _toConsumableArray2.default)(refNameResults || []), (0, _toConsumableArray2.default)(textSearchResults || [])), function (elt) {
|
|
64
|
+
return elt.getId();
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
case 7:
|
|
68
|
+
case "end":
|
|
69
|
+
return _context.stop();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, _callee);
|
|
73
|
+
}));
|
|
74
|
+
return _fetchResults.apply(this, arguments);
|
|
16
75
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -124,7 +124,7 @@ export default class LinearGenomeViewPlugin extends Plugin {
|
|
|
124
124
|
estimatedRegionStatsP: Promise<import("@jbrowse/core/data_adapters/BaseAdapter").Stats> | undefined;
|
|
125
125
|
estimatedRegionStats: import("@jbrowse/core/data_adapters/BaseAdapter").Stats | undefined;
|
|
126
126
|
} & {
|
|
127
|
-
readonly blockType: "
|
|
127
|
+
readonly blockType: "dynamicBlocks" | "staticBlocks";
|
|
128
128
|
readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
129
129
|
} & {
|
|
130
130
|
readonly renderDelay: number;
|
|
@@ -300,7 +300,7 @@ export default class LinearGenomeViewPlugin extends Plugin {
|
|
|
300
300
|
estimatedRegionStatsP: Promise<import("@jbrowse/core/data_adapters/BaseAdapter").Stats> | undefined;
|
|
301
301
|
estimatedRegionStats: import("@jbrowse/core/data_adapters/BaseAdapter").Stats | undefined;
|
|
302
302
|
} & {
|
|
303
|
-
readonly blockType: "
|
|
303
|
+
readonly blockType: "dynamicBlocks" | "staticBlocks";
|
|
304
304
|
readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
305
305
|
} & {
|
|
306
306
|
readonly renderDelay: number;
|
|
@@ -486,7 +486,7 @@ export default class LinearGenomeViewPlugin extends Plugin {
|
|
|
486
486
|
estimatedRegionStatsP: Promise<import("@jbrowse/core/data_adapters/BaseAdapter").Stats> | undefined;
|
|
487
487
|
estimatedRegionStats: import("@jbrowse/core/data_adapters/BaseAdapter").Stats | undefined;
|
|
488
488
|
} & {
|
|
489
|
-
readonly blockType: "
|
|
489
|
+
readonly blockType: "dynamicBlocks" | "staticBlocks";
|
|
490
490
|
readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
491
491
|
} & {
|
|
492
492
|
readonly renderDelay: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-linear-genome-view",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.11",
|
|
4
4
|
"description": "JBrowse 2 linear genome view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "5c21beb48a21f08b0091d293f09ac99174c48f77"
|
|
62
62
|
}
|
|
@@ -42,7 +42,7 @@ const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
|
|
|
42
42
|
get showDescriptions() {
|
|
43
43
|
return (
|
|
44
44
|
self.trackShowDescriptions ??
|
|
45
|
-
getConf(self, ['renderer', '
|
|
45
|
+
getConf(self, ['renderer', 'showDescriptions'])
|
|
46
46
|
)
|
|
47
47
|
},
|
|
48
48
|
|
|
@@ -116,9 +116,7 @@ const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
|
|
|
116
116
|
icon: VisibilityIcon,
|
|
117
117
|
type: 'checkbox',
|
|
118
118
|
checked: self.showDescriptions,
|
|
119
|
-
onClick: () =>
|
|
120
|
-
self.toggleShowDescriptions()
|
|
121
|
-
},
|
|
119
|
+
onClick: () => self.toggleShowDescriptions(),
|
|
122
120
|
},
|
|
123
121
|
{
|
|
124
122
|
label: 'Display mode',
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
makeStyles,
|
|
8
8
|
alpha,
|
|
9
9
|
} from '@material-ui/core'
|
|
10
|
-
import {
|
|
10
|
+
import { getBpDisplayStr } from '@jbrowse/core/util'
|
|
11
11
|
import SearchBox from './SearchBox'
|
|
12
12
|
|
|
13
13
|
// icons
|
|
@@ -98,10 +98,10 @@ function PanControls({ model }: { model: LGV }) {
|
|
|
98
98
|
|
|
99
99
|
const RegionWidth = observer(({ model }: { model: LGV }) => {
|
|
100
100
|
const classes = useStyles()
|
|
101
|
-
const { coarseTotalBp
|
|
101
|
+
const { coarseTotalBp } = model
|
|
102
102
|
return (
|
|
103
103
|
<Typography variant="body2" color="textSecondary" className={classes.bp}>
|
|
104
|
-
{
|
|
104
|
+
{getBpDisplayStr(coarseTotalBp)}
|
|
105
105
|
</Typography>
|
|
106
106
|
)
|
|
107
107
|
})
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
Grid,
|
|
9
9
|
makeStyles,
|
|
10
10
|
} from '@material-ui/core'
|
|
11
|
-
import { SearchType } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
12
11
|
import ErrorMessage from '@jbrowse/core/ui/ErrorMessage'
|
|
13
12
|
import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
|
|
14
13
|
import AssemblySelector from '@jbrowse/core/ui/AssemblySelector'
|
|
@@ -16,6 +15,7 @@ import CloseIcon from '@material-ui/icons/Close'
|
|
|
16
15
|
|
|
17
16
|
// locals
|
|
18
17
|
import RefNameAutocomplete from './RefNameAutocomplete'
|
|
18
|
+
import { fetchResults } from './util'
|
|
19
19
|
import { LinearGenomeViewModel, WIDGET_HEIGHT } from '..'
|
|
20
20
|
const SearchResultsDialog = lazy(() => import('./SearchResultsDialog'))
|
|
21
21
|
|
|
@@ -57,28 +57,6 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
|
|
|
57
57
|
label: value,
|
|
58
58
|
})
|
|
59
59
|
|
|
60
|
-
async function fetchResults(query: string, searchType?: SearchType) {
|
|
61
|
-
if (!textSearchManager) {
|
|
62
|
-
console.warn('No text search manager')
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const textSearchResults = await textSearchManager?.search(
|
|
66
|
-
{
|
|
67
|
-
queryString: query,
|
|
68
|
-
searchType,
|
|
69
|
-
},
|
|
70
|
-
searchScope,
|
|
71
|
-
rankSearchResults,
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
const refNameResults = assembly?.allRefNames
|
|
75
|
-
?.filter(refName => refName.startsWith(query))
|
|
76
|
-
.map(r => new BaseResult({ label: r }))
|
|
77
|
-
.slice(0, 10)
|
|
78
|
-
|
|
79
|
-
return [...(refNameResults || []), ...(textSearchResults || [])]
|
|
80
|
-
}
|
|
81
|
-
|
|
82
60
|
// gets a string as input, or use stored option results from previous query,
|
|
83
61
|
// then re-query and
|
|
84
62
|
// 1) if it has multiple results: pop a dialog
|
|
@@ -105,7 +83,14 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
|
|
|
105
83
|
) {
|
|
106
84
|
model.navToLocString(location, selectedAsm)
|
|
107
85
|
} else {
|
|
108
|
-
const results = await fetchResults(
|
|
86
|
+
const results = await fetchResults({
|
|
87
|
+
queryString: input,
|
|
88
|
+
searchType: 'exact',
|
|
89
|
+
searchScope,
|
|
90
|
+
rankSearchResults,
|
|
91
|
+
textSearchManager,
|
|
92
|
+
assembly,
|
|
93
|
+
})
|
|
109
94
|
if (results.length > 1) {
|
|
110
95
|
model.setSearchResults(results, input.toLowerCase())
|
|
111
96
|
return
|
|
@@ -165,7 +150,15 @@ const ImportForm = observer(({ model }: { model: LGV }) => {
|
|
|
165
150
|
<CloseIcon style={{ color: 'red' }} />
|
|
166
151
|
) : value ? (
|
|
167
152
|
<RefNameAutocomplete
|
|
168
|
-
fetchResults={
|
|
153
|
+
fetchResults={queryString =>
|
|
154
|
+
fetchResults({
|
|
155
|
+
queryString,
|
|
156
|
+
assembly,
|
|
157
|
+
textSearchManager,
|
|
158
|
+
rankSearchResults,
|
|
159
|
+
searchScope,
|
|
160
|
+
})
|
|
161
|
+
}
|
|
169
162
|
model={model}
|
|
170
163
|
assemblyName={assemblyError ? undefined : selectedAsm}
|
|
171
164
|
value={value}
|
|
@@ -170,6 +170,19 @@ const colorMap: { [key: string]: string | undefined } = {
|
|
|
170
170
|
acen: '#800',
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
function getCytobands(assembly: Assembly | undefined, refName: string) {
|
|
174
|
+
return (
|
|
175
|
+
assembly?.cytobands
|
|
176
|
+
?.map(f => ({
|
|
177
|
+
refName: assembly.getCanonicalRefName(f.get('refName')),
|
|
178
|
+
start: f.get('start'),
|
|
179
|
+
end: f.get('end'),
|
|
180
|
+
type: f.get('type'),
|
|
181
|
+
}))
|
|
182
|
+
.filter(f => f.refName === refName) || []
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
173
186
|
const Cytobands = observer(
|
|
174
187
|
({
|
|
175
188
|
overview,
|
|
@@ -181,37 +194,30 @@ const Cytobands = observer(
|
|
|
181
194
|
block: ContentBlock
|
|
182
195
|
}) => {
|
|
183
196
|
const { offsetPx, reversed } = block
|
|
184
|
-
const cytobands = assembly
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
overview.bpToPx({
|
|
200
|
-
refName,
|
|
201
|
-
coord: end,
|
|
202
|
-
}),
|
|
203
|
-
type,
|
|
204
|
-
]
|
|
205
|
-
})
|
|
197
|
+
const cytobands = getCytobands(assembly, block.refName)
|
|
198
|
+
const coords = cytobands.map(f => {
|
|
199
|
+
const { refName, start, end, type } = f
|
|
200
|
+
return [
|
|
201
|
+
overview.bpToPx({
|
|
202
|
+
refName,
|
|
203
|
+
coord: start,
|
|
204
|
+
}),
|
|
205
|
+
overview.bpToPx({
|
|
206
|
+
refName,
|
|
207
|
+
coord: end,
|
|
208
|
+
}),
|
|
209
|
+
type,
|
|
210
|
+
]
|
|
211
|
+
})
|
|
206
212
|
|
|
207
213
|
const arr = cytobands || []
|
|
208
214
|
const lcap = reversed ? arr.length - 1 : 0
|
|
209
215
|
const rcap = reversed ? 0 : arr.length - 1
|
|
210
216
|
|
|
211
217
|
let firstCent = true
|
|
212
|
-
return
|
|
218
|
+
return (
|
|
213
219
|
<g transform={`translate(-${offsetPx})`}>
|
|
214
|
-
{
|
|
220
|
+
{coords.map(([start, end, type], index) => {
|
|
215
221
|
const key = `${start}-${end}-${type}`
|
|
216
222
|
if (type === 'acen' && firstCent) {
|
|
217
223
|
firstCent = false
|
|
@@ -283,7 +289,7 @@ const Cytobands = observer(
|
|
|
283
289
|
}
|
|
284
290
|
})}
|
|
285
291
|
</g>
|
|
286
|
-
)
|
|
292
|
+
)
|
|
287
293
|
},
|
|
288
294
|
)
|
|
289
295
|
|
|
@@ -313,13 +319,16 @@ const OverviewBox = observer(
|
|
|
313
319
|
tickLabels.push(reversed ? end - offsetLabel : start + offsetLabel)
|
|
314
320
|
}
|
|
315
321
|
|
|
322
|
+
const canDisplayCytobands =
|
|
323
|
+
showCytobands && getCytobands(assembly, block.refName).length
|
|
324
|
+
|
|
316
325
|
return (
|
|
317
326
|
<div>
|
|
318
327
|
{/* name of sequence */}
|
|
319
328
|
<Typography
|
|
320
329
|
style={{
|
|
321
330
|
left: block.offsetPx + 3,
|
|
322
|
-
color:
|
|
331
|
+
color: canDisplayCytobands ? 'black' : refNameColor,
|
|
323
332
|
}}
|
|
324
333
|
className={classes.scaleBarRefName}
|
|
325
334
|
>
|
|
@@ -328,12 +337,12 @@ const OverviewBox = observer(
|
|
|
328
337
|
<div
|
|
329
338
|
className={clsx(
|
|
330
339
|
classes.scaleBarContig,
|
|
331
|
-
|
|
340
|
+
canDisplayCytobands
|
|
332
341
|
? undefined
|
|
333
342
|
: reversed
|
|
334
343
|
? classes.scaleBarContigReverse
|
|
335
344
|
: classes.scaleBarContigForward,
|
|
336
|
-
!
|
|
345
|
+
!canDisplayCytobands ? classes.scaleBarBorder : undefined,
|
|
337
346
|
)}
|
|
338
347
|
style={{
|
|
339
348
|
left: block.offsetPx + cytobandOffset,
|
|
@@ -341,7 +350,7 @@ const OverviewBox = observer(
|
|
|
341
350
|
borderColor: refNameColor,
|
|
342
351
|
}}
|
|
343
352
|
>
|
|
344
|
-
{!
|
|
353
|
+
{!canDisplayCytobands
|
|
345
354
|
? tickLabels.map((tickLabel, labelIdx) => (
|
|
346
355
|
<Typography
|
|
347
356
|
key={`${JSON.stringify(block)}-${tickLabel}-${labelIdx}`}
|
|
@@ -358,7 +367,7 @@ const OverviewBox = observer(
|
|
|
358
367
|
))
|
|
359
368
|
: null}
|
|
360
369
|
|
|
361
|
-
{
|
|
370
|
+
{canDisplayCytobands ? (
|
|
362
371
|
<svg style={{ width: '100%' }}>
|
|
363
372
|
<Cytobands
|
|
364
373
|
overview={overview}
|
|
@@ -3,11 +3,10 @@ import { observer } from 'mobx-react'
|
|
|
3
3
|
import { makeStyles, useTheme, alpha } from '@material-ui/core'
|
|
4
4
|
import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
|
|
5
5
|
import { getSession } from '@jbrowse/core/util'
|
|
6
|
-
import { SearchType } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
7
6
|
|
|
8
7
|
// locals
|
|
9
8
|
import RefNameAutocomplete from './RefNameAutocomplete'
|
|
10
|
-
import {
|
|
9
|
+
import { fetchResults } from './util'
|
|
11
10
|
import { LinearGenomeViewModel, SPACING, WIDGET_HEIGHT } from '..'
|
|
12
11
|
|
|
13
12
|
const useStyles = makeStyles(() => ({
|
|
@@ -33,31 +32,6 @@ function SearchBox({
|
|
|
33
32
|
const assembly = assemblyManager.get(assemblyName)
|
|
34
33
|
const searchScope = model.searchScope(assemblyName)
|
|
35
34
|
|
|
36
|
-
async function fetchResults(query: string, searchType?: SearchType) {
|
|
37
|
-
if (!textSearchManager) {
|
|
38
|
-
console.warn('No text search manager')
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const textSearchResults = await textSearchManager?.search(
|
|
42
|
-
{
|
|
43
|
-
queryString: query,
|
|
44
|
-
searchType,
|
|
45
|
-
},
|
|
46
|
-
searchScope,
|
|
47
|
-
rankSearchResults,
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
const refNameResults = assembly?.allRefNames
|
|
51
|
-
?.filter(refName => refName.startsWith(query))
|
|
52
|
-
.map(r => new BaseResult({ label: r }))
|
|
53
|
-
.slice(0, 10)
|
|
54
|
-
|
|
55
|
-
return dedupe(
|
|
56
|
-
[...(refNameResults || []), ...(textSearchResults || [])],
|
|
57
|
-
elt => elt.getId(),
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
35
|
// gets a string as input, or use stored option results from previous query,
|
|
62
36
|
// then re-query and
|
|
63
37
|
// 1) if it has multiple results: pop a dialog
|
|
@@ -82,7 +56,14 @@ function SearchBox({
|
|
|
82
56
|
) {
|
|
83
57
|
model.navToLocString(location, assemblyName)
|
|
84
58
|
} else {
|
|
85
|
-
const results = await fetchResults(
|
|
59
|
+
const results = await fetchResults({
|
|
60
|
+
queryString: label,
|
|
61
|
+
searchType: 'exact',
|
|
62
|
+
searchScope,
|
|
63
|
+
rankSearchResults,
|
|
64
|
+
textSearchManager,
|
|
65
|
+
assembly,
|
|
66
|
+
})
|
|
86
67
|
if (results.length > 1) {
|
|
87
68
|
model.setSearchResults(results, label.toLowerCase())
|
|
88
69
|
return
|
|
@@ -106,7 +87,15 @@ function SearchBox({
|
|
|
106
87
|
showHelp={showHelp}
|
|
107
88
|
onSelect={handleSelectedRegion}
|
|
108
89
|
assemblyName={assemblyName}
|
|
109
|
-
fetchResults={
|
|
90
|
+
fetchResults={queryString =>
|
|
91
|
+
fetchResults({
|
|
92
|
+
queryString,
|
|
93
|
+
searchScope,
|
|
94
|
+
rankSearchResults,
|
|
95
|
+
textSearchManager,
|
|
96
|
+
assembly,
|
|
97
|
+
})
|
|
98
|
+
}
|
|
110
99
|
model={model}
|
|
111
100
|
TextFieldProps={{
|
|
112
101
|
variant: 'outlined',
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { Assembly } from '@jbrowse/core/assemblyManager/assembly'
|
|
2
|
+
import { SearchType } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
1
3
|
import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
|
|
4
|
+
import { SearchScope } from '@jbrowse/core/TextSearch/TextSearchManager'
|
|
5
|
+
import { TextSearchManager } from '@jbrowse/core/util'
|
|
2
6
|
|
|
3
7
|
export function dedupe(
|
|
4
8
|
results: BaseResult[] = [],
|
|
@@ -8,3 +12,42 @@ export function dedupe(
|
|
|
8
12
|
(elt, idx, self) => idx === self.findIndex(t => cb(t) === cb(elt)),
|
|
9
13
|
)
|
|
10
14
|
}
|
|
15
|
+
|
|
16
|
+
export async function fetchResults({
|
|
17
|
+
queryString,
|
|
18
|
+
searchType,
|
|
19
|
+
searchScope,
|
|
20
|
+
rankSearchResults,
|
|
21
|
+
textSearchManager,
|
|
22
|
+
assembly,
|
|
23
|
+
}: {
|
|
24
|
+
queryString: string
|
|
25
|
+
searchScope: SearchScope
|
|
26
|
+
rankSearchResults: (results: BaseResult[]) => BaseResult[]
|
|
27
|
+
searchType?: SearchType
|
|
28
|
+
textSearchManager?: TextSearchManager
|
|
29
|
+
assembly?: Assembly
|
|
30
|
+
}) {
|
|
31
|
+
if (!textSearchManager) {
|
|
32
|
+
console.warn('No text search manager')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const textSearchResults = await textSearchManager?.search(
|
|
36
|
+
{
|
|
37
|
+
queryString,
|
|
38
|
+
searchType,
|
|
39
|
+
},
|
|
40
|
+
searchScope,
|
|
41
|
+
rankSearchResults,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
const refNameResults = assembly?.allRefNames
|
|
45
|
+
?.filter(ref => ref.toLowerCase().startsWith(queryString.toLowerCase()))
|
|
46
|
+
.slice(0, 10)
|
|
47
|
+
.map(r => new BaseResult({ label: r }))
|
|
48
|
+
|
|
49
|
+
return dedupe(
|
|
50
|
+
[...(refNameResults || []), ...(textSearchResults || [])],
|
|
51
|
+
elt => elt.getId(),
|
|
52
|
+
)
|
|
53
|
+
}
|