@jbrowse/plugin-legacy-jbrowse 3.6.5 → 4.0.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.
Files changed (62) hide show
  1. package/esm/JBrowse1Connection/configSchema.d.ts +3 -3
  2. package/esm/JBrowse1Connection/get-value.d.ts +10 -0
  3. package/esm/JBrowse1Connection/get-value.js +84 -0
  4. package/esm/JBrowse1Connection/index.js +2 -2
  5. package/esm/JBrowse1Connection/jb1ConfigLoad.d.ts +1 -1
  6. package/esm/JBrowse1Connection/jb1ConfigLoad.js +2 -2
  7. package/esm/JBrowse1Connection/jb1ConfigParse.d.ts +1 -1
  8. package/esm/JBrowse1Connection/jb1ConfigParse.js +12 -10
  9. package/esm/JBrowse1Connection/jb1ToJb2.d.ts +2 -3
  10. package/esm/JBrowse1Connection/jb1ToJb2.js +43 -45
  11. package/esm/JBrowse1Connection/model.d.ts +16 -24
  12. package/esm/JBrowse1Connection/model.js +8 -14
  13. package/esm/JBrowse1Connection/util.d.ts +1 -1
  14. package/esm/JBrowse1Connection/util.js +13 -3
  15. package/esm/JBrowse1TextSearchAdapter/HttpMap.js +16 -1
  16. package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +1 -1
  17. package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +3 -1
  18. package/esm/JBrowse1TextSearchAdapter/configSchema.d.ts +2 -2
  19. package/esm/JBrowse1TextSearchAdapter/index.js +2 -2
  20. package/esm/NCListAdapter/NCListAdapter.d.ts +1 -1
  21. package/esm/NCListAdapter/NCListAdapter.js +6 -5
  22. package/esm/NCListAdapter/NCListFeature.js +3 -0
  23. package/esm/NCListAdapter/configSchema.d.ts +2 -2
  24. package/esm/NCListAdapter/index.js +2 -2
  25. package/esm/index.js +5 -8
  26. package/package.json +25 -33
  27. package/dist/GuessNCList/index.d.ts +0 -2
  28. package/dist/GuessNCList/index.js +0 -18
  29. package/dist/JBrowse1Connection/configSchema.d.ts +0 -27
  30. package/dist/JBrowse1Connection/configSchema.js +0 -23
  31. package/dist/JBrowse1Connection/index.d.ts +0 -2
  32. package/dist/JBrowse1Connection/index.js +0 -19
  33. package/dist/JBrowse1Connection/jb1ConfigLoad.d.ts +0 -36
  34. package/dist/JBrowse1Connection/jb1ConfigLoad.js +0 -253
  35. package/dist/JBrowse1Connection/jb1ConfigParse.d.ts +0 -4
  36. package/dist/JBrowse1Connection/jb1ConfigParse.js +0 -341
  37. package/dist/JBrowse1Connection/jb1ToJb2.d.ts +0 -49
  38. package/dist/JBrowse1Connection/jb1ToJb2.js +0 -408
  39. package/dist/JBrowse1Connection/model.d.ts +0 -75
  40. package/dist/JBrowse1Connection/model.js +0 -82
  41. package/dist/JBrowse1Connection/types.d.ts +0 -91
  42. package/dist/JBrowse1Connection/types.js +0 -2
  43. package/dist/JBrowse1Connection/util.d.ts +0 -8
  44. package/dist/JBrowse1Connection/util.js +0 -86
  45. package/dist/JBrowse1TextSearchAdapter/HttpMap.d.ts +0 -19
  46. package/dist/JBrowse1TextSearchAdapter/HttpMap.js +0 -65
  47. package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +0 -28
  48. package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +0 -58
  49. package/dist/JBrowse1TextSearchAdapter/configSchema.d.ts +0 -21
  50. package/dist/JBrowse1TextSearchAdapter/configSchema.js +0 -24
  51. package/dist/JBrowse1TextSearchAdapter/index.d.ts +0 -2
  52. package/dist/JBrowse1TextSearchAdapter/index.js +0 -49
  53. package/dist/NCListAdapter/NCListAdapter.d.ts +0 -17
  54. package/dist/NCListAdapter/NCListAdapter.js +0 -48
  55. package/dist/NCListAdapter/NCListFeature.d.ts +0 -16
  56. package/dist/NCListAdapter/NCListFeature.js +0 -58
  57. package/dist/NCListAdapter/configSchema.d.ts +0 -15
  58. package/dist/NCListAdapter/configSchema.js +0 -21
  59. package/dist/NCListAdapter/index.d.ts +0 -2
  60. package/dist/NCListAdapter/index.js +0 -52
  61. package/dist/index.d.ts +0 -6
  62. package/dist/index.js +0 -23
@@ -1,408 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertTrackConfig = convertTrackConfig;
4
- exports.createRefSeqsAdapter = createRefSeqsAdapter;
5
- const util_1 = require("@jbrowse/core/util");
6
- const io_1 = require("@jbrowse/core/util/io");
7
- const tracks_1 = require("@jbrowse/core/util/tracks");
8
- function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
9
- var _a, _b, _c, _d, _e;
10
- const jb2TrackConfig = {
11
- trackId: (0, util_1.objectHash)(jb1TrackConfig),
12
- name: jb1TrackConfig.key || jb1TrackConfig.label,
13
- };
14
- const description = jb1TrackConfig.metadata &&
15
- (jb1TrackConfig.metadata.description || jb1TrackConfig.metadata.Description);
16
- if (description) {
17
- jb2TrackConfig.description = description;
18
- }
19
- const category = jb1TrackConfig.category || ((_a = jb1TrackConfig.metadata) === null || _a === void 0 ? void 0 : _a.category);
20
- jb2TrackConfig.category = category ? category.split(/\s*\/\s*/) : [];
21
- const { storeClass } = jb1TrackConfig;
22
- if (!jb1TrackConfig.urlTemplate) {
23
- if (!(storeClass === null || storeClass === void 0 ? void 0 : storeClass.endsWith('FromConfig'))) {
24
- const trackIdentifier = jb1TrackConfig.key || jb1TrackConfig.label;
25
- console.warn(`Could not import JBrowse1 track "${trackIdentifier}" because it does not have a "urlTemplate" or is not a "FromConfig" track`);
26
- return (0, tracks_1.generateUnsupportedTrackConf)(jb2TrackConfig.name, trackIdentifier, jb2TrackConfig.category);
27
- }
28
- return generateFromConfigTrackConfig(jb1TrackConfig, jb2TrackConfig);
29
- }
30
- const resolveUrlTemplate = (urlTemplate) => {
31
- return new URL(urlTemplate, `${dataRoot}/`).href
32
- .replaceAll(/%7B/gi, '{')
33
- .replaceAll(/%7D/gi, '}');
34
- };
35
- const urlTemplate = resolveUrlTemplate(jb1TrackConfig.urlTemplate);
36
- if (storeClass) {
37
- if (storeClass === 'JBrowse/Store/SeqFeature/BAM') {
38
- const adapter = {
39
- type: 'BamAdapter',
40
- bamLocation: { uri: urlTemplate, locationType: 'UriLocation' },
41
- };
42
- if (jb1TrackConfig.baiUrlTemplate) {
43
- adapter.index = {
44
- location: {
45
- uri: resolveUrlTemplate(jb1TrackConfig.baiUrlTemplate),
46
- locationType: 'UriLocation',
47
- },
48
- };
49
- }
50
- else if (jb1TrackConfig.csiUrlTemplate) {
51
- adapter.index = {
52
- location: {
53
- uri: resolveUrlTemplate(jb1TrackConfig.csiUrlTemplate),
54
- locationType: 'UriLocation',
55
- },
56
- indexType: 'CSI',
57
- };
58
- }
59
- else {
60
- adapter.index = {
61
- location: { uri: `${urlTemplate}.bai`, locationType: 'UriLocation' },
62
- };
63
- }
64
- return {
65
- ...jb2TrackConfig,
66
- type: 'AlignmentsTrack',
67
- adapter,
68
- };
69
- }
70
- if (storeClass === 'JBrowse/Store/SeqFeature/CRAM') {
71
- const adapter = {
72
- type: 'CramAdapter',
73
- cramLocation: { uri: urlTemplate, locationType: 'UriLocation' },
74
- sequenceAdapter,
75
- };
76
- adapter.craiLocation = jb1TrackConfig.craiUrlTemplate
77
- ? {
78
- uri: resolveUrlTemplate(jb1TrackConfig.craiUrlTemplate),
79
- locationType: 'UriLocation',
80
- }
81
- : {
82
- uri: `${urlTemplate}.crai`,
83
- locationType: 'UriLocation',
84
- };
85
- return {
86
- ...jb2TrackConfig,
87
- type: 'AlignmentsTrack',
88
- adapter,
89
- };
90
- }
91
- if (storeClass === 'JBrowse/Store/SeqFeature/NCList') {
92
- return {
93
- ...jb2TrackConfig,
94
- type: 'FeatureTrack',
95
- adapter: {
96
- type: 'NCListAdapter',
97
- rootUrlTemplate: { uri: urlTemplate, locationType: 'UriLocation' },
98
- },
99
- };
100
- }
101
- if (storeClass === 'JBrowse/Store/SeqFeature/BigWig' ||
102
- storeClass === 'JBrowse/Store/BigWig') {
103
- if ((_b = jb1TrackConfig.type) === null || _b === void 0 ? void 0 : _b.endsWith('XYPlot')) {
104
- jb2TrackConfig.defaultRendering = 'xyplot';
105
- }
106
- else if ((_c = jb1TrackConfig.type) === null || _c === void 0 ? void 0 : _c.endsWith('Density')) {
107
- jb2TrackConfig.defaultRendering = 'density';
108
- }
109
- return {
110
- ...jb2TrackConfig,
111
- type: 'QuantitativeTrack',
112
- adapter: {
113
- type: 'BigWigAdapter',
114
- bigWigLocation: { uri: urlTemplate, locationType: 'UriLocation' },
115
- },
116
- };
117
- }
118
- if (storeClass === 'JBrowse/Store/SeqFeature/VCFTabix') {
119
- const adapter = {
120
- type: 'VcfTabixAdapter',
121
- vcfGzLocation: { uri: urlTemplate, locationType: 'UriLocation' },
122
- };
123
- if (jb1TrackConfig.tbiUrlTemplate) {
124
- adapter.index = {
125
- location: {
126
- uri: resolveUrlTemplate(jb1TrackConfig.tbiUrlTemplate),
127
- locationType: 'UriLocation',
128
- },
129
- };
130
- }
131
- else if (jb1TrackConfig.csiUrlTemplate) {
132
- adapter.index = {
133
- location: {
134
- uri: resolveUrlTemplate(jb1TrackConfig.csiUrlTemplate),
135
- locationType: 'UriLocation',
136
- },
137
- indexType: 'CSI',
138
- };
139
- }
140
- else {
141
- adapter.index = {
142
- location: { uri: `${urlTemplate}.tbi`, locationType: 'UriLocation' },
143
- };
144
- }
145
- return {
146
- ...jb2TrackConfig,
147
- type: 'VariantTrack',
148
- adapter,
149
- };
150
- }
151
- if (storeClass === 'JBrowse/Store/SeqFeature/VCFTribble') {
152
- return (0, tracks_1.generateUnsupportedTrackConf)(jb2TrackConfig.name, `VCFTribble (${urlTemplate})`, jb2TrackConfig.category);
153
- }
154
- if (storeClass === 'JBrowse/Store/SeqFeature/GFF3') {
155
- return {
156
- ...jb2TrackConfig,
157
- type: 'FeatureTrack',
158
- adapter: {
159
- type: 'Gff3Adapter',
160
- gffLocation: { uri: urlTemplate, locationType: 'UriLocation' },
161
- },
162
- };
163
- }
164
- if (storeClass === 'JBrowse/Store/SeqFeature/BigBed') {
165
- return {
166
- ...jb2TrackConfig,
167
- type: 'FeatureTrack',
168
- adapter: {
169
- type: 'BigBedAdapter',
170
- bigBedLocation: { uri: urlTemplate, locationType: 'UriLocation' },
171
- },
172
- };
173
- }
174
- if (storeClass === 'JBrowse/Store/SeqFeature/GFF3Tabix') {
175
- const adapter = {
176
- type: 'Gff3TabixAdapter',
177
- gffGzLocation: { uri: urlTemplate, locationType: 'UriLocation' },
178
- };
179
- if (jb1TrackConfig.tbiUrlTemplate) {
180
- adapter.index = {
181
- location: {
182
- uri: resolveUrlTemplate(jb1TrackConfig.tbiUrlTemplate),
183
- locationType: 'UriLocation',
184
- },
185
- };
186
- }
187
- else if (jb1TrackConfig.csiUrlTemplate) {
188
- adapter.index = {
189
- location: {
190
- uri: resolveUrlTemplate(jb1TrackConfig.csiUrlTemplate),
191
- locationType: 'UriLocation',
192
- },
193
- indexType: 'CSI',
194
- };
195
- }
196
- else {
197
- adapter.index = {
198
- location: { uri: `${urlTemplate}.tbi`, locationType: 'UriLocation' },
199
- };
200
- }
201
- return {
202
- ...jb2TrackConfig,
203
- type: 'FeatureTrack',
204
- adapter,
205
- };
206
- }
207
- if (storeClass === 'JBrowse/Store/SeqFeature/BED') {
208
- return (0, tracks_1.generateUnsupportedTrackConf)(jb2TrackConfig.name, `BED (${urlTemplate})`, jb2TrackConfig.category);
209
- }
210
- if (storeClass === 'JBrowse/Store/SeqFeature/BEDTabix') {
211
- const adapter = {
212
- type: 'BedTabixAdapter',
213
- bedGzLocation: { uri: urlTemplate, locationType: 'UriLocation' },
214
- };
215
- if (jb1TrackConfig.tbiUrlTemplate) {
216
- adapter.index = {
217
- location: {
218
- uri: resolveUrlTemplate(jb1TrackConfig.tbiUrlTemplate),
219
- locationType: 'UriLocation',
220
- },
221
- };
222
- }
223
- else if (jb1TrackConfig.csiUrlTemplate) {
224
- adapter.index = {
225
- location: {
226
- uri: resolveUrlTemplate(jb1TrackConfig.csiUrlTemplate),
227
- locationType: 'UriLocation',
228
- },
229
- indexType: 'CSI',
230
- };
231
- }
232
- else {
233
- adapter.index = {
234
- location: { uri: `${urlTemplate}.tbi`, locationType: 'UriLocation' },
235
- };
236
- }
237
- return {
238
- ...jb2TrackConfig,
239
- type: 'FeatureTrack',
240
- adapter,
241
- };
242
- }
243
- if (storeClass === 'JBrowse/Store/SeqFeature/GTF') {
244
- return {
245
- ...jb2TrackConfig,
246
- type: 'FeatureTrack',
247
- adapter: {
248
- type: 'GtfAdapter',
249
- gtfLocation: { uri: urlTemplate, locationType: 'UriLocation' },
250
- },
251
- };
252
- }
253
- if (storeClass === 'JBrowse/Store/SeqFeature/StaticChunked' ||
254
- storeClass === 'JBrowse/Store/Sequence/StaticChunked') {
255
- return (0, tracks_1.generateUnsupportedTrackConf)(jb2TrackConfig.name, `StaticChunked (${urlTemplate})`, jb2TrackConfig.category);
256
- }
257
- if (storeClass === 'JBrowse/Store/SeqFeature/UnindexedFasta') {
258
- return (0, tracks_1.generateUnsupportedTrackConf)(jb2TrackConfig.name, `UnindexedFasta (${urlTemplate})`, jb2TrackConfig.category);
259
- }
260
- if (storeClass === 'JBrowse/Store/SeqFeature/IndexedFasta') {
261
- const adapter = {
262
- type: 'IndexedFastaAdapter',
263
- fastaLocation: { uri: urlTemplate, locationType: 'UriLocation' },
264
- };
265
- adapter.faiLocation = jb1TrackConfig.faiUrlTemplate
266
- ? {
267
- uri: resolveUrlTemplate(jb1TrackConfig.faiUrlTemplate),
268
- locationType: 'UriLocation',
269
- }
270
- : {
271
- uri: `${urlTemplate}.fai`,
272
- locationType: 'UriLocation',
273
- };
274
- return {
275
- ...jb2TrackConfig,
276
- type: 'SequenceTrack',
277
- adapter,
278
- };
279
- }
280
- if (storeClass === 'JBrowse/Store/SeqFeature/BgzipIndexedFasta') {
281
- const adapter = {
282
- type: 'BgzipFastaAdapter',
283
- fastaLocation: { uri: urlTemplate, locationType: 'UriLocation' },
284
- };
285
- adapter.faiLocation = jb1TrackConfig.faiUrlTemplate
286
- ? {
287
- uri: resolveUrlTemplate(jb1TrackConfig.faiUrlTemplate),
288
- locationType: 'UriLocation',
289
- }
290
- : {
291
- uri: `${urlTemplate}.fai`,
292
- locationType: 'UriLocation',
293
- };
294
- adapter.gziLocation = jb1TrackConfig.gziUrlTemplate
295
- ? {
296
- uri: resolveUrlTemplate(jb1TrackConfig.gziUrlTemplate),
297
- locationType: 'UriLocation',
298
- }
299
- : {
300
- uri: `${urlTemplate}.gzi`,
301
- locationType: 'UriLocation',
302
- };
303
- return {
304
- ...jb2TrackConfig,
305
- type: 'ReferenceSequenceTrack',
306
- adapter,
307
- };
308
- }
309
- if (storeClass === 'JBrowse/Store/SeqFeature/TwoBit') {
310
- return {
311
- ...jb2TrackConfig,
312
- type: 'ReferenceSequenceTrack',
313
- adapter: {
314
- type: 'TwoBitAdapter',
315
- twoBitLocation: { uri: urlTemplate, locationType: 'UriLocation' },
316
- },
317
- };
318
- }
319
- }
320
- jb2TrackConfig.adapter = (0, tracks_1.guessAdapter)({ uri: urlTemplate, locationType: 'UriLocation' }, undefined, urlTemplate);
321
- if (jb2TrackConfig.adapter.type === tracks_1.UNSUPPORTED) {
322
- return (0, tracks_1.generateUnsupportedTrackConf)(jb2TrackConfig.name, urlTemplate, jb2TrackConfig.category);
323
- }
324
- if (jb2TrackConfig.adapter.type === tracks_1.UNKNOWN) {
325
- return (0, tracks_1.generateUnknownTrackConf)(jb2TrackConfig.name, urlTemplate, jb2TrackConfig.category);
326
- }
327
- jb2TrackConfig.type = (0, tracks_1.guessTrackType)(jb2TrackConfig.adapter.type);
328
- if (jb2TrackConfig.type === 'QuantitativeTrack') {
329
- if ((_d = jb1TrackConfig.type) === null || _d === void 0 ? void 0 : _d.endsWith('XYPlot')) {
330
- jb2TrackConfig.defaultRendering = 'xyplot';
331
- }
332
- else if ((_e = jb1TrackConfig.type) === null || _e === void 0 ? void 0 : _e.endsWith('Density')) {
333
- jb2TrackConfig.defaultRendering = 'density';
334
- }
335
- }
336
- return jb2TrackConfig;
337
- }
338
- function generateFromConfigTrackConfig(jb1TrackConfig, jb2TrackConfig) {
339
- const jb1Features = jb1TrackConfig.features || [];
340
- const jb2Features = jb1Features.map((feature) => {
341
- const jb2Feature = JSON.parse(JSON.stringify(feature));
342
- jb2Feature.refName = feature.seq_id;
343
- jb2Feature.uniqueId = `${feature.seq_id}:${feature.start}-${feature.end}:${feature.name || ''}`;
344
- return jb2Feature;
345
- });
346
- jb2TrackConfig.adapter = {
347
- type: 'FromConfigAdapter',
348
- features: jb2Features,
349
- };
350
- jb2TrackConfig.type = 'FeatureTrack';
351
- return jb2TrackConfig;
352
- }
353
- async function createRefSeqsAdapter(refSeqs) {
354
- if (typeof refSeqs === 'string') {
355
- refSeqs = {
356
- url: refSeqs,
357
- };
358
- }
359
- if (refSeqs.url) {
360
- if (/.fai$/.exec(refSeqs.url)) {
361
- return {
362
- type: 'IndexedFastaAdapter',
363
- fastaLocation: {
364
- uri: refSeqs.url.slice(0, -4),
365
- locationType: 'UriLocation',
366
- },
367
- faiLocation: {
368
- uri: refSeqs.url,
369
- locationType: 'UriLocation',
370
- },
371
- };
372
- }
373
- if (/.2bit$/.exec(refSeqs.url)) {
374
- return {
375
- type: 'TwoBitAdapter',
376
- twoBitLocation: { uri: refSeqs.url, locationType: 'UriLocation' },
377
- };
378
- }
379
- if (/.fa$/.exec(refSeqs.url)) {
380
- throw new Error('Unindexed FASTA adapter not available');
381
- }
382
- if (/.sizes/.exec(refSeqs.url)) {
383
- throw new Error('chromosome SIZES adapter not available');
384
- }
385
- const refSeqsJson = await (0, io_1.openLocation)({
386
- uri: refSeqs.url,
387
- locationType: 'UriLocation',
388
- }).readFile('utf8');
389
- const refSeqsData = JSON.parse(refSeqsJson);
390
- return refSeqAdapterFromConfig(refSeqsData);
391
- }
392
- if ('data' in refSeqs) {
393
- return refSeqAdapterFromConfig(refSeqs.data || []);
394
- }
395
- throw new Error(`Could not determine adapter for JBrowse1 refSeqs: ${refSeqs.url || JSON.stringify(refSeqs)}`);
396
- }
397
- function refSeqAdapterFromConfig(refSeqsData) {
398
- const features = refSeqsData.map((refSeq) => ({
399
- refName: refSeq.name,
400
- uniqueId: refSeq.name,
401
- start: refSeq.start,
402
- end: refSeq.end,
403
- }));
404
- return {
405
- type: 'FromConfigAdapter',
406
- features,
407
- };
408
- }
@@ -1,75 +0,0 @@
1
- import type PluginManager from '@jbrowse/core/PluginManager';
2
- export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
3
- name: import("mobx-state-tree").ISimpleType<string>;
4
- tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
5
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
6
- name: {
7
- type: string;
8
- defaultValue: string;
9
- description: string;
10
- };
11
- assemblyNames: {
12
- type: string;
13
- defaultValue: never[];
14
- description: string;
15
- };
16
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>;
17
- } & {
18
- configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
19
- dataDirLocation: {
20
- type: string;
21
- defaultValue: {
22
- uri: string;
23
- locationType: string;
24
- };
25
- description: string;
26
- };
27
- assemblyNames: {
28
- description: string;
29
- type: string;
30
- defaultValue: never[];
31
- };
32
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
33
- name: {
34
- type: string;
35
- defaultValue: string;
36
- description: string;
37
- };
38
- assemblyNames: {
39
- type: string;
40
- defaultValue: never[];
41
- description: string;
42
- };
43
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
44
- type: import("mobx-state-tree").ISimpleType<"JBrowse1Connection">;
45
- }, {
46
- connect(_arg: import("@jbrowse/core/configuration").AnyConfigurationModel): void;
47
- } & {
48
- afterAttach(): void;
49
- addTrackConf(trackConf: Record<string, unknown> | ({
50
- [x: string]: any;
51
- } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
52
- setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
53
- [x: string]: any;
54
- } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
55
- setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
56
- [x: string]: any;
57
- } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
58
- } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
59
- } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)): any;
60
- addTrackConfs(trackConfs: (Record<string, unknown> | ({
61
- [x: string]: any;
62
- } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
63
- setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
64
- [x: string]: any;
65
- } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
66
- setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
67
- [x: string]: any;
68
- } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
69
- } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
70
- } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>))[]): void;
71
- setTrackConfs(trackConfs: import("@jbrowse/core/configuration").AnyConfigurationModel[]): void;
72
- clear(): void;
73
- } & {
74
- connect(): Promise<void>;
75
- }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
@@ -1,82 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.default = stateModelFactory;
40
- const configuration_1 = require("@jbrowse/core/configuration");
41
- const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
42
- const util_1 = require("@jbrowse/core/util");
43
- const mobx_state_tree_1 = require("mobx-state-tree");
44
- const configSchema_1 = __importDefault(require("./configSchema"));
45
- function stateModelFactory(pluginManager) {
46
- return mobx_state_tree_1.types
47
- .compose('JBrowse1Connection', (0, models_1.BaseConnectionModelFactory)(pluginManager), mobx_state_tree_1.types.model({
48
- configuration: (0, configuration_1.ConfigurationReference)(configSchema_1.default),
49
- type: mobx_state_tree_1.types.literal('JBrowse1Connection'),
50
- }))
51
- .actions(self => ({
52
- async connect() {
53
- var _a, _b;
54
- const session = (0, util_1.getSession)(self);
55
- try {
56
- const dataDirLocation = (0, configuration_1.getConf)(self, 'dataDirLocation');
57
- const { fetchJb1 } = await Promise.resolve().then(() => __importStar(require('./jb1ConfigLoad')));
58
- const { convertTrackConfig } = await Promise.resolve().then(() => __importStar(require('./jb1ToJb2')));
59
- const config = await fetchJb1(dataDirLocation);
60
- const assemblyName = (0, configuration_1.getConf)(self, 'assemblyNames')[0];
61
- if (!assemblyName) {
62
- throw new Error('assembly name required for JBrowse 1 connection');
63
- }
64
- const conf = session.assemblies.find(a => (0, configuration_1.readConfObject)(a, 'name') === assemblyName);
65
- if (!conf) {
66
- throw new Error(`Assembly "${assemblyName}" not found`);
67
- }
68
- const sequenceAdapter = (0, configuration_1.readConfObject)(conf, ['sequence', 'adapter']);
69
- const jb2Tracks = (_a = config.tracks) === null || _a === void 0 ? void 0 : _a.map(jb1Track => ({
70
- ...convertTrackConfig(jb1Track, config.dataRoot || '', sequenceAdapter),
71
- assemblyNames: [assemblyName],
72
- }));
73
- self.setTrackConfs(jb2Tracks);
74
- }
75
- catch (error) {
76
- console.error(error);
77
- session.notifyError(`There was a problem connecting to the JBrowse 1 data directory "${self.name}". Please make sure you have entered a valid location. The error that was thrown is: "${error}"`, error);
78
- (_b = session.breakConnection) === null || _b === void 0 ? void 0 : _b.call(session, self.configuration);
79
- }
80
- },
81
- }));
82
- }
@@ -1,91 +0,0 @@
1
- export interface ProtoTrack {
2
- backendVersion?: number;
3
- baseUrl?: string;
4
- category?: string;
5
- config?: Track;
6
- dataRoot?: string;
7
- features?: Feature[];
8
- histograms?: Track;
9
- index?: number;
10
- key?: string;
11
- label?: string;
12
- metadata?: Metadata;
13
- store?: Store | string;
14
- storeClass?: string;
15
- type?: string;
16
- urlTemplate?: string;
17
- baiUrlTemplate?: string;
18
- craiUrlTemplate?: string;
19
- tbiUrlTemplate?: string;
20
- csiUrlTemplate?: string;
21
- faiUrlTemplate?: string;
22
- gziUrlTemplate?: string;
23
- useAsRefSeqStore?: boolean;
24
- }
25
- export interface Track extends ProtoTrack {
26
- label: string;
27
- }
28
- export interface Metadata {
29
- category?: string;
30
- description?: string;
31
- Description?: string;
32
- }
33
- export interface Feature {
34
- seq_id: string;
35
- start: number;
36
- end: number;
37
- name?: string;
38
- }
39
- export interface Source {
40
- url: string;
41
- name?: string;
42
- type?: string;
43
- }
44
- export interface TrackMetadata {
45
- sources?: string | Source | (string | Source)[] | Record<string, Source>;
46
- }
47
- export interface Store extends ProtoTrack {
48
- name?: string;
49
- }
50
- export interface Names {
51
- baseUrl?: string;
52
- }
53
- export interface RefSeq {
54
- name: string;
55
- length: number;
56
- end: number;
57
- start: number;
58
- }
59
- export interface RefSeqs {
60
- url?: string;
61
- data?: RefSeq[];
62
- }
63
- export interface Include {
64
- url: string;
65
- cacheBuster?: boolean;
66
- format?: string;
67
- version?: number;
68
- }
69
- export interface Config {
70
- baseUrl?: string;
71
- cacheBuster?: boolean;
72
- dataRoot?: string;
73
- include?: string[];
74
- names?: Record<string, string>;
75
- nameUrl?: string;
76
- refSeqs?: string | RefSeqs;
77
- sourceUrl?: string;
78
- stores?: Record<string, Store>;
79
- trackMetadata?: TrackMetadata;
80
- tracks?: Track | Track[] | Record<string, Track | ProtoTrack>;
81
- }
82
- export interface UriLocation {
83
- uri: string;
84
- baseUri?: string;
85
- locationType: 'UriLocation';
86
- }
87
- export interface LocalPathLocation {
88
- localPath: string;
89
- locationType: 'LocalPathLocation';
90
- }
91
- export type JBLocation = UriLocation | LocalPathLocation;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- import type { Source, Track } from './types';
2
- export declare function isTrack(arg: any): arg is Track;
3
- export declare function isSource(arg: any): arg is Source;
4
- type Obj = Record<string, any>;
5
- export declare function deepUpdate(a: Obj, b: Obj): Obj;
6
- export declare function fillTemplate(template: string, fillWith: Obj): string;
7
- export declare function structuredClone(src: any): any;
8
- export {};