@jbrowse/plugin-legacy-jbrowse 2.6.3 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/JBrowse1Connection/jb1ConfigParse.js +3 -2
- package/dist/JBrowse1Connection/jb1ToJb2.js +2 -2
- package/dist/JBrowse1Connection/model.js +5 -8
- package/dist/JBrowse1Connection/util.js +2 -2
- package/dist/JBrowse1TextSearchAdapter/HttpMap.js +1 -1
- package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +1 -1
- package/dist/NCListAdapter/NCListAdapter.js +2 -1
- package/esm/JBrowse1Connection/jb1ConfigParse.js +3 -2
- package/esm/JBrowse1Connection/jb1ToJb2.js +2 -2
- package/esm/JBrowse1Connection/model.js +5 -8
- package/esm/JBrowse1Connection/util.js +2 -2
- package/esm/JBrowse1TextSearchAdapter/HttpMap.js +1 -1
- package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +1 -1
- package/esm/NCListAdapter/NCListAdapter.js +2 -1
- package/package.json +3 -3
|
@@ -170,7 +170,7 @@ function regularizeConf(conf, url) {
|
|
|
170
170
|
}
|
|
171
171
|
// regularize trackMetadata.sources
|
|
172
172
|
const meta = conf.trackMetadata;
|
|
173
|
-
if (meta
|
|
173
|
+
if (meta === null || meta === void 0 ? void 0 : meta.sources) {
|
|
174
174
|
// if it's a single source config, wrap it in an arrayref
|
|
175
175
|
if (typeof meta.sources === 'string') {
|
|
176
176
|
meta.sources = [meta.sources];
|
|
@@ -344,6 +344,7 @@ function guessStoreClass(trackConfig, urlTemplate) {
|
|
|
344
344
|
return '';
|
|
345
345
|
}
|
|
346
346
|
function synthesizeTrackStoreConfig(mainConf, trackConfig) {
|
|
347
|
+
var _a;
|
|
347
348
|
// figure out what data store class to use with the track, applying some
|
|
348
349
|
// defaults if it is not explicit in the configuration
|
|
349
350
|
const { urlTemplate = '' } = trackConfig;
|
|
@@ -366,7 +367,7 @@ function synthesizeTrackStoreConfig(mainConf, trackConfig) {
|
|
|
366
367
|
storeClass === 'JBrowse/Store/SeqFeature/TwoBit' ||
|
|
367
368
|
storeClass === 'JBrowse/Store/Sequence/TwoBit' ||
|
|
368
369
|
trackConfig.useAsRefSeqStore) &&
|
|
369
|
-
!(mainConf.stores
|
|
370
|
+
!((_a = mainConf.stores) === null || _a === void 0 ? void 0 : _a.refseqs)
|
|
370
371
|
? 'refseqs'
|
|
371
372
|
: `store${(0, util_1.objectHash)(storeConf)}`;
|
|
372
373
|
// record it
|
|
@@ -5,6 +5,7 @@ const io_1 = require("@jbrowse/core/util/io");
|
|
|
5
5
|
const util_1 = require("@jbrowse/core/util");
|
|
6
6
|
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
7
7
|
function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
|
|
8
|
+
var _a;
|
|
8
9
|
const jb2TrackConfig = {
|
|
9
10
|
trackId: (0, util_1.objectHash)(jb1TrackConfig),
|
|
10
11
|
name: jb1TrackConfig.key || jb1TrackConfig.label,
|
|
@@ -14,8 +15,7 @@ function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
|
|
|
14
15
|
if (description) {
|
|
15
16
|
jb2TrackConfig.description = description;
|
|
16
17
|
}
|
|
17
|
-
const category = jb1TrackConfig.category ||
|
|
18
|
-
(jb1TrackConfig.metadata && jb1TrackConfig.metadata.category);
|
|
18
|
+
const category = jb1TrackConfig.category || ((_a = jb1TrackConfig.metadata) === null || _a === void 0 ? void 0 : _a.category);
|
|
19
19
|
jb2TrackConfig.category = category ? category.split(/\s*\/\s*/) : [];
|
|
20
20
|
const { storeClass } = jb1TrackConfig;
|
|
21
21
|
if (!jb1TrackConfig.urlTemplate) {
|
|
@@ -40,7 +40,7 @@ function default_1(pluginManager) {
|
|
|
40
40
|
}))
|
|
41
41
|
.actions(self => ({
|
|
42
42
|
async connect() {
|
|
43
|
-
var _a;
|
|
43
|
+
var _a, _b;
|
|
44
44
|
const session = (0, util_1.getSession)(self);
|
|
45
45
|
try {
|
|
46
46
|
const dataDirLocation = (0, configuration_1.getConf)(self, 'dataDirLocation');
|
|
@@ -51,14 +51,11 @@ function default_1(pluginManager) {
|
|
|
51
51
|
if (!assemblyName) {
|
|
52
52
|
throw new Error('assembly name required for JBrowse 1 connection');
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
54
|
+
const conf = session.assemblies.find(a => (0, configuration_1.readConfObject)(a, 'name') === assemblyName);
|
|
55
|
+
if (!conf) {
|
|
56
56
|
throw new Error(`Assembly "${assemblyName}" not found`);
|
|
57
57
|
}
|
|
58
|
-
const sequenceAdapter = (0, configuration_1.readConfObject)(
|
|
59
|
-
'sequence',
|
|
60
|
-
'adapter',
|
|
61
|
-
]);
|
|
58
|
+
const sequenceAdapter = (0, configuration_1.readConfObject)(conf, ['sequence', 'adapter']);
|
|
62
59
|
// @ts-expect-error
|
|
63
60
|
const jb2Tracks = (_a = config.tracks) === null || _a === void 0 ? void 0 : _a.map(jb1Track => ({
|
|
64
61
|
...convertTrackConfig(jb1Track, config.dataRoot || '', sequenceAdapter),
|
|
@@ -69,7 +66,7 @@ function default_1(pluginManager) {
|
|
|
69
66
|
catch (error) {
|
|
70
67
|
console.error(error);
|
|
71
68
|
session.notify(`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');
|
|
72
|
-
session.breakConnection(self.configuration);
|
|
69
|
+
(_b = session.breakConnection) === null || _b === void 0 ? void 0 : _b.call(session, self.configuration);
|
|
73
70
|
}
|
|
74
71
|
},
|
|
75
72
|
}));
|
|
@@ -7,12 +7,12 @@ exports.clone = exports.fillTemplate = exports.deepUpdate = exports.isSource = e
|
|
|
7
7
|
const get_value_1 = __importDefault(require("get-value"));
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
9
|
function isTrack(arg) {
|
|
10
|
-
return arg
|
|
10
|
+
return (arg === null || arg === void 0 ? void 0 : arg.label) && typeof arg.label === 'string';
|
|
11
11
|
}
|
|
12
12
|
exports.isTrack = isTrack;
|
|
13
13
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
14
|
function isSource(arg) {
|
|
15
|
-
return arg
|
|
15
|
+
return (arg === null || arg === void 0 ? void 0 : arg.url) && typeof arg.url === 'string';
|
|
16
16
|
}
|
|
17
17
|
exports.isSource = isSource;
|
|
18
18
|
function deepUpdate(a, b) {
|
|
@@ -11,7 +11,7 @@ const buffer_crc32_1 = __importDefault(require("buffer-crc32"));
|
|
|
11
11
|
class HttpMap {
|
|
12
12
|
constructor(args) {
|
|
13
13
|
// make sure url has a trailing slash
|
|
14
|
-
this.url =
|
|
14
|
+
this.url = args.url.endsWith('/') ? args.url : `${args.url}/`;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* loads meta.json file from names directory and reads number of hash_bits used
|
|
@@ -14,7 +14,7 @@ interface SearchResults {
|
|
|
14
14
|
} | string)[];
|
|
15
15
|
exact: [string, number, string, string, number, number][];
|
|
16
16
|
}
|
|
17
|
-
export type NamesIndexRecord = string |
|
|
17
|
+
export type NamesIndexRecord = string | (string | number)[];
|
|
18
18
|
type IndexFile = Record<string, SearchResults>;
|
|
19
19
|
export default class JBrowse1TextSearchAdapter extends BaseAdapter implements BaseTextSearchAdapter {
|
|
20
20
|
httpMap: HttpMap;
|
|
@@ -46,8 +46,9 @@ class NCListAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
46
46
|
return new NCListFeature_1.default(ncFeature, undefined, `${this.id}-${ncFeature.id()}`);
|
|
47
47
|
}
|
|
48
48
|
async hasDataForRefName(refName) {
|
|
49
|
+
var _a;
|
|
49
50
|
const root = await this.nclist.getDataRoot(refName);
|
|
50
|
-
return !!(root
|
|
51
|
+
return !!((_a = root === null || root === void 0 ? void 0 : root.stats) === null || _a === void 0 ? void 0 : _a.featureCount);
|
|
51
52
|
}
|
|
52
53
|
/**
|
|
53
54
|
* NCList is unable to get list of ref names so returns empty
|
|
@@ -162,7 +162,7 @@ export function regularizeConf(conf, url) {
|
|
|
162
162
|
}
|
|
163
163
|
// regularize trackMetadata.sources
|
|
164
164
|
const meta = conf.trackMetadata;
|
|
165
|
-
if (meta
|
|
165
|
+
if (meta === null || meta === void 0 ? void 0 : meta.sources) {
|
|
166
166
|
// if it's a single source config, wrap it in an arrayref
|
|
167
167
|
if (typeof meta.sources === 'string') {
|
|
168
168
|
meta.sources = [meta.sources];
|
|
@@ -335,6 +335,7 @@ function guessStoreClass(trackConfig, urlTemplate) {
|
|
|
335
335
|
return '';
|
|
336
336
|
}
|
|
337
337
|
function synthesizeTrackStoreConfig(mainConf, trackConfig) {
|
|
338
|
+
var _a;
|
|
338
339
|
// figure out what data store class to use with the track, applying some
|
|
339
340
|
// defaults if it is not explicit in the configuration
|
|
340
341
|
const { urlTemplate = '' } = trackConfig;
|
|
@@ -357,7 +358,7 @@ function synthesizeTrackStoreConfig(mainConf, trackConfig) {
|
|
|
357
358
|
storeClass === 'JBrowse/Store/SeqFeature/TwoBit' ||
|
|
358
359
|
storeClass === 'JBrowse/Store/Sequence/TwoBit' ||
|
|
359
360
|
trackConfig.useAsRefSeqStore) &&
|
|
360
|
-
!(mainConf.stores
|
|
361
|
+
!((_a = mainConf.stores) === null || _a === void 0 ? void 0 : _a.refseqs)
|
|
361
362
|
? 'refseqs'
|
|
362
363
|
: `store${objectHash(storeConf)}`;
|
|
363
364
|
// record it
|
|
@@ -2,6 +2,7 @@ import { openLocation } from '@jbrowse/core/util/io';
|
|
|
2
2
|
import { objectHash } from '@jbrowse/core/util';
|
|
3
3
|
import { generateUnknownTrackConf, generateUnsupportedTrackConf, guessAdapter, guessTrackType, UNKNOWN, UNSUPPORTED, } from '@jbrowse/core/util/tracks';
|
|
4
4
|
export function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
|
|
5
|
+
var _a;
|
|
5
6
|
const jb2TrackConfig = {
|
|
6
7
|
trackId: objectHash(jb1TrackConfig),
|
|
7
8
|
name: jb1TrackConfig.key || jb1TrackConfig.label,
|
|
@@ -11,8 +12,7 @@ export function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
|
|
|
11
12
|
if (description) {
|
|
12
13
|
jb2TrackConfig.description = description;
|
|
13
14
|
}
|
|
14
|
-
const category = jb1TrackConfig.category ||
|
|
15
|
-
(jb1TrackConfig.metadata && jb1TrackConfig.metadata.category);
|
|
15
|
+
const category = jb1TrackConfig.category || ((_a = jb1TrackConfig.metadata) === null || _a === void 0 ? void 0 : _a.category);
|
|
16
16
|
jb2TrackConfig.category = category ? category.split(/\s*\/\s*/) : [];
|
|
17
17
|
const { storeClass } = jb1TrackConfig;
|
|
18
18
|
if (!jb1TrackConfig.urlTemplate) {
|
|
@@ -12,7 +12,7 @@ export default function (pluginManager) {
|
|
|
12
12
|
}))
|
|
13
13
|
.actions(self => ({
|
|
14
14
|
async connect() {
|
|
15
|
-
var _a;
|
|
15
|
+
var _a, _b;
|
|
16
16
|
const session = getSession(self);
|
|
17
17
|
try {
|
|
18
18
|
const dataDirLocation = getConf(self, 'dataDirLocation');
|
|
@@ -23,14 +23,11 @@ export default function (pluginManager) {
|
|
|
23
23
|
if (!assemblyName) {
|
|
24
24
|
throw new Error('assembly name required for JBrowse 1 connection');
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
26
|
+
const conf = session.assemblies.find(a => readConfObject(a, 'name') === assemblyName);
|
|
27
|
+
if (!conf) {
|
|
28
28
|
throw new Error(`Assembly "${assemblyName}" not found`);
|
|
29
29
|
}
|
|
30
|
-
const sequenceAdapter = readConfObject(
|
|
31
|
-
'sequence',
|
|
32
|
-
'adapter',
|
|
33
|
-
]);
|
|
30
|
+
const sequenceAdapter = readConfObject(conf, ['sequence', 'adapter']);
|
|
34
31
|
// @ts-expect-error
|
|
35
32
|
const jb2Tracks = (_a = config.tracks) === null || _a === void 0 ? void 0 : _a.map(jb1Track => ({
|
|
36
33
|
...convertTrackConfig(jb1Track, config.dataRoot || '', sequenceAdapter),
|
|
@@ -41,7 +38,7 @@ export default function (pluginManager) {
|
|
|
41
38
|
catch (error) {
|
|
42
39
|
console.error(error);
|
|
43
40
|
session.notify(`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');
|
|
44
|
-
session.breakConnection(self.configuration);
|
|
41
|
+
(_b = session.breakConnection) === null || _b === void 0 ? void 0 : _b.call(session, self.configuration);
|
|
45
42
|
}
|
|
46
43
|
},
|
|
47
44
|
}));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import getValue from 'get-value';
|
|
2
2
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
3
|
export function isTrack(arg) {
|
|
4
|
-
return arg
|
|
4
|
+
return (arg === null || arg === void 0 ? void 0 : arg.label) && typeof arg.label === 'string';
|
|
5
5
|
}
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
7
|
export function isSource(arg) {
|
|
8
|
-
return arg
|
|
8
|
+
return (arg === null || arg === void 0 ? void 0 : arg.url) && typeof arg.url === 'string';
|
|
9
9
|
}
|
|
10
10
|
export function deepUpdate(a, b) {
|
|
11
11
|
for (const prop of Object.keys(b)) {
|
|
@@ -6,7 +6,7 @@ import crc32 from 'buffer-crc32';
|
|
|
6
6
|
export default class HttpMap {
|
|
7
7
|
constructor(args) {
|
|
8
8
|
// make sure url has a trailing slash
|
|
9
|
-
this.url =
|
|
9
|
+
this.url = args.url.endsWith('/') ? args.url : `${args.url}/`;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* loads meta.json file from names directory and reads number of hash_bits used
|
|
@@ -14,7 +14,7 @@ interface SearchResults {
|
|
|
14
14
|
} | string)[];
|
|
15
15
|
exact: [string, number, string, string, number, number][];
|
|
16
16
|
}
|
|
17
|
-
export type NamesIndexRecord = string |
|
|
17
|
+
export type NamesIndexRecord = string | (string | number)[];
|
|
18
18
|
type IndexFile = Record<string, SearchResults>;
|
|
19
19
|
export default class JBrowse1TextSearchAdapter extends BaseAdapter implements BaseTextSearchAdapter {
|
|
20
20
|
httpMap: HttpMap;
|
|
@@ -41,8 +41,9 @@ export default class NCListAdapter extends BaseFeatureDataAdapter {
|
|
|
41
41
|
return new NCListFeature(ncFeature, undefined, `${this.id}-${ncFeature.id()}`);
|
|
42
42
|
}
|
|
43
43
|
async hasDataForRefName(refName) {
|
|
44
|
+
var _a;
|
|
44
45
|
const root = await this.nclist.getDataRoot(refName);
|
|
45
|
-
return !!(root
|
|
46
|
+
return !!((_a = root === null || root === void 0 ? void 0 : root.stats) === null || _a === void 0 ? void 0 : _a.featureCount);
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
48
49
|
* NCList is unable to get list of ref names so returns empty
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-legacy-jbrowse",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "JBrowse 2 plugin for connecting to and reading JBrowse 1 data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@jbrowse/core": "^2.0.0",
|
|
47
47
|
"mobx": "^6.0.0",
|
|
48
|
-
"mobx-react": "^
|
|
48
|
+
"mobx-react": "^9.0.0",
|
|
49
49
|
"mobx-state-tree": "^5.0.0",
|
|
50
50
|
"rxjs": "^7.0.0"
|
|
51
51
|
},
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"distModule": "esm/index.js",
|
|
56
56
|
"srcModule": "src/index.ts",
|
|
57
57
|
"module": "esm/index.js",
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "2cda1611eebd12517f2a3cfc1b612face27005d4"
|
|
59
59
|
}
|