@jbrowse/plugin-legacy-jbrowse 4.3.0 → 5.0.0-beta.10
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/esm/JBrowse1Connection/configSchema.d.ts +58 -18
- package/esm/JBrowse1Connection/configSchema.js +29 -3
- package/esm/JBrowse1Connection/get-value.d.ts +1 -10
- package/esm/JBrowse1Connection/get-value.js +9 -82
- package/esm/JBrowse1Connection/index.js +2 -2
- package/esm/JBrowse1Connection/jb1ConfigLoad.d.ts +9 -36
- package/esm/JBrowse1Connection/jb1ConfigLoad.js +72 -241
- package/esm/JBrowse1Connection/jb1ConfigParse.d.ts +6 -3
- package/esm/JBrowse1Connection/jb1ConfigParse.js +25 -250
- package/esm/JBrowse1Connection/jb1ToJb2.d.ts +8 -3
- package/esm/JBrowse1Connection/jb1ToJb2.js +124 -368
- package/esm/JBrowse1Connection/model.d.ts +79 -49
- package/esm/JBrowse1Connection/model.js +23 -9
- package/esm/JBrowse1Connection/set-value.d.ts +1 -0
- package/esm/JBrowse1Connection/set-value.js +14 -0
- package/esm/JBrowse1Connection/types.d.ts +4 -57
- package/esm/JBrowse1Connection/util.d.ts +13 -8
- package/esm/JBrowse1Connection/util.js +15 -80
- package/esm/JBrowse1TextSearchAdapter/HttpMap.d.ts +36 -8
- package/esm/JBrowse1TextSearchAdapter/HttpMap.js +61 -27
- package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +5 -6
- package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +21 -23
- package/esm/JBrowse1TextSearchAdapter/configSchema.d.ts +36 -16
- package/esm/JBrowse1TextSearchAdapter/configSchema.js +28 -5
- package/esm/JBrowse1TextSearchAdapter/index.js +2 -2
- package/esm/NCListAdapter/NCListAdapter.d.ts +11 -1
- package/esm/NCListAdapter/NCListAdapter.js +16 -7
- package/esm/NCListAdapter/NCListFeature.d.ts +34 -3
- package/esm/NCListAdapter/NCListFeature.js +22 -8
- package/esm/NCListAdapter/configSchema.d.ts +31 -11
- package/esm/NCListAdapter/configSchema.js +26 -1
- package/esm/NCListAdapter/index.js +2 -2
- package/esm/index.js +3 -5
- package/package.json +9 -12
- package/esm/GuessNCList/index.d.ts +0 -2
- package/esm/GuessNCList/index.js +0 -15
|
@@ -1,6 +1,66 @@
|
|
|
1
|
+
import { matchFormat, trackTypeForAdapter } from '@jbrowse/add-track-core';
|
|
1
2
|
import { objectHash } from '@jbrowse/core/util';
|
|
2
|
-
import {
|
|
3
|
-
|
|
3
|
+
import { generateUnknownTrackConf, generateUnsupportedTrackConf, } from '@jbrowse/core/util/tracks';
|
|
4
|
+
/**
|
|
5
|
+
* The JBrowse 2 adapter each JBrowse 1 storeClass becomes, keyed by the part
|
|
6
|
+
* after `JBrowse/Store/`. This is the only JBrowse-1-specific knowledge here:
|
|
7
|
+
* which location field an adapter stores its file under, and what it names the
|
|
8
|
+
* index or sidecar beside it, comes from `@jbrowse/add-track-core`'s format
|
|
9
|
+
* table — the one the add-track form and the CLI already read. A hand-written
|
|
10
|
+
* branch per store is what let one of three sequence stores drift into calling
|
|
11
|
+
* its track a `SequenceTrack`, a type JBrowse does not register.
|
|
12
|
+
*/
|
|
13
|
+
const STORE_ADAPTERS = {
|
|
14
|
+
'SeqFeature/BAM': 'BamAdapter',
|
|
15
|
+
'SeqFeature/CRAM': 'CramAdapter',
|
|
16
|
+
'SeqFeature/NCList': 'NCListAdapter',
|
|
17
|
+
'SeqFeature/BigWig': 'BigWigAdapter',
|
|
18
|
+
BigWig: 'BigWigAdapter',
|
|
19
|
+
'SeqFeature/BigBed': 'BigBedAdapter',
|
|
20
|
+
'SeqFeature/VCFTabix': 'VcfTabixAdapter',
|
|
21
|
+
'SeqFeature/GFF3': 'Gff3Adapter',
|
|
22
|
+
'SeqFeature/GFF3Tabix': 'Gff3TabixAdapter',
|
|
23
|
+
'SeqFeature/GTF': 'GtfAdapter',
|
|
24
|
+
'SeqFeature/BED': 'BedAdapter',
|
|
25
|
+
'SeqFeature/BEDTabix': 'BedTabixAdapter',
|
|
26
|
+
'SeqFeature/TwoBit': 'TwoBitAdapter',
|
|
27
|
+
'SeqFeature/IndexedFasta': 'IndexedFastaAdapter',
|
|
28
|
+
'SeqFeature/BgzipIndexedFasta': 'BgzipFastaAdapter',
|
|
29
|
+
// nothing guesses a plain `.fa` as unindexed, so this is the one store whose
|
|
30
|
+
// spec the format table cannot supply
|
|
31
|
+
'SeqFeature/UnindexedFasta': {
|
|
32
|
+
kind: 'single',
|
|
33
|
+
adapterType: 'UnindexedFastaAdapter',
|
|
34
|
+
locField: 'fastaLocation',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
// JBrowse 1 stores JBrowse 2 has no adapter for. The value names the format in
|
|
38
|
+
// the placeholder track the reader gets instead.
|
|
39
|
+
const NO_ADAPTER = {
|
|
40
|
+
'SeqFeature/VCFTribble': 'VCFTribble',
|
|
41
|
+
'SeqFeature/StaticChunked': 'StaticChunked',
|
|
42
|
+
'Sequence/StaticChunked': 'StaticChunked',
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* `mark` is a slot on LinearWiggleDisplay, not on the track — a track-level
|
|
46
|
+
* one is a key JBrowse does not declare, and is ignored.
|
|
47
|
+
*/
|
|
48
|
+
function wiggleDisplays(jb1TrackConfig, jb2TrackConfig) {
|
|
49
|
+
const mark = jb1TrackConfig.type?.endsWith('Density')
|
|
50
|
+
? 'heatmap'
|
|
51
|
+
: jb1TrackConfig.type?.endsWith('XYPlot')
|
|
52
|
+
? 'bar'
|
|
53
|
+
: undefined;
|
|
54
|
+
return mark
|
|
55
|
+
? [
|
|
56
|
+
{
|
|
57
|
+
type: 'LinearWiggleDisplay',
|
|
58
|
+
displayId: `${jb2TrackConfig.trackId}-LinearWiggleDisplay`,
|
|
59
|
+
mark,
|
|
60
|
+
},
|
|
61
|
+
]
|
|
62
|
+
: undefined;
|
|
63
|
+
}
|
|
4
64
|
export function convertTrackConfig(jb1TrackConfig, dataRoot) {
|
|
5
65
|
const jb2TrackConfig = {
|
|
6
66
|
trackId: objectHash(jb1TrackConfig),
|
|
@@ -13,390 +73,86 @@ export function convertTrackConfig(jb1TrackConfig, dataRoot) {
|
|
|
13
73
|
}
|
|
14
74
|
const category = jb1TrackConfig.category || jb1TrackConfig.metadata?.category;
|
|
15
75
|
jb2TrackConfig.category = category ? category.split(/\s*\/\s*/) : [];
|
|
76
|
+
const unsupported = (detail) => generateUnsupportedTrackConf(jb2TrackConfig.name, detail, jb2TrackConfig.category);
|
|
16
77
|
const { storeClass } = jb1TrackConfig;
|
|
17
78
|
if (!jb1TrackConfig.urlTemplate) {
|
|
18
79
|
if (!storeClass?.endsWith('FromConfig')) {
|
|
19
80
|
const trackIdentifier = jb1TrackConfig.key || jb1TrackConfig.label;
|
|
20
81
|
console.warn(`Could not import JBrowse1 track "${trackIdentifier}" because it does not have a "urlTemplate" or is not a "FromConfig" track`);
|
|
21
|
-
return
|
|
82
|
+
return unsupported(trackIdentifier);
|
|
22
83
|
}
|
|
23
84
|
return generateFromConfigTrackConfig(jb1TrackConfig, jb2TrackConfig);
|
|
24
85
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
86
|
+
// a JBrowse 1 urlTemplate is relative to the data directory, and NCList's
|
|
87
|
+
// `{refseq}` has to survive the round trip through URL escaping
|
|
88
|
+
const resolve = (urlTemplate) => new URL(urlTemplate, `${dataRoot}/`).href
|
|
89
|
+
.replaceAll(/%7B/gi, '{')
|
|
90
|
+
.replaceAll(/%7D/gi, '}');
|
|
91
|
+
const urlTemplate = resolve(jb1TrackConfig.urlTemplate);
|
|
92
|
+
const fileName = urlTemplate.split(/[?#]/)[0];
|
|
93
|
+
const loc = (uri) => ({
|
|
94
|
+
uri,
|
|
95
|
+
locationType: 'UriLocation',
|
|
96
|
+
});
|
|
97
|
+
const key = storeClass?.replace(/^JBrowse\/Store\//, '');
|
|
98
|
+
const noAdapter = key === undefined ? undefined : NO_ADAPTER[key];
|
|
99
|
+
if (noAdapter) {
|
|
100
|
+
return unsupported(`${noAdapter} (${urlTemplate})`);
|
|
101
|
+
}
|
|
102
|
+
// JBrowse 1 named an override for a sidecar after its own suffix, so `.bai`
|
|
103
|
+
// is `baiUrlTemplate` and `.gzi` is `gziUrlTemplate`
|
|
104
|
+
const named = (suffix) => jb1TrackConfig[`${suffix.slice(1)}UrlTemplate`];
|
|
105
|
+
const beside = (suffix) => {
|
|
106
|
+
const override = named(suffix);
|
|
107
|
+
return loc(override ? resolve(override) : `${urlTemplate}${suffix}`);
|
|
29
108
|
};
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
locationType: 'UriLocation',
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
else if (jb1TrackConfig.csiUrlTemplate) {
|
|
46
|
-
adapter.index = {
|
|
47
|
-
location: {
|
|
48
|
-
uri: resolveUrlTemplate(jb1TrackConfig.csiUrlTemplate),
|
|
49
|
-
locationType: 'UriLocation',
|
|
50
|
-
},
|
|
51
|
-
indexType: 'CSI',
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
adapter.index = {
|
|
56
|
-
location: { uri: `${urlTemplate}.bai`, locationType: 'UriLocation' },
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
...jb2TrackConfig,
|
|
61
|
-
type: 'AlignmentsTrack',
|
|
62
|
-
adapter,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/CRAM') {
|
|
66
|
-
const adapter = {
|
|
67
|
-
type: 'CramAdapter',
|
|
68
|
-
cramLocation: { uri: urlTemplate, locationType: 'UriLocation' },
|
|
69
|
-
craiLocation: jb1TrackConfig.craiUrlTemplate
|
|
70
|
-
? {
|
|
71
|
-
uri: resolveUrlTemplate(jb1TrackConfig.craiUrlTemplate),
|
|
72
|
-
locationType: 'UriLocation',
|
|
73
|
-
}
|
|
74
|
-
: {
|
|
75
|
-
uri: `${urlTemplate}.crai`,
|
|
76
|
-
locationType: 'UriLocation',
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
return {
|
|
80
|
-
...jb2TrackConfig,
|
|
81
|
-
type: 'AlignmentsTrack',
|
|
82
|
-
adapter,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/NCList') {
|
|
86
|
-
return {
|
|
87
|
-
...jb2TrackConfig,
|
|
88
|
-
type: 'FeatureTrack',
|
|
89
|
-
adapter: {
|
|
90
|
-
type: 'NCListAdapter',
|
|
91
|
-
rootUrlTemplate: { uri: urlTemplate, locationType: 'UriLocation' },
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/BigWig' ||
|
|
96
|
-
storeClass === 'JBrowse/Store/BigWig') {
|
|
97
|
-
if (jb1TrackConfig.type?.endsWith('XYPlot')) {
|
|
98
|
-
jb2TrackConfig.defaultRendering = 'xyplot';
|
|
99
|
-
}
|
|
100
|
-
else if (jb1TrackConfig.type?.endsWith('Density')) {
|
|
101
|
-
jb2TrackConfig.defaultRendering = 'density';
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
...jb2TrackConfig,
|
|
105
|
-
type: 'QuantitativeTrack',
|
|
106
|
-
adapter: {
|
|
107
|
-
type: 'BigWigAdapter',
|
|
108
|
-
bigWigLocation: { uri: urlTemplate, locationType: 'UriLocation' },
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/VCFTabix') {
|
|
113
|
-
const adapter = {
|
|
114
|
-
type: 'VcfTabixAdapter',
|
|
115
|
-
vcfGzLocation: { uri: urlTemplate, locationType: 'UriLocation' },
|
|
116
|
-
};
|
|
117
|
-
if (jb1TrackConfig.tbiUrlTemplate) {
|
|
118
|
-
adapter.index = {
|
|
119
|
-
location: {
|
|
120
|
-
uri: resolveUrlTemplate(jb1TrackConfig.tbiUrlTemplate),
|
|
121
|
-
locationType: 'UriLocation',
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
else if (jb1TrackConfig.csiUrlTemplate) {
|
|
126
|
-
adapter.index = {
|
|
127
|
-
location: {
|
|
128
|
-
uri: resolveUrlTemplate(jb1TrackConfig.csiUrlTemplate),
|
|
129
|
-
locationType: 'UriLocation',
|
|
130
|
-
},
|
|
131
|
-
indexType: 'CSI',
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
adapter.index = {
|
|
136
|
-
location: { uri: `${urlTemplate}.tbi`, locationType: 'UriLocation' },
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
return {
|
|
140
|
-
...jb2TrackConfig,
|
|
141
|
-
type: 'VariantTrack',
|
|
142
|
-
adapter,
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/VCFTribble') {
|
|
146
|
-
return generateUnsupportedTrackConf(jb2TrackConfig.name, `VCFTribble (${urlTemplate})`, jb2TrackConfig.category);
|
|
147
|
-
}
|
|
148
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/GFF3') {
|
|
149
|
-
return {
|
|
150
|
-
...jb2TrackConfig,
|
|
151
|
-
type: 'FeatureTrack',
|
|
152
|
-
adapter: {
|
|
153
|
-
type: 'Gff3Adapter',
|
|
154
|
-
gffLocation: { uri: urlTemplate, locationType: 'UriLocation' },
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/BigBed') {
|
|
159
|
-
return {
|
|
160
|
-
...jb2TrackConfig,
|
|
161
|
-
type: 'FeatureTrack',
|
|
162
|
-
adapter: {
|
|
163
|
-
type: 'BigBedAdapter',
|
|
164
|
-
bigBedLocation: { uri: urlTemplate, locationType: 'UriLocation' },
|
|
165
|
-
},
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/GFF3Tabix') {
|
|
169
|
-
const adapter = {
|
|
170
|
-
type: 'Gff3TabixAdapter',
|
|
171
|
-
gffGzLocation: { uri: urlTemplate, locationType: 'UriLocation' },
|
|
172
|
-
};
|
|
173
|
-
if (jb1TrackConfig.tbiUrlTemplate) {
|
|
174
|
-
adapter.index = {
|
|
175
|
-
location: {
|
|
176
|
-
uri: resolveUrlTemplate(jb1TrackConfig.tbiUrlTemplate),
|
|
177
|
-
locationType: 'UriLocation',
|
|
178
|
-
},
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
else if (jb1TrackConfig.csiUrlTemplate) {
|
|
182
|
-
adapter.index = {
|
|
183
|
-
location: {
|
|
184
|
-
uri: resolveUrlTemplate(jb1TrackConfig.csiUrlTemplate),
|
|
185
|
-
locationType: 'UriLocation',
|
|
186
|
-
},
|
|
187
|
-
indexType: 'CSI',
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
adapter.index = {
|
|
192
|
-
location: { uri: `${urlTemplate}.tbi`, locationType: 'UriLocation' },
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
return {
|
|
196
|
-
...jb2TrackConfig,
|
|
197
|
-
type: 'FeatureTrack',
|
|
198
|
-
adapter,
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/BED') {
|
|
202
|
-
return generateUnsupportedTrackConf(jb2TrackConfig.name, `BED (${urlTemplate})`, jb2TrackConfig.category);
|
|
203
|
-
}
|
|
204
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/BEDTabix') {
|
|
205
|
-
const adapter = {
|
|
206
|
-
type: 'BedTabixAdapter',
|
|
207
|
-
bedGzLocation: { uri: urlTemplate, locationType: 'UriLocation' },
|
|
208
|
-
};
|
|
209
|
-
if (jb1TrackConfig.tbiUrlTemplate) {
|
|
210
|
-
adapter.index = {
|
|
211
|
-
location: {
|
|
212
|
-
uri: resolveUrlTemplate(jb1TrackConfig.tbiUrlTemplate),
|
|
213
|
-
locationType: 'UriLocation',
|
|
214
|
-
},
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
else if (jb1TrackConfig.csiUrlTemplate) {
|
|
218
|
-
adapter.index = {
|
|
219
|
-
location: {
|
|
220
|
-
uri: resolveUrlTemplate(jb1TrackConfig.csiUrlTemplate),
|
|
221
|
-
locationType: 'UriLocation',
|
|
222
|
-
},
|
|
223
|
-
indexType: 'CSI',
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
adapter.index = {
|
|
228
|
-
location: { uri: `${urlTemplate}.tbi`, locationType: 'UriLocation' },
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
return {
|
|
232
|
-
...jb2TrackConfig,
|
|
233
|
-
type: 'FeatureTrack',
|
|
234
|
-
adapter,
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/GTF') {
|
|
238
|
-
return {
|
|
239
|
-
...jb2TrackConfig,
|
|
240
|
-
type: 'FeatureTrack',
|
|
241
|
-
adapter: {
|
|
242
|
-
type: 'GtfAdapter',
|
|
243
|
-
gtfLocation: { uri: urlTemplate, locationType: 'UriLocation' },
|
|
244
|
-
},
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/StaticChunked' ||
|
|
248
|
-
storeClass === 'JBrowse/Store/Sequence/StaticChunked') {
|
|
249
|
-
return generateUnsupportedTrackConf(jb2TrackConfig.name, `StaticChunked (${urlTemplate})`, jb2TrackConfig.category);
|
|
250
|
-
}
|
|
251
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/UnindexedFasta') {
|
|
252
|
-
return generateUnsupportedTrackConf(jb2TrackConfig.name, `UnindexedFasta (${urlTemplate})`, jb2TrackConfig.category);
|
|
253
|
-
}
|
|
254
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/IndexedFasta') {
|
|
255
|
-
const adapter = {
|
|
256
|
-
type: 'IndexedFastaAdapter',
|
|
257
|
-
fastaLocation: { uri: urlTemplate, locationType: 'UriLocation' },
|
|
258
|
-
faiLocation: jb1TrackConfig.faiUrlTemplate
|
|
259
|
-
? {
|
|
260
|
-
uri: resolveUrlTemplate(jb1TrackConfig.faiUrlTemplate),
|
|
261
|
-
locationType: 'UriLocation',
|
|
262
|
-
}
|
|
263
|
-
: {
|
|
264
|
-
uri: `${urlTemplate}.fai`,
|
|
265
|
-
locationType: 'UriLocation',
|
|
266
|
-
},
|
|
267
|
-
};
|
|
268
|
-
return {
|
|
269
|
-
...jb2TrackConfig,
|
|
270
|
-
type: 'SequenceTrack',
|
|
271
|
-
adapter,
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/BgzipIndexedFasta') {
|
|
275
|
-
const adapter = {
|
|
276
|
-
type: 'BgzipFastaAdapter',
|
|
277
|
-
fastaLocation: { uri: urlTemplate, locationType: 'UriLocation' },
|
|
278
|
-
faiLocation: jb1TrackConfig.faiUrlTemplate
|
|
279
|
-
? {
|
|
280
|
-
uri: resolveUrlTemplate(jb1TrackConfig.faiUrlTemplate),
|
|
281
|
-
locationType: 'UriLocation',
|
|
282
|
-
}
|
|
283
|
-
: {
|
|
284
|
-
uri: `${urlTemplate}.fai`,
|
|
285
|
-
locationType: 'UriLocation',
|
|
286
|
-
},
|
|
287
|
-
gziLocation: jb1TrackConfig.gziUrlTemplate
|
|
288
|
-
? {
|
|
289
|
-
uri: resolveUrlTemplate(jb1TrackConfig.gziUrlTemplate),
|
|
290
|
-
locationType: 'UriLocation',
|
|
291
|
-
}
|
|
292
|
-
: {
|
|
293
|
-
uri: `${urlTemplate}.gzi`,
|
|
294
|
-
locationType: 'UriLocation',
|
|
295
|
-
},
|
|
296
|
-
};
|
|
297
|
-
return {
|
|
298
|
-
...jb2TrackConfig,
|
|
299
|
-
type: 'ReferenceSequenceTrack',
|
|
300
|
-
adapter,
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
if (storeClass === 'JBrowse/Store/SeqFeature/TwoBit') {
|
|
304
|
-
return {
|
|
305
|
-
...jb2TrackConfig,
|
|
306
|
-
type: 'ReferenceSequenceTrack',
|
|
307
|
-
adapter: {
|
|
308
|
-
type: 'TwoBitAdapter',
|
|
309
|
-
twoBitLocation: { uri: urlTemplate, locationType: 'UriLocation' },
|
|
310
|
-
},
|
|
311
|
-
};
|
|
312
|
-
}
|
|
109
|
+
const entry = key === undefined
|
|
110
|
+
? undefined
|
|
111
|
+
: typeof STORE_ADAPTERS[key] === 'string'
|
|
112
|
+
? matchFormat(fileName, STORE_ADAPTERS[key])?.spec
|
|
113
|
+
: STORE_ADAPTERS[key];
|
|
114
|
+
// an unrecognized storeClass, or none, falls back to what the filename says
|
|
115
|
+
const spec = entry ?? matchFormat(fileName)?.spec;
|
|
116
|
+
if (!spec || spec.kind === 'unsupported') {
|
|
117
|
+
return spec
|
|
118
|
+
? unsupported(urlTemplate)
|
|
119
|
+
: generateUnknownTrackConf(jb2TrackConfig.name, urlTemplate, jb2TrackConfig.category);
|
|
313
120
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
121
|
+
const adapter = {
|
|
122
|
+
type: spec.adapterType,
|
|
123
|
+
[spec.locField]: loc(urlTemplate),
|
|
124
|
+
};
|
|
125
|
+
if (spec.kind === 'indexed') {
|
|
126
|
+
const csi = jb1TrackConfig.csiUrlTemplate;
|
|
127
|
+
adapter.index =
|
|
128
|
+
!named(spec.suffix) && csi
|
|
129
|
+
? { location: loc(resolve(csi)), indexType: 'CSI' }
|
|
130
|
+
: { location: beside(spec.suffix) };
|
|
317
131
|
}
|
|
318
|
-
if (
|
|
319
|
-
|
|
132
|
+
else if (spec.kind === 'sidecar') {
|
|
133
|
+
for (const { field, suffix } of spec.sidecars) {
|
|
134
|
+
adapter[field] = beside(suffix);
|
|
135
|
+
}
|
|
320
136
|
}
|
|
321
|
-
jb2TrackConfig.
|
|
137
|
+
jb2TrackConfig.adapter = adapter;
|
|
138
|
+
jb2TrackConfig.type =
|
|
139
|
+
trackTypeForAdapter(spec.adapterType, fileName) ?? 'FeatureTrack';
|
|
322
140
|
if (jb2TrackConfig.type === 'QuantitativeTrack') {
|
|
323
|
-
|
|
324
|
-
jb2TrackConfig.defaultRendering = 'xyplot';
|
|
325
|
-
}
|
|
326
|
-
else if (jb1TrackConfig.type?.endsWith('Density')) {
|
|
327
|
-
jb2TrackConfig.defaultRendering = 'density';
|
|
328
|
-
}
|
|
141
|
+
jb2TrackConfig.displays = wiggleDisplays(jb1TrackConfig, jb2TrackConfig);
|
|
329
142
|
}
|
|
330
143
|
return jb2TrackConfig;
|
|
331
144
|
}
|
|
332
145
|
function generateFromConfigTrackConfig(jb1TrackConfig, jb2TrackConfig) {
|
|
333
|
-
const jb1Features = jb1TrackConfig.features
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
});
|
|
340
|
-
jb2TrackConfig.adapter = {
|
|
341
|
-
type: 'FromConfigAdapter',
|
|
342
|
-
features: jb2Features,
|
|
343
|
-
};
|
|
344
|
-
jb2TrackConfig.type = 'FeatureTrack';
|
|
345
|
-
return jb2TrackConfig;
|
|
346
|
-
}
|
|
347
|
-
export async function createRefSeqsAdapter(refSeqs) {
|
|
348
|
-
if (typeof refSeqs === 'string') {
|
|
349
|
-
refSeqs = {
|
|
350
|
-
url: refSeqs,
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
if (refSeqs.url) {
|
|
354
|
-
if (/.fai$/.exec(refSeqs.url)) {
|
|
355
|
-
return {
|
|
356
|
-
type: 'IndexedFastaAdapter',
|
|
357
|
-
fastaLocation: {
|
|
358
|
-
uri: refSeqs.url.slice(0, -4),
|
|
359
|
-
locationType: 'UriLocation',
|
|
360
|
-
},
|
|
361
|
-
faiLocation: {
|
|
362
|
-
uri: refSeqs.url,
|
|
363
|
-
locationType: 'UriLocation',
|
|
364
|
-
},
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
if (/.2bit$/.exec(refSeqs.url)) {
|
|
368
|
-
return {
|
|
369
|
-
type: 'TwoBitAdapter',
|
|
370
|
-
twoBitLocation: { uri: refSeqs.url, locationType: 'UriLocation' },
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
if (/.fa$/.exec(refSeqs.url)) {
|
|
374
|
-
throw new Error('Unindexed FASTA adapter not available');
|
|
375
|
-
}
|
|
376
|
-
if (/.sizes/.exec(refSeqs.url)) {
|
|
377
|
-
throw new Error('chromosome SIZES adapter not available');
|
|
378
|
-
}
|
|
379
|
-
const refSeqsJson = await openLocation({
|
|
380
|
-
uri: refSeqs.url,
|
|
381
|
-
locationType: 'UriLocation',
|
|
382
|
-
}).readFile('utf8');
|
|
383
|
-
const refSeqsData = JSON.parse(refSeqsJson);
|
|
384
|
-
return refSeqAdapterFromConfig(refSeqsData);
|
|
385
|
-
}
|
|
386
|
-
if ('data' in refSeqs) {
|
|
387
|
-
return refSeqAdapterFromConfig(refSeqs.data || []);
|
|
388
|
-
}
|
|
389
|
-
throw new Error(`Could not determine adapter for JBrowse1 refSeqs: ${refSeqs.url || JSON.stringify(refSeqs)}`);
|
|
390
|
-
}
|
|
391
|
-
function refSeqAdapterFromConfig(refSeqsData) {
|
|
392
|
-
const features = refSeqsData.map((refSeq) => ({
|
|
393
|
-
refName: refSeq.name,
|
|
394
|
-
uniqueId: refSeq.name,
|
|
395
|
-
start: refSeq.start,
|
|
396
|
-
end: refSeq.end,
|
|
146
|
+
const jb1Features = jb1TrackConfig.features ?? [];
|
|
147
|
+
const features = jb1Features.map((f) => ({
|
|
148
|
+
refName: f.seq_id,
|
|
149
|
+
uniqueId: `${f.seq_id}:${f.start}-${f.end}:${f.name ?? ''}`,
|
|
150
|
+
start: f.start,
|
|
151
|
+
end: f.end,
|
|
397
152
|
}));
|
|
398
153
|
return {
|
|
399
|
-
|
|
400
|
-
|
|
154
|
+
...jb2TrackConfig,
|
|
155
|
+
type: 'FeatureTrack',
|
|
156
|
+
adapter: { type: 'FromConfigAdapter', features },
|
|
401
157
|
};
|
|
402
158
|
}
|
|
@@ -1,67 +1,97 @@
|
|
|
1
1
|
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
/**
|
|
3
|
+
* #stateModel JBrowse1Connection
|
|
4
|
+
* Connection that imports tracks from a legacy JBrowse 1 data directory,
|
|
5
|
+
* composed on the base connection model.
|
|
6
|
+
*/
|
|
7
|
+
export default function stateModelFactory(pluginManager: PluginManager): import("@jbrowse/mobx-state-tree").IModelType<Omit<{
|
|
8
|
+
tracks: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/core/PluginManager").PluggableConfigSchemaType>;
|
|
9
|
+
configuration: import("@jbrowse/core/configuration/configurationSchema").IConfigurationReference<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
10
|
+
readonly name: {
|
|
11
|
+
type: "string";
|
|
12
|
+
} & {
|
|
13
|
+
defaultValue: string;
|
|
14
|
+
};
|
|
15
|
+
readonly assemblyNames: {
|
|
16
|
+
type: "stringArray";
|
|
17
|
+
} & {
|
|
18
|
+
defaultValue: unknown;
|
|
19
|
+
};
|
|
20
|
+
type: {
|
|
21
|
+
type: "string";
|
|
22
|
+
} & {
|
|
23
|
+
defaultValue: string;
|
|
24
|
+
};
|
|
25
|
+
connectionId: {
|
|
26
|
+
type: "string";
|
|
27
|
+
} & {
|
|
8
28
|
defaultValue: string;
|
|
9
|
-
description: string;
|
|
10
29
|
};
|
|
30
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId", true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>;
|
|
31
|
+
silent: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
32
|
+
}, "configuration" | "type"> & {
|
|
33
|
+
configuration: import("@jbrowse/core/configuration/configurationSchema").IConfigurationReference<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
11
34
|
assemblyNames: {
|
|
12
|
-
type:
|
|
13
|
-
|
|
14
|
-
|
|
35
|
+
type: "stringArray";
|
|
36
|
+
} & {
|
|
37
|
+
defaultValue: unknown;
|
|
38
|
+
};
|
|
39
|
+
connectionId: {
|
|
40
|
+
type: "string";
|
|
41
|
+
} & {
|
|
42
|
+
defaultValue: string;
|
|
15
43
|
};
|
|
16
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>;
|
|
17
|
-
} & {
|
|
18
|
-
configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
19
44
|
dataDirLocation: {
|
|
20
|
-
type:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
locationType: string;
|
|
24
|
-
};
|
|
25
|
-
description: string;
|
|
45
|
+
type: "fileLocation";
|
|
46
|
+
} & {
|
|
47
|
+
defaultValue: unknown;
|
|
26
48
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
defaultValue:
|
|
49
|
+
name: {
|
|
50
|
+
type: "string";
|
|
51
|
+
} & {
|
|
52
|
+
defaultValue: string;
|
|
53
|
+
};
|
|
54
|
+
type: {
|
|
55
|
+
type: "string";
|
|
56
|
+
} & {
|
|
57
|
+
defaultValue: string;
|
|
31
58
|
};
|
|
32
59
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
33
|
-
name: {
|
|
34
|
-
type: string;
|
|
60
|
+
readonly name: {
|
|
61
|
+
type: "string";
|
|
62
|
+
} & {
|
|
35
63
|
defaultValue: string;
|
|
36
|
-
description: string;
|
|
37
64
|
};
|
|
38
|
-
assemblyNames: {
|
|
39
|
-
type:
|
|
40
|
-
|
|
41
|
-
|
|
65
|
+
readonly assemblyNames: {
|
|
66
|
+
type: "stringArray";
|
|
67
|
+
} & {
|
|
68
|
+
defaultValue: unknown;
|
|
69
|
+
};
|
|
70
|
+
type: {
|
|
71
|
+
type: "string";
|
|
72
|
+
} & {
|
|
73
|
+
defaultValue: string;
|
|
42
74
|
};
|
|
43
|
-
|
|
44
|
-
|
|
75
|
+
connectionId: {
|
|
76
|
+
type: "string";
|
|
77
|
+
} & {
|
|
78
|
+
defaultValue: string;
|
|
79
|
+
};
|
|
80
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId", true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>;
|
|
81
|
+
type: import("@jbrowse/mobx-state-tree").ILiteralType<"JBrowse1Connection">;
|
|
45
82
|
}, {
|
|
46
|
-
|
|
83
|
+
loading: boolean;
|
|
84
|
+
} & {
|
|
85
|
+
readonly connectionId: string;
|
|
86
|
+
readonly name: string;
|
|
87
|
+
} & {
|
|
88
|
+
connect(): Promise<void>;
|
|
89
|
+
setLoading(loading: boolean): void;
|
|
47
90
|
} & {
|
|
48
91
|
afterAttach(): void;
|
|
49
|
-
addTrackConf(trackConf: Record<string, unknown> | (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
|
|
53
|
-
[x: string]: any;
|
|
54
|
-
} & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject & any & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
|
|
55
|
-
} & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)): any;
|
|
56
|
-
addTrackConfs(trackConfs: (Record<string, unknown> | ({
|
|
57
|
-
[x: string]: any;
|
|
58
|
-
} & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
59
|
-
setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
|
|
60
|
-
[x: string]: any;
|
|
61
|
-
} & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject & any & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
|
|
62
|
-
} & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>))[]): void;
|
|
63
|
-
setTrackConfs(trackConfs: import("@jbrowse/core/configuration").AnyConfigurationModel[]): void;
|
|
64
|
-
clear(): void;
|
|
92
|
+
addTrackConf(trackConf: Record<string, unknown> | import("@jbrowse/core/configuration").AnyConfigurationModel): (import("@jbrowse/core/configuration").PluggableConfigNode & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/PluginManager").PluggableConfigSchemaType>) | undefined;
|
|
93
|
+
addTrackConfs(trackConfs: (Record<string, unknown> | import("@jbrowse/core/configuration").AnyConfigurationModel)[]): void;
|
|
94
|
+
setTrackConfs(trackConfs: (Record<string, unknown> | import("@jbrowse/core/configuration").AnyConfigurationModel)[]): void;
|
|
65
95
|
} & {
|
|
66
96
|
connect(): Promise<void>;
|
|
67
97
|
}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
|