@jbrowse/plugin-legacy-jbrowse 1.6.7 → 1.7.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.
@@ -0,0 +1,556 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.convertTrackConfig = convertTrackConfig;
9
+ exports.createRefSeqsAdapter = createRefSeqsAdapter;
10
+
11
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
12
+
13
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
14
+
15
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
+
17
+ var _io = require("@jbrowse/core/util/io");
18
+
19
+ var _util = require("@jbrowse/core/util");
20
+
21
+ var _tracks = require("@jbrowse/core/util/tracks");
22
+
23
+ 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; }
24
+
25
+ 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; }
26
+
27
+ function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
28
+ var jb2TrackConfig = {
29
+ trackId: (0, _util.objectHash)(jb1TrackConfig),
30
+ name: jb1TrackConfig.key || jb1TrackConfig.label
31
+ };
32
+ var description = jb1TrackConfig.metadata && (jb1TrackConfig.metadata.description || jb1TrackConfig.metadata.Description);
33
+
34
+ if (description) {
35
+ jb2TrackConfig.description = description;
36
+ }
37
+
38
+ var category = jb1TrackConfig.category || jb1TrackConfig.metadata && jb1TrackConfig.metadata.category;
39
+ jb2TrackConfig.category = category ? category.split(/\s*\/\s*/) : [];
40
+ var storeClass = jb1TrackConfig.storeClass;
41
+
42
+ if (!jb1TrackConfig.urlTemplate) {
43
+ if (!(storeClass && storeClass.endsWith('FromConfig'))) {
44
+ var trackIdentifier = jb1TrackConfig.key || jb1TrackConfig.label;
45
+ console.warn("Could not import JBrowse1 track \"".concat(trackIdentifier, "\" because it does not have a \"urlTemplate\" or is not a \"FromConfig\" track"));
46
+ return (0, _tracks.generateUnsupportedTrackConf)(jb2TrackConfig.name, trackIdentifier, jb2TrackConfig.category);
47
+ }
48
+
49
+ return generateFromConfigTrackConfig(jb1TrackConfig, jb2TrackConfig);
50
+ }
51
+
52
+ var resolveUrlTemplate = function resolveUrlTemplate(urlTemplate) {
53
+ return new URL(urlTemplate, "".concat(dataRoot, "/")).href.replace(/%7B/gi, '{').replace(/%7D/gi, '}');
54
+ };
55
+
56
+ var urlTemplate = resolveUrlTemplate(jb1TrackConfig.urlTemplate);
57
+
58
+ if (storeClass) {
59
+ if (storeClass === 'JBrowse/Store/SeqFeature/BAM') {
60
+ var adapter = {
61
+ type: 'BamAdapter',
62
+ bamLocation: {
63
+ uri: urlTemplate,
64
+ locationType: 'UriLocation'
65
+ }
66
+ };
67
+
68
+ if (jb1TrackConfig.baiUrlTemplate) {
69
+ adapter.index = {
70
+ location: {
71
+ uri: resolveUrlTemplate(jb1TrackConfig.baiUrlTemplate),
72
+ locationType: 'UriLocation'
73
+ }
74
+ };
75
+ } else if (jb1TrackConfig.csiUrlTemplate) {
76
+ adapter.index = {
77
+ location: {
78
+ uri: resolveUrlTemplate(jb1TrackConfig.csiUrlTemplate),
79
+ locationType: 'UriLocation'
80
+ },
81
+ indexType: 'CSI'
82
+ };
83
+ } else {
84
+ adapter.index = {
85
+ location: {
86
+ uri: "".concat(urlTemplate, ".bai"),
87
+ locationType: 'UriLocation'
88
+ }
89
+ };
90
+ }
91
+
92
+ return _objectSpread(_objectSpread({}, jb2TrackConfig), {}, {
93
+ type: 'AlignmentsTrack',
94
+ adapter: adapter
95
+ });
96
+ }
97
+
98
+ if (storeClass === 'JBrowse/Store/SeqFeature/CRAM') {
99
+ var _adapter = {
100
+ type: 'CramAdapter',
101
+ cramLocation: {
102
+ uri: urlTemplate,
103
+ locationType: 'UriLocation'
104
+ },
105
+ sequenceAdapter: sequenceAdapter
106
+ };
107
+
108
+ if (jb1TrackConfig.craiUrlTemplate) {
109
+ _adapter.craiLocation = {
110
+ uri: resolveUrlTemplate(jb1TrackConfig.craiUrlTemplate),
111
+ locationType: 'UriLocation'
112
+ };
113
+ } else {
114
+ _adapter.craiLocation = {
115
+ uri: "".concat(urlTemplate, ".crai"),
116
+ locationType: 'UriLocation'
117
+ };
118
+ }
119
+
120
+ return _objectSpread(_objectSpread({}, jb2TrackConfig), {}, {
121
+ type: 'AlignmentsTrack',
122
+ adapter: _adapter
123
+ });
124
+ }
125
+
126
+ if (storeClass === 'JBrowse/Store/SeqFeature/NCList') {
127
+ return _objectSpread(_objectSpread({}, jb2TrackConfig), {}, {
128
+ type: 'FeatureTrack',
129
+ adapter: {
130
+ type: 'NCListAdapter',
131
+ rootUrlTemplate: {
132
+ uri: urlTemplate,
133
+ locationType: 'UriLocation'
134
+ }
135
+ }
136
+ });
137
+ }
138
+
139
+ if (storeClass === 'JBrowse/Store/SeqFeature/BigWig' || storeClass === 'JBrowse/Store/BigWig') {
140
+ if (jb1TrackConfig.type && jb1TrackConfig.type.endsWith('XYPlot')) {
141
+ jb2TrackConfig.defaultRendering = 'xyplot';
142
+ } else if (jb1TrackConfig.type && jb1TrackConfig.type.endsWith('Density')) {
143
+ jb2TrackConfig.defaultRendering = 'density';
144
+ }
145
+
146
+ return _objectSpread(_objectSpread({}, jb2TrackConfig), {}, {
147
+ type: 'QuantitativeTrack',
148
+ adapter: {
149
+ type: 'BigWigAdapter',
150
+ bigWigLocation: {
151
+ uri: urlTemplate,
152
+ locationType: 'UriLocation'
153
+ }
154
+ }
155
+ });
156
+ }
157
+
158
+ if (storeClass === 'JBrowse/Store/SeqFeature/VCFTabix') {
159
+ var _adapter2 = {
160
+ type: 'VcfTabixAdapter',
161
+ vcfGzLocation: {
162
+ uri: urlTemplate,
163
+ locationType: 'UriLocation'
164
+ }
165
+ };
166
+
167
+ if (jb1TrackConfig.tbiUrlTemplate) {
168
+ _adapter2.index = {
169
+ location: {
170
+ uri: resolveUrlTemplate(jb1TrackConfig.tbiUrlTemplate),
171
+ locationType: 'UriLocation'
172
+ }
173
+ };
174
+ } else if (jb1TrackConfig.csiUrlTemplate) {
175
+ _adapter2.index = {
176
+ location: {
177
+ uri: resolveUrlTemplate(jb1TrackConfig.csiUrlTemplate),
178
+ locationType: 'UriLocation'
179
+ },
180
+ indexType: 'CSI'
181
+ };
182
+ } else {
183
+ _adapter2.index = {
184
+ location: {
185
+ uri: "".concat(urlTemplate, ".tbi"),
186
+ locationType: 'UriLocation'
187
+ }
188
+ };
189
+ }
190
+
191
+ return _objectSpread(_objectSpread({}, jb2TrackConfig), {}, {
192
+ type: 'VariantTrack',
193
+ adapter: _adapter2
194
+ });
195
+ }
196
+
197
+ if (storeClass === 'JBrowse/Store/SeqFeature/VCFTribble') {
198
+ return (0, _tracks.generateUnsupportedTrackConf)(jb2TrackConfig.name, "VCFTribble (".concat(urlTemplate, ")"), jb2TrackConfig.category);
199
+ }
200
+
201
+ if (storeClass === 'JBrowse/Store/SeqFeature/GFF3') {
202
+ return (0, _tracks.generateUnsupportedTrackConf)(jb2TrackConfig.name, "GFF3 (".concat(urlTemplate, ")"), jb2TrackConfig.category);
203
+ }
204
+
205
+ if (storeClass === 'JBrowse/Store/SeqFeature/BigBed') {
206
+ return _objectSpread(_objectSpread({}, jb2TrackConfig), {}, {
207
+ type: 'FeatureTrack',
208
+ adapter: {
209
+ type: 'BigBedAdapter',
210
+ bigBedLocation: {
211
+ uri: urlTemplate,
212
+ locationType: 'UriLocation'
213
+ }
214
+ }
215
+ });
216
+ }
217
+
218
+ if (storeClass === 'JBrowse/Store/SeqFeature/GFF3Tabix') {
219
+ var _adapter3 = {
220
+ type: 'Gff3TabixAdapter',
221
+ gffGzLocation: {
222
+ uri: urlTemplate,
223
+ locationType: 'UriLocation'
224
+ }
225
+ };
226
+
227
+ if (jb1TrackConfig.tbiUrlTemplate) {
228
+ _adapter3.index = {
229
+ location: {
230
+ uri: resolveUrlTemplate(jb1TrackConfig.tbiUrlTemplate),
231
+ locationType: 'UriLocation'
232
+ }
233
+ };
234
+ } else if (jb1TrackConfig.csiUrlTemplate) {
235
+ _adapter3.index = {
236
+ location: {
237
+ uri: resolveUrlTemplate(jb1TrackConfig.csiUrlTemplate),
238
+ locationType: 'UriLocation'
239
+ },
240
+ indexType: 'CSI'
241
+ };
242
+ } else {
243
+ _adapter3.index = {
244
+ location: {
245
+ uri: "".concat(urlTemplate, ".tbi"),
246
+ locationType: 'UriLocation'
247
+ }
248
+ };
249
+ }
250
+
251
+ return _objectSpread(_objectSpread({}, jb2TrackConfig), {}, {
252
+ type: 'FeatureTrack',
253
+ adapter: _adapter3
254
+ });
255
+ }
256
+
257
+ if (storeClass === 'JBrowse/Store/SeqFeature/BED') {
258
+ return (0, _tracks.generateUnsupportedTrackConf)(jb2TrackConfig.name, "BED (".concat(urlTemplate, ")"), jb2TrackConfig.category);
259
+ }
260
+
261
+ if (storeClass === 'JBrowse/Store/SeqFeature/BEDTabix') {
262
+ var _adapter4 = {
263
+ type: 'BedTabixAdapter',
264
+ bedGzLocation: {
265
+ uri: urlTemplate,
266
+ locationType: 'UriLocation'
267
+ }
268
+ };
269
+
270
+ if (jb1TrackConfig.tbiUrlTemplate) {
271
+ _adapter4.index = {
272
+ location: {
273
+ uri: resolveUrlTemplate(jb1TrackConfig.tbiUrlTemplate),
274
+ locationType: 'UriLocation'
275
+ }
276
+ };
277
+ } else if (jb1TrackConfig.csiUrlTemplate) {
278
+ _adapter4.index = {
279
+ location: {
280
+ uri: resolveUrlTemplate(jb1TrackConfig.csiUrlTemplate),
281
+ locationType: 'UriLocation'
282
+ },
283
+ indexType: 'CSI'
284
+ };
285
+ } else {
286
+ _adapter4.index = {
287
+ location: {
288
+ uri: "".concat(urlTemplate, ".tbi"),
289
+ locationType: 'UriLocation'
290
+ }
291
+ };
292
+ }
293
+
294
+ return _objectSpread(_objectSpread({}, jb2TrackConfig), {}, {
295
+ type: 'FeatureTrack',
296
+ adapter: _adapter4
297
+ });
298
+ }
299
+
300
+ if (storeClass === 'JBrowse/Store/SeqFeature/GTF') {
301
+ return (0, _tracks.generateUnsupportedTrackConf)(jb2TrackConfig.name, "GTF (".concat(urlTemplate, ")"), jb2TrackConfig.category);
302
+ }
303
+
304
+ if (storeClass === 'JBrowse/Store/SeqFeature/StaticChunked' || storeClass === 'JBrowse/Store/Sequence/StaticChunked') {
305
+ return (0, _tracks.generateUnsupportedTrackConf)(jb2TrackConfig.name, "StaticChunked (".concat(urlTemplate, ")"), jb2TrackConfig.category);
306
+ }
307
+
308
+ if (storeClass === 'JBrowse/Store/SeqFeature/UnindexedFasta') {
309
+ return (0, _tracks.generateUnsupportedTrackConf)(jb2TrackConfig.name, "UnindexedFasta (".concat(urlTemplate, ")"), jb2TrackConfig.category);
310
+ }
311
+
312
+ if (storeClass === 'JBrowse/Store/SeqFeature/IndexedFasta') {
313
+ var _adapter5 = {
314
+ type: 'IndexedFastaAdapter',
315
+ fastaLocation: {
316
+ uri: urlTemplate,
317
+ locationType: 'UriLocation'
318
+ }
319
+ };
320
+
321
+ if (jb1TrackConfig.faiUrlTemplate) {
322
+ _adapter5.faiLocation = {
323
+ uri: resolveUrlTemplate(jb1TrackConfig.faiUrlTemplate),
324
+ locationType: 'UriLocation'
325
+ };
326
+ } else {
327
+ _adapter5.faiLocation = {
328
+ uri: "".concat(urlTemplate, ".fai"),
329
+ locationType: 'UriLocation'
330
+ };
331
+ }
332
+
333
+ return _objectSpread(_objectSpread({}, jb2TrackConfig), {}, {
334
+ type: 'SequenceTrack',
335
+ adapter: _adapter5
336
+ });
337
+ }
338
+
339
+ if (storeClass === 'JBrowse/Store/SeqFeature/BgzipIndexedFasta') {
340
+ var _adapter6 = {
341
+ type: 'BgzipFastaAdapter',
342
+ fastaLocation: {
343
+ uri: urlTemplate,
344
+ locationType: 'UriLocation'
345
+ }
346
+ };
347
+
348
+ if (jb1TrackConfig.faiUrlTemplate) {
349
+ _adapter6.faiLocation = {
350
+ uri: resolveUrlTemplate(jb1TrackConfig.faiUrlTemplate),
351
+ locationType: 'UriLocation'
352
+ };
353
+ } else {
354
+ _adapter6.faiLocation = {
355
+ uri: "".concat(urlTemplate, ".fai"),
356
+ locationType: 'UriLocation'
357
+ };
358
+ }
359
+
360
+ if (jb1TrackConfig.gziUrlTemplate) {
361
+ _adapter6.gziLocation = {
362
+ uri: resolveUrlTemplate(jb1TrackConfig.gziUrlTemplate),
363
+ locationType: 'UriLocation'
364
+ };
365
+ } else {
366
+ _adapter6.gziLocation = {
367
+ uri: "".concat(urlTemplate, ".gzi"),
368
+ locationType: 'UriLocation'
369
+ };
370
+ }
371
+
372
+ return _objectSpread(_objectSpread({}, jb2TrackConfig), {}, {
373
+ type: 'ReferenceSequenceTrack',
374
+ adapter: _adapter6
375
+ });
376
+ }
377
+
378
+ if (storeClass === 'JBrowse/Store/SeqFeature/TwoBit') {
379
+ return _objectSpread(_objectSpread({}, jb2TrackConfig), {}, {
380
+ type: 'ReferenceSequenceTrack',
381
+ adapter: {
382
+ type: 'TwoBitAdapter',
383
+ twoBitLocation: {
384
+ uri: urlTemplate,
385
+ locationType: 'UriLocation'
386
+ }
387
+ }
388
+ });
389
+ }
390
+ } // If we don't recogize the store class, make a best effort to guess by file type
391
+
392
+
393
+ jb2TrackConfig.adapter = (0, _tracks.guessAdapter)({
394
+ uri: urlTemplate,
395
+ locationType: 'UriLocation'
396
+ }, undefined, urlTemplate);
397
+
398
+ if (!jb2TrackConfig.adapter) {
399
+ throw new Error('Could not determine adapter');
400
+ }
401
+
402
+ if (jb2TrackConfig.adapter.type === _tracks.UNSUPPORTED) {
403
+ return (0, _tracks.generateUnsupportedTrackConf)(jb2TrackConfig.name, urlTemplate, jb2TrackConfig.category);
404
+ }
405
+
406
+ if (jb2TrackConfig.adapter.type === _tracks.UNKNOWN) {
407
+ return (0, _tracks.generateUnknownTrackConf)(jb2TrackConfig.name, urlTemplate, jb2TrackConfig.category);
408
+ }
409
+
410
+ jb2TrackConfig.type = (0, _tracks.guessTrackType)(jb2TrackConfig.adapter.type);
411
+
412
+ if (jb2TrackConfig.type === 'QuantitativeTrack') {
413
+ if (jb1TrackConfig.type && jb1TrackConfig.type.endsWith('XYPlot')) {
414
+ jb2TrackConfig.defaultRendering = 'xyplot';
415
+ } else if (jb1TrackConfig.type && jb1TrackConfig.type.endsWith('Density')) {
416
+ jb2TrackConfig.defaultRendering = 'density';
417
+ }
418
+ }
419
+
420
+ return jb2TrackConfig;
421
+ }
422
+
423
+ function generateFromConfigTrackConfig(jb1TrackConfig, jb2TrackConfig) {
424
+ var jb1Features = jb1TrackConfig.features || [];
425
+ var jb2Features = jb1Features.map(function (feature) {
426
+ var jb2Feature = JSON.parse(JSON.stringify(feature));
427
+ jb2Feature.refName = feature.seq_id;
428
+ jb2Feature.uniqueId = "".concat(feature.seq_id, ":").concat(feature.start, "-").concat(feature.end, ":").concat(feature.name || '');
429
+ return jb2Feature;
430
+ });
431
+ jb2TrackConfig.adapter = {
432
+ type: 'FromConfigAdapter',
433
+ features: jb2Features
434
+ };
435
+ jb2TrackConfig.type = 'FeatureTrack';
436
+ return jb2TrackConfig;
437
+ }
438
+
439
+ function createRefSeqsAdapter(_x) {
440
+ return _createRefSeqsAdapter.apply(this, arguments);
441
+ }
442
+
443
+ function _createRefSeqsAdapter() {
444
+ _createRefSeqsAdapter = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(refSeqs) {
445
+ var refSeqsJson, refSeqsData;
446
+ return _regenerator["default"].wrap(function _callee$(_context) {
447
+ while (1) {
448
+ switch (_context.prev = _context.next) {
449
+ case 0:
450
+ if (typeof refSeqs === 'string') {
451
+ // assume refSeqs is a url if it is string
452
+ refSeqs = {
453
+ url: refSeqs
454
+ };
455
+ } // check refseq urls
456
+
457
+
458
+ if (!refSeqs.url) {
459
+ _context.next = 15;
460
+ break;
461
+ }
462
+
463
+ if (!refSeqs.url.match(/.fai$/)) {
464
+ _context.next = 4;
465
+ break;
466
+ }
467
+
468
+ return _context.abrupt("return", {
469
+ type: 'IndexedFastaAdapter',
470
+ fastaLocation: {
471
+ uri: refSeqs.url.slice(0, -4),
472
+ locationType: 'UriLocation'
473
+ },
474
+ faiLocation: {
475
+ uri: refSeqs.url,
476
+ locationType: 'UriLocation'
477
+ }
478
+ });
479
+
480
+ case 4:
481
+ if (!refSeqs.url.match(/.2bit$/)) {
482
+ _context.next = 6;
483
+ break;
484
+ }
485
+
486
+ return _context.abrupt("return", {
487
+ type: 'TwoBitAdapter',
488
+ twoBitLocation: {
489
+ uri: refSeqs.url,
490
+ locationType: 'UriLocation'
491
+ }
492
+ });
493
+
494
+ case 6:
495
+ if (!refSeqs.url.match(/.fa$/)) {
496
+ _context.next = 8;
497
+ break;
498
+ }
499
+
500
+ throw new Error('Unindexed FASTA adapter not available');
501
+
502
+ case 8:
503
+ if (!refSeqs.url.match(/.sizes/)) {
504
+ _context.next = 10;
505
+ break;
506
+ }
507
+
508
+ throw new Error('chromosome SIZES adapter not available');
509
+
510
+ case 10:
511
+ _context.next = 12;
512
+ return (0, _io.openLocation)({
513
+ uri: refSeqs.url,
514
+ locationType: 'UriLocation'
515
+ }).readFile('utf8');
516
+
517
+ case 12:
518
+ refSeqsJson = _context.sent;
519
+ refSeqsData = JSON.parse(refSeqsJson);
520
+ return _context.abrupt("return", refSeqAdapterFromConfig(refSeqsData));
521
+
522
+ case 15:
523
+ if (!('data' in refSeqs)) {
524
+ _context.next = 17;
525
+ break;
526
+ }
527
+
528
+ return _context.abrupt("return", refSeqAdapterFromConfig(refSeqs.data || []));
529
+
530
+ case 17:
531
+ throw new Error("Could not determine adapter for JBrowse1 refSeqs: ".concat(refSeqs.url || JSON.stringify(refSeqs)));
532
+
533
+ case 18:
534
+ case "end":
535
+ return _context.stop();
536
+ }
537
+ }
538
+ }, _callee);
539
+ }));
540
+ return _createRefSeqsAdapter.apply(this, arguments);
541
+ }
542
+
543
+ function refSeqAdapterFromConfig(refSeqsData) {
544
+ var features = refSeqsData.map(function (refSeq) {
545
+ return {
546
+ refName: refSeq.name,
547
+ uniqueId: refSeq.name,
548
+ start: refSeq.start,
549
+ end: refSeq.end
550
+ };
551
+ });
552
+ return {
553
+ type: 'FromConfigAdapter',
554
+ features: features
555
+ };
556
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = _default;
9
+
10
+ var _configuration = require("@jbrowse/core/configuration");
11
+
12
+ var _util = require("@jbrowse/core/util");
13
+
14
+ var _models = require("@jbrowse/core/pluggableElementTypes/models");
15
+
16
+ var _mobxStateTree = require("mobx-state-tree");
17
+
18
+ var _configSchema = _interopRequireDefault(require("./configSchema"));
19
+
20
+ var _jb1ConfigLoad = require("./jb1ConfigLoad");
21
+
22
+ var _jb1ToJb = require("./jb1ToJb2");
23
+
24
+ function _default(pluginManager) {
25
+ return _mobxStateTree.types.compose('JBrowse1Connection', (0, _models.BaseConnectionModelFactory)(pluginManager), _mobxStateTree.types.model({
26
+ configuration: (0, _configuration.ConfigurationReference)(_configSchema["default"]),
27
+ type: _mobxStateTree.types.literal('JBrowse1Connection')
28
+ }).actions(function (self) {
29
+ return {
30
+ connect: function connect() {
31
+ var dataDirLocation = (0, _configuration.readConfObject)(self.configuration, 'dataDirLocation');
32
+ var session = (0, _util.getSession)(self);
33
+ (0, _jb1ConfigLoad.fetchJb1)(dataDirLocation).then(function (config) {
34
+ var assemblyName = (0, _configuration.readConfObject)(self.configuration, 'assemblyNames')[0];
35
+
36
+ if (!assemblyName) {
37
+ throw new Error('assembly name required for JBrowse 1 connection');
38
+ }
39
+
40
+ var assemblyConf = session.assemblies.find(function (assembly) {
41
+ return (0, _configuration.readConfObject)(assembly, 'name') === assemblyName;
42
+ });
43
+ var sequenceAdapter = (0, _configuration.readConfObject)(assemblyConf, ['sequence', 'adapter']);
44
+ var jb2Tracks = config.tracks.map(function (jb1Track) {
45
+ var jb2Track = (0, _jb1ToJb.convertTrackConfig)(jb1Track, config.dataRoot, sequenceAdapter);
46
+ jb2Track.assemblyNames = [assemblyName];
47
+ return jb2Track;
48
+ });
49
+ self.setTrackConfs(jb2Tracks);
50
+ })["catch"](function (error) {
51
+ console.error(error);
52
+ session.notify("There was a problem connecting to the JBrowse 1 data directory \"".concat(self.name, "\". Please make sure you have entered a valid location. The error that was thrown is: \"").concat(error, "\""), 'error');
53
+ session.breakConnection(self.configuration);
54
+ });
55
+ }
56
+ };
57
+ }));
58
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });