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