@jbrowse/plugin-legacy-jbrowse 1.6.9 → 1.7.3
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/JBrowse1Connection/configSchema.d.ts +2 -2
- package/dist/JBrowse1Connection/configSchema.js +30 -0
- package/dist/JBrowse1Connection/index.d.ts +2 -2
- package/dist/JBrowse1Connection/index.js +23 -0
- package/dist/JBrowse1Connection/jb1ConfigLoad.d.ts +36 -36
- package/dist/JBrowse1Connection/jb1ConfigLoad.js +555 -0
- package/dist/JBrowse1Connection/jb1ConfigParse.d.ts +11 -11
- package/dist/JBrowse1Connection/jb1ConfigParse.js +476 -0
- package/dist/JBrowse1Connection/jb1ToJb2.d.ts +47 -47
- package/dist/JBrowse1Connection/jb1ToJb2.js +556 -0
- package/dist/JBrowse1Connection/model.d.ts +15 -4
- package/dist/JBrowse1Connection/model.js +58 -0
- package/dist/JBrowse1Connection/types.d.ts +91 -91
- package/dist/JBrowse1Connection/types.js +5 -0
- package/dist/JBrowse1Connection/util.d.ts +26 -26
- package/dist/JBrowse1Connection/util.js +177 -0
- package/dist/JBrowse1TextSeachAdapter/HttpMap.d.ts +39 -39
- package/dist/JBrowse1TextSeachAdapter/HttpMap.js +350 -0
- package/dist/JBrowse1TextSeachAdapter/HttpMap.test.js +118 -0
- package/dist/JBrowse1TextSeachAdapter/JBrowse1TextSearchAdapter.d.ts +33 -33
- package/dist/JBrowse1TextSeachAdapter/JBrowse1TextSearchAdapter.js +191 -0
- package/dist/JBrowse1TextSeachAdapter/JBrowse1TextSearchAdapter.test.js +98 -0
- package/dist/JBrowse1TextSeachAdapter/configSchema.d.ts +2 -2
- package/dist/JBrowse1TextSeachAdapter/configSchema.js +35 -0
- package/dist/JBrowse1TextSeachAdapter/index.d.ts +2 -2
- package/dist/JBrowse1TextSeachAdapter/index.js +23 -0
- package/dist/NCListAdapter/NCListAdapter.d.ts +31 -31
- package/dist/NCListAdapter/NCListAdapter.js +237 -0
- package/dist/NCListAdapter/NCListAdapter.test.js +108 -0
- package/dist/NCListAdapter/NCListFeature.d.ts +31 -31
- package/dist/NCListAdapter/NCListFeature.js +142 -0
- package/dist/NCListAdapter/configSchema.d.ts +2 -2
- package/dist/NCListAdapter/configSchema.js +27 -0
- package/dist/NCListAdapter/index.d.ts +1 -1
- package/dist/NCListAdapter/index.js +15 -0
- package/dist/declare.d.js +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +122 -6
- package/dist/index.test.js +44 -0
- package/package.json +5 -7
- package/src/JBrowse1Connection/jb1ConfigLoad.ts +1 -1
- package/dist/index.test.d.ts +0 -1
- package/dist/plugin-legacy-jbrowse.cjs.development.js +0 -3567
- package/dist/plugin-legacy-jbrowse.cjs.development.js.map +0 -1
- package/dist/plugin-legacy-jbrowse.cjs.production.min.js +0 -2
- package/dist/plugin-legacy-jbrowse.cjs.production.min.js.map +0 -1
- package/dist/plugin-legacy-jbrowse.esm.js +0 -3561
- package/dist/plugin-legacy-jbrowse.esm.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Config } from './types';
|
|
2
|
-
export declare function parseJB1Json(config: Config | string, url: string): Config;
|
|
3
|
-
export declare function parseJB1Conf(config: string, url: string): Config;
|
|
4
|
-
/**
|
|
5
|
-
* Applies defaults and any other necessary tweaks to the loaded configuration.
|
|
6
|
-
* @param conf - the object containing the configuration, which it modifies
|
|
7
|
-
* in-place
|
|
8
|
-
* @param url - URL of the config file
|
|
9
|
-
* @returns the same object it was passed
|
|
10
|
-
*/
|
|
11
|
-
export declare function regularizeConf(conf: Config, url: string): Config;
|
|
1
|
+
import { Config } from './types';
|
|
2
|
+
export declare function parseJB1Json(config: Config | string, url: string): Config;
|
|
3
|
+
export declare function parseJB1Conf(config: string, url: string): Config;
|
|
4
|
+
/**
|
|
5
|
+
* Applies defaults and any other necessary tweaks to the loaded configuration.
|
|
6
|
+
* @param conf - the object containing the configuration, which it modifies
|
|
7
|
+
* in-place
|
|
8
|
+
* @param url - URL of the config file
|
|
9
|
+
* @returns the same object it was passed
|
|
10
|
+
*/
|
|
11
|
+
export declare function regularizeConf(conf: Config, url: string): Config;
|
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.parseJB1Conf = parseJB1Conf;
|
|
9
|
+
exports.parseJB1Json = parseJB1Json;
|
|
10
|
+
exports.regularizeConf = regularizeConf;
|
|
11
|
+
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
18
|
+
var _getValue = _interopRequireDefault(require("get-value"));
|
|
19
|
+
|
|
20
|
+
var _setValue = _interopRequireDefault(require("set-value"));
|
|
21
|
+
|
|
22
|
+
var _util = require("@jbrowse/core/util");
|
|
23
|
+
|
|
24
|
+
var _util2 = require("./util");
|
|
25
|
+
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
+
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
|
+
|
|
30
|
+
function parseJB1Json(config, url) {
|
|
31
|
+
if (typeof config === 'string') {
|
|
32
|
+
var parsedConf;
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
parsedConf = JSON.parse(config);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
throw new Error("".concat(error, " when parsing configuration."));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return regularizeConf(parsedConf, url);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return regularizeConf(config, url);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function parseJB1Conf(config, url) {
|
|
47
|
+
var parsedConf;
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
parsedConf = parse(config, url);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
throw new Error("".concat(error, " when parsing configuration."));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return regularizeConf(parsedConf, url);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function isAlwaysArray(varName) {
|
|
59
|
+
if (varName === 'include') {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function parse(text, url) {
|
|
67
|
+
var section = [];
|
|
68
|
+
var keyPath;
|
|
69
|
+
var operation;
|
|
70
|
+
var value;
|
|
71
|
+
var data = {
|
|
72
|
+
tracks: {}
|
|
73
|
+
};
|
|
74
|
+
var lineNumber;
|
|
75
|
+
|
|
76
|
+
function recordVal() {
|
|
77
|
+
if (value !== undefined) {
|
|
78
|
+
var parsedValue;
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
// parse json
|
|
82
|
+
var match = value.match(/^json:(.+)/i);
|
|
83
|
+
|
|
84
|
+
if (match) {
|
|
85
|
+
parsedValue = JSON.parse(match[1]);
|
|
86
|
+
} // parse numbers if it looks numeric
|
|
87
|
+
else if (/^[+-]?[\d.,]+([eE][-+]?\d+)?$/.test(value)) {
|
|
88
|
+
parsedValue = parseFloat(value.replace(/,/g, ''));
|
|
89
|
+
} else {
|
|
90
|
+
parsedValue = value;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (!keyPath) {
|
|
94
|
+
throw new Error("Error parsing in section ".concat(section.join(' - ')));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var path = section.concat(keyPath).join('.');
|
|
98
|
+
|
|
99
|
+
if (operation === '+=') {
|
|
100
|
+
var existing = (0, _getValue["default"])(data, path);
|
|
101
|
+
|
|
102
|
+
if (existing) {
|
|
103
|
+
if (!Array.isArray(existing)) {
|
|
104
|
+
existing = [existing];
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
existing = [];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
existing.push(parsedValue);
|
|
111
|
+
parsedValue = existing;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (parsedValue === 'true') {
|
|
115
|
+
parsedValue = true;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (parsedValue === 'false') {
|
|
119
|
+
parsedValue = false;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
(0, _setValue["default"])(data, path, parsedValue);
|
|
123
|
+
} catch (e) {
|
|
124
|
+
throw new Error("syntax error".concat(url ? " in ".concat(url) : '').concat(lineNumber ? " at line ".concat(lineNumber - 1) : ''));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
text.split('\n').forEach(function (textLine, i) {
|
|
130
|
+
lineNumber = i + 1;
|
|
131
|
+
var line = textLine.replace(/^\s*#.+/, ''); // new section
|
|
132
|
+
|
|
133
|
+
var match;
|
|
134
|
+
|
|
135
|
+
if (match = line.match(/^\s*\[([^\]]+)/)) {
|
|
136
|
+
// new section
|
|
137
|
+
recordVal();
|
|
138
|
+
keyPath = undefined;
|
|
139
|
+
value = undefined;
|
|
140
|
+
section = match[1].trim().split(/\s*\.\s*/);
|
|
141
|
+
|
|
142
|
+
if (section.length === 1 && section[0].toLowerCase() === 'general') {
|
|
143
|
+
section = [];
|
|
144
|
+
}
|
|
145
|
+
} // new value
|
|
146
|
+
else if (match = line.match(value === undefined ? /^([^+=]+)(\+?=)(.*)/ : /^(\S[^+=]+)(\+?=)(.*)/)) {
|
|
147
|
+
recordVal();
|
|
148
|
+
keyPath = match[1].trim().split(/\s*\.\s*/);
|
|
149
|
+
var _match = match;
|
|
150
|
+
|
|
151
|
+
var _match2 = (0, _slicedToArray2["default"])(_match, 3);
|
|
152
|
+
|
|
153
|
+
operation = _match2[2];
|
|
154
|
+
|
|
155
|
+
if (isAlwaysArray(section.concat(keyPath).join('.'))) {
|
|
156
|
+
operation = '+=';
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
value = match[3].trim();
|
|
160
|
+
} // add to existing array value
|
|
161
|
+
else if (keyPath !== undefined && (match = line.match(/^\s{0,4}\+\s*(.+)/))) {
|
|
162
|
+
recordVal();
|
|
163
|
+
operation = '+=';
|
|
164
|
+
value = match[1].trim();
|
|
165
|
+
} // add to existing value
|
|
166
|
+
else if (value !== undefined && (match = line.match(/^\s+(\S.*)/))) {
|
|
167
|
+
value += value.length ? " ".concat(match[1].trim()) : match[1].trim();
|
|
168
|
+
} // done with last value
|
|
169
|
+
else {
|
|
170
|
+
recordVal();
|
|
171
|
+
keyPath = undefined;
|
|
172
|
+
value = undefined;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
recordVal();
|
|
176
|
+
return data;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Applies defaults and any other necessary tweaks to the loaded configuration.
|
|
180
|
+
* @param conf - the object containing the configuration, which it modifies
|
|
181
|
+
* in-place
|
|
182
|
+
* @param url - URL of the config file
|
|
183
|
+
* @returns the same object it was passed
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
function regularizeConf(conf, url) {
|
|
188
|
+
// if tracks is not an array, convert it to one
|
|
189
|
+
if (conf.tracks && !Array.isArray(conf.tracks)) {
|
|
190
|
+
// if it's a single track config, wrap it in an arrayref
|
|
191
|
+
if ((0, _util2.isTrack)(conf.tracks)) {
|
|
192
|
+
conf.tracks = [conf.tracks];
|
|
193
|
+
} // otherwise, coerce it to an array
|
|
194
|
+
else {
|
|
195
|
+
var tracks = [];
|
|
196
|
+
|
|
197
|
+
for (var _i = 0, _Object$keys = Object.keys(conf.tracks); _i < _Object$keys.length; _i++) {
|
|
198
|
+
var label = _Object$keys[_i];
|
|
199
|
+
var track = conf.tracks[label];
|
|
200
|
+
|
|
201
|
+
if ((0, _util2.isTrack)(track)) {
|
|
202
|
+
tracks.push(track);
|
|
203
|
+
} else {
|
|
204
|
+
tracks.push(_objectSpread({
|
|
205
|
+
label: label
|
|
206
|
+
}, track));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
conf.tracks = tracks;
|
|
211
|
+
}
|
|
212
|
+
} // regularize trackMetadata.sources
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
var meta = conf.trackMetadata;
|
|
216
|
+
|
|
217
|
+
if (meta && meta.sources) {
|
|
218
|
+
// if it's a single source config, wrap it in an arrayref
|
|
219
|
+
if (typeof meta.sources === 'string') {
|
|
220
|
+
meta.sources = [meta.sources];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if ((0, _util2.isSource)(meta.sources)) {
|
|
224
|
+
meta.sources = [meta.sources];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (!Array.isArray(meta.sources)) {
|
|
228
|
+
var sources = [];
|
|
229
|
+
|
|
230
|
+
for (var _i2 = 0, _Object$keys2 = Object.keys(meta.sources); _i2 < _Object$keys2.length; _i2++) {
|
|
231
|
+
var name = _Object$keys2[_i2];
|
|
232
|
+
var source = meta.sources[name];
|
|
233
|
+
|
|
234
|
+
if (!('name' in source)) {
|
|
235
|
+
source.name = name;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
sources.push(source);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
meta.sources = sources;
|
|
242
|
+
} // coerce any string source defs to be URLs, and try to detect their types
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
meta.sources = meta.sources.map(function (sourceDef) {
|
|
246
|
+
if (typeof sourceDef === 'string') {
|
|
247
|
+
var newSourceDef = {
|
|
248
|
+
url: sourceDef
|
|
249
|
+
};
|
|
250
|
+
var typeMatch = sourceDef.match(/\.(\w+)$/);
|
|
251
|
+
|
|
252
|
+
if (typeMatch) {
|
|
253
|
+
newSourceDef.type = typeMatch[1].toLowerCase();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return newSourceDef;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return sourceDef;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
conf.sourceUrl = conf.sourceUrl || url;
|
|
264
|
+
|
|
265
|
+
if (conf.sourceUrl.startsWith('/')) {
|
|
266
|
+
conf.sourceUrl = new URL(conf.sourceUrl, window.location.href).href;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
conf.baseUrl = conf.baseUrl || new URL('.', conf.sourceUrl).href;
|
|
270
|
+
|
|
271
|
+
if (conf.baseUrl.length && !conf.baseUrl.endsWith('/')) {
|
|
272
|
+
conf.baseUrl += '/';
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (conf.sourceUrl) {
|
|
276
|
+
// set a default baseUrl in each of the track and store confs, and the names
|
|
277
|
+
// conf, if needed
|
|
278
|
+
var addBase = [];
|
|
279
|
+
|
|
280
|
+
if (conf.tracks) {
|
|
281
|
+
addBase.push.apply(addBase, (0, _toConsumableArray2["default"])(conf.tracks));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (conf.stores) {
|
|
285
|
+
addBase.push.apply(addBase, (0, _toConsumableArray2["default"])(Object.values(conf.stores)));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (conf.names) {
|
|
289
|
+
addBase.push(conf.names);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
addBase.forEach(function (t) {
|
|
293
|
+
if (!t.baseUrl) {
|
|
294
|
+
t.baseUrl = conf.baseUrl || '/';
|
|
295
|
+
}
|
|
296
|
+
}); // resolve the refSeqs and nameUrl if present
|
|
297
|
+
|
|
298
|
+
if (conf.refSeqs && typeof conf.refSeqs === 'string') {
|
|
299
|
+
conf.refSeqs = new URL(conf.refSeqs, conf.sourceUrl).href;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (conf.nameUrl) {
|
|
303
|
+
conf.nameUrl = new URL(conf.nameUrl, conf.sourceUrl).href;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
conf.stores = conf.stores || {};
|
|
308
|
+
(conf.tracks || []).forEach(function (trackConfig) {
|
|
309
|
+
// if there is a `config` subpart, just copy its keys in to the top-level
|
|
310
|
+
// config
|
|
311
|
+
if (trackConfig.config) {
|
|
312
|
+
var c = trackConfig.config;
|
|
313
|
+
delete trackConfig.config;
|
|
314
|
+
trackConfig = _objectSpread(_objectSpread({}, c), trackConfig);
|
|
315
|
+
} // skip if it's a new-style track def
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
if (trackConfig.store) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
var trackClassName;
|
|
323
|
+
|
|
324
|
+
if (trackConfig.type === 'FeatureTrack') {
|
|
325
|
+
trackClassName = 'JBrowse/View/Track/HTMLFeatures';
|
|
326
|
+
} else if (trackConfig.type === 'ImageTrack') {
|
|
327
|
+
trackClassName = 'JBrowse/View/Track/FixedImage';
|
|
328
|
+
} else if (trackConfig.type === 'ImageTrack.Wiggle') {
|
|
329
|
+
trackClassName = 'JBrowse/View/Track/FixedImage/Wiggle';
|
|
330
|
+
} else if (trackConfig.type === 'SequenceTrack') {
|
|
331
|
+
trackClassName = 'JBrowse/View/Track/Sequence';
|
|
332
|
+
} else {
|
|
333
|
+
trackClassName = regularizeClass('JBrowse/View/Track', trackConfig.type);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
trackConfig.type = trackClassName;
|
|
337
|
+
synthesizeTrackStoreConfig(conf, trackConfig);
|
|
338
|
+
|
|
339
|
+
if (trackConfig.histograms) {
|
|
340
|
+
if (!trackConfig.histograms.baseUrl) {
|
|
341
|
+
trackConfig.histograms.baseUrl = trackConfig.baseUrl;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
synthesizeTrackStoreConfig(conf, trackConfig.histograms);
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
return conf;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* prefix class name with `root` if it contains no slashes
|
|
351
|
+
* @param root - Prefix root
|
|
352
|
+
* @param className - class name
|
|
353
|
+
*/
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
function regularizeClass(root, className) {
|
|
357
|
+
if (!className) {
|
|
358
|
+
return '';
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (!className.includes('/')) {
|
|
362
|
+
className = "".concat(root, "/").concat(className);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
className = className.replace(/^\//, '');
|
|
366
|
+
return className;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function guessStoreClass(trackConfig, urlTemplate) {
|
|
370
|
+
if (!trackConfig) {
|
|
371
|
+
return '';
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (trackConfig.type && trackConfig.type.includes('/FixedImage')) {
|
|
375
|
+
return "JBrowse/Store/TiledImage/Fixed".concat(trackConfig.backendVersion === 0 ? '_v0' : '');
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if (/\.jsonz?$/i.test(urlTemplate)) {
|
|
379
|
+
return "JBrowse/Store/SeqFeature/NCList".concat(trackConfig.backendVersion === 0 ? '_v0' : '');
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
if (/\.bam$/i.test(urlTemplate)) {
|
|
383
|
+
return 'JBrowse/Store/SeqFeature/BAM';
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if (/\.cram$/i.test(urlTemplate)) {
|
|
387
|
+
return 'JBrowse/Store/SeqFeature/CRAM';
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if (/\.gff3?$/i.test(urlTemplate)) {
|
|
391
|
+
return 'JBrowse/Store/SeqFeature/GFF3';
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if (/\.bed$/i.test(urlTemplate)) {
|
|
395
|
+
return 'JBrowse/Store/SeqFeature/BED';
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (/\.vcf.b?gz$/i.test(urlTemplate)) {
|
|
399
|
+
return 'JBrowse/Store/SeqFeature/VCFTabix';
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (/\.gff3?.b?gz$/i.test(urlTemplate)) {
|
|
403
|
+
return 'JBrowse/Store/SeqFeature/GFF3Tabix';
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if (/\.bed.b?gz$/i.test(urlTemplate)) {
|
|
407
|
+
return 'JBrowse/Store/SeqFeature/BEDTabix';
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
if (/\.(bw|bigwig)$/i.test(urlTemplate)) {
|
|
411
|
+
return 'JBrowse/Store/SeqFeature/BigWig';
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
if (/\.(bb|bigbed)$/i.test(urlTemplate)) {
|
|
415
|
+
return 'JBrowse/Store/SeqFeature/BigBed';
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
if (/\.(fa|fasta)$/i.test(urlTemplate)) {
|
|
419
|
+
return 'JBrowse/Store/SeqFeature/IndexedFasta';
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
if (/\.(fa|fasta)\.b?gz$/i.test(urlTemplate)) {
|
|
423
|
+
return 'JBrowse/Store/SeqFeature/BgzipIndexedFasta';
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
if (/\.2bit$/i.test(urlTemplate)) {
|
|
427
|
+
return 'JBrowse/Store/SeqFeature/TwoBit';
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
if (trackConfig.type && trackConfig.type.endsWith('/Sequence')) {
|
|
431
|
+
return 'JBrowse/Store/Sequence/StaticChunked';
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
return '';
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function synthesizeTrackStoreConfig(mainConf, trackConfig) {
|
|
438
|
+
// figure out what data store class to use with the track, applying some
|
|
439
|
+
// defaults if it is not explicit in the configuration
|
|
440
|
+
var _trackConfig$urlTempl = trackConfig.urlTemplate,
|
|
441
|
+
urlTemplate = _trackConfig$urlTempl === void 0 ? '' : _trackConfig$urlTempl;
|
|
442
|
+
var storeClass;
|
|
443
|
+
|
|
444
|
+
if (trackConfig.storeClass) {
|
|
445
|
+
storeClass = regularizeClass('JBrowse/Store', trackConfig.storeClass);
|
|
446
|
+
} else {
|
|
447
|
+
storeClass = guessStoreClass(trackConfig, urlTemplate);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (!storeClass) {
|
|
451
|
+
console.warn("Unable to determine an appropriate data store to use with track '".concat(trackConfig.label, "', please explicitly specify a storeClass in the configuration."));
|
|
452
|
+
return;
|
|
453
|
+
} // synthesize a separate store conf
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
var storeConf = _objectSpread(_objectSpread({}, trackConfig), {}, {
|
|
457
|
+
type: storeClass
|
|
458
|
+
}); // if this is the first sequence store we see, and we have no refseqs store
|
|
459
|
+
// defined explicitly, make this the refseqs store.
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
if ((storeClass === 'JBrowse/Store/Sequence/StaticChunked' || storeClass === 'JBrowse/Store/Sequence/IndexedFasta' || storeClass === 'JBrowse/Store/SeqFeature/IndexedFasta' || storeClass === 'JBrowse/Store/SeqFeature/BgzipIndexedFasta' || storeClass === 'JBrowse/Store/SeqFeature/TwoBit' || storeClass === 'JBrowse/Store/Sequence/TwoBit' || trackConfig.useAsRefSeqStore) && !(mainConf.stores && mainConf.stores.refseqs)) {
|
|
463
|
+
storeConf.name = 'refseqs';
|
|
464
|
+
} else {
|
|
465
|
+
storeConf.name = "store".concat((0, _util.objectHash)(storeConf));
|
|
466
|
+
} // record it
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
if (!mainConf.stores) {
|
|
470
|
+
mainConf.stores = {};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
mainConf.stores[storeConf.name] = storeConf; // connect it to the track conf
|
|
474
|
+
|
|
475
|
+
trackConfig.store = storeConf.name;
|
|
476
|
+
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { Track, RefSeqs } from './types';
|
|
2
|
-
interface Jb2Track {
|
|
3
|
-
trackId: string;
|
|
4
|
-
name: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
category?: string[];
|
|
7
|
-
adapter?: Jb2Adapter;
|
|
8
|
-
type?: string;
|
|
9
|
-
defaultRendering?: string;
|
|
10
|
-
}
|
|
11
|
-
interface Jb2Adapter {
|
|
12
|
-
type: string;
|
|
13
|
-
features?: Jb2Feature[];
|
|
14
|
-
bamLocation?: Jb2Location;
|
|
15
|
-
cramLocation?: Jb2Location;
|
|
16
|
-
craiLocation?: Jb2Location;
|
|
17
|
-
fastaLocation?: Jb2Location;
|
|
18
|
-
faiLocation?: Jb2Location;
|
|
19
|
-
gziLocation?: Jb2Location;
|
|
20
|
-
twoBitLocation?: Jb2Location;
|
|
21
|
-
bigWigLocation?: Jb2Location;
|
|
22
|
-
bigBedLocation?: Jb2Location;
|
|
23
|
-
vcfGzLocation?: Jb2Location;
|
|
24
|
-
gffGzLocation?: Jb2Location;
|
|
25
|
-
bedGzLocation?: Jb2Location;
|
|
26
|
-
index?: {
|
|
27
|
-
location: Jb2Location;
|
|
28
|
-
indexType?: string;
|
|
29
|
-
};
|
|
30
|
-
rootUrlTemplate?: Jb2Location;
|
|
31
|
-
sequenceAdapter?: Jb2Adapter;
|
|
32
|
-
}
|
|
33
|
-
interface Jb2Feature {
|
|
34
|
-
refName: string;
|
|
35
|
-
uniqueId: string;
|
|
36
|
-
start: number;
|
|
37
|
-
end: number;
|
|
38
|
-
}
|
|
39
|
-
interface Jb2Location {
|
|
40
|
-
uri?: string;
|
|
41
|
-
localPath?: string;
|
|
42
|
-
blobId?: string;
|
|
43
|
-
locationType?: string;
|
|
44
|
-
}
|
|
45
|
-
export declare function convertTrackConfig(jb1TrackConfig: Track, dataRoot: string, sequenceAdapter: Jb2Adapter): Jb2Track;
|
|
46
|
-
export declare function createRefSeqsAdapter(refSeqs: string | RefSeqs): Promise<Jb2Adapter>;
|
|
47
|
-
export {};
|
|
1
|
+
import { Track, RefSeqs } from './types';
|
|
2
|
+
interface Jb2Track {
|
|
3
|
+
trackId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
category?: string[];
|
|
7
|
+
adapter?: Jb2Adapter;
|
|
8
|
+
type?: string;
|
|
9
|
+
defaultRendering?: string;
|
|
10
|
+
}
|
|
11
|
+
interface Jb2Adapter {
|
|
12
|
+
type: string;
|
|
13
|
+
features?: Jb2Feature[];
|
|
14
|
+
bamLocation?: Jb2Location;
|
|
15
|
+
cramLocation?: Jb2Location;
|
|
16
|
+
craiLocation?: Jb2Location;
|
|
17
|
+
fastaLocation?: Jb2Location;
|
|
18
|
+
faiLocation?: Jb2Location;
|
|
19
|
+
gziLocation?: Jb2Location;
|
|
20
|
+
twoBitLocation?: Jb2Location;
|
|
21
|
+
bigWigLocation?: Jb2Location;
|
|
22
|
+
bigBedLocation?: Jb2Location;
|
|
23
|
+
vcfGzLocation?: Jb2Location;
|
|
24
|
+
gffGzLocation?: Jb2Location;
|
|
25
|
+
bedGzLocation?: Jb2Location;
|
|
26
|
+
index?: {
|
|
27
|
+
location: Jb2Location;
|
|
28
|
+
indexType?: string;
|
|
29
|
+
};
|
|
30
|
+
rootUrlTemplate?: Jb2Location;
|
|
31
|
+
sequenceAdapter?: Jb2Adapter;
|
|
32
|
+
}
|
|
33
|
+
interface Jb2Feature {
|
|
34
|
+
refName: string;
|
|
35
|
+
uniqueId: string;
|
|
36
|
+
start: number;
|
|
37
|
+
end: number;
|
|
38
|
+
}
|
|
39
|
+
interface Jb2Location {
|
|
40
|
+
uri?: string;
|
|
41
|
+
localPath?: string;
|
|
42
|
+
blobId?: string;
|
|
43
|
+
locationType?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare function convertTrackConfig(jb1TrackConfig: Track, dataRoot: string, sequenceAdapter: Jb2Adapter): Jb2Track;
|
|
46
|
+
export declare function createRefSeqsAdapter(refSeqs: string | RefSeqs): Promise<Jb2Adapter>;
|
|
47
|
+
export {};
|