@jbrowse/plugin-legacy-jbrowse 2.16.1 → 2.18.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.
- package/dist/GuessNCList/index.d.ts +1 -1
- package/dist/JBrowse1Connection/configSchema.d.ts +0 -6
- package/dist/JBrowse1Connection/configSchema.js +2 -14
- package/dist/JBrowse1Connection/index.d.ts +1 -1
- package/dist/JBrowse1Connection/index.js +1 -2
- package/dist/JBrowse1Connection/jb1ConfigLoad.d.ts +1 -1
- package/dist/JBrowse1Connection/jb1ConfigLoad.js +5 -44
- package/dist/JBrowse1Connection/jb1ConfigParse.d.ts +1 -8
- package/dist/JBrowse1Connection/jb1ConfigParse.js +1 -41
- package/dist/JBrowse1Connection/jb1ToJb2.d.ts +1 -1
- package/dist/JBrowse1Connection/jb1ToJb2.js +1 -5
- package/dist/JBrowse1Connection/model.d.ts +5 -5
- package/dist/JBrowse1Connection/model.js +1 -3
- package/dist/JBrowse1Connection/util.d.ts +2 -21
- package/dist/JBrowse1Connection/util.js +9 -58
- package/dist/JBrowse1TextSearchAdapter/HttpMap.d.ts +0 -20
- package/dist/JBrowse1TextSearchAdapter/HttpMap.js +1 -27
- package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +5 -9
- package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +1 -7
- package/dist/JBrowse1TextSearchAdapter/configSchema.d.ts +0 -9
- package/dist/JBrowse1TextSearchAdapter/configSchema.js +1 -17
- package/dist/JBrowse1TextSearchAdapter/index.d.ts +1 -1
- package/dist/JBrowse1TextSearchAdapter/index.js +0 -1
- package/dist/NCListAdapter/NCListAdapter.d.ts +7 -22
- package/dist/NCListAdapter/NCListAdapter.js +3 -19
- package/dist/NCListAdapter/NCListFeature.d.ts +1 -16
- package/dist/NCListAdapter/NCListFeature.js +0 -19
- package/dist/NCListAdapter/configSchema.d.ts +0 -6
- package/dist/NCListAdapter/configSchema.js +1 -10
- package/dist/NCListAdapter/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/esm/GuessNCList/index.d.ts +1 -1
- package/esm/JBrowse1Connection/configSchema.d.ts +0 -6
- package/esm/JBrowse1Connection/configSchema.js +2 -14
- package/esm/JBrowse1Connection/index.d.ts +1 -1
- package/esm/JBrowse1Connection/index.js +1 -2
- package/esm/JBrowse1Connection/jb1ConfigLoad.d.ts +1 -1
- package/esm/JBrowse1Connection/jb1ConfigLoad.js +7 -46
- package/esm/JBrowse1Connection/jb1ConfigParse.d.ts +1 -8
- package/esm/JBrowse1Connection/jb1ConfigParse.js +1 -41
- package/esm/JBrowse1Connection/jb1ToJb2.d.ts +1 -1
- package/esm/JBrowse1Connection/jb1ToJb2.js +2 -6
- package/esm/JBrowse1Connection/model.d.ts +5 -5
- package/esm/JBrowse1Connection/model.js +1 -3
- package/esm/JBrowse1Connection/util.d.ts +2 -21
- package/esm/JBrowse1Connection/util.js +8 -57
- package/esm/JBrowse1TextSearchAdapter/HttpMap.d.ts +0 -20
- package/esm/JBrowse1TextSearchAdapter/HttpMap.js +1 -27
- package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +5 -9
- package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +2 -8
- package/esm/JBrowse1TextSearchAdapter/configSchema.d.ts +0 -9
- package/esm/JBrowse1TextSearchAdapter/configSchema.js +1 -17
- package/esm/JBrowse1TextSearchAdapter/index.d.ts +1 -1
- package/esm/JBrowse1TextSearchAdapter/index.js +0 -1
- package/esm/NCListAdapter/NCListAdapter.d.ts +7 -22
- package/esm/NCListAdapter/NCListAdapter.js +4 -20
- package/esm/NCListAdapter/NCListFeature.d.ts +1 -16
- package/esm/NCListAdapter/NCListFeature.js +0 -19
- package/esm/NCListAdapter/configSchema.d.ts +0 -6
- package/esm/NCListAdapter/configSchema.js +1 -10
- package/esm/NCListAdapter/index.d.ts +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.js +3 -3
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function GuessNCListF(pluginManager: PluginManager): void;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
declare const JBrowse1Connection: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
/**
|
|
3
|
-
* #slot
|
|
4
|
-
*/
|
|
5
2
|
dataDirLocation: {
|
|
6
3
|
type: string;
|
|
7
4
|
defaultValue: {
|
|
@@ -10,9 +7,6 @@ declare const JBrowse1Connection: import("@jbrowse/core/configuration/configurat
|
|
|
10
7
|
};
|
|
11
8
|
description: string;
|
|
12
9
|
};
|
|
13
|
-
/**
|
|
14
|
-
* #slot
|
|
15
|
-
*/
|
|
16
10
|
assemblyNames: {
|
|
17
11
|
description: string;
|
|
18
12
|
type: string;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
|
|
4
3
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
|
|
5
|
+
function x() { }
|
|
9
6
|
const JBrowse1Connection = (0, configuration_1.ConfigurationSchema)('JBrowse1Connection', {
|
|
10
|
-
/**
|
|
11
|
-
* #slot
|
|
12
|
-
*/
|
|
13
7
|
dataDirLocation: {
|
|
14
8
|
type: 'fileLocation',
|
|
15
9
|
defaultValue: {
|
|
@@ -18,18 +12,12 @@ const JBrowse1Connection = (0, configuration_1.ConfigurationSchema)('JBrowse1Con
|
|
|
18
12
|
},
|
|
19
13
|
description: 'the location of the JBrowse 1 data directory, often something like http://mysite.com/jbrowse/data/',
|
|
20
14
|
},
|
|
21
|
-
/**
|
|
22
|
-
* #slot
|
|
23
|
-
*/
|
|
24
15
|
assemblyNames: {
|
|
25
16
|
description: 'name of the assembly the connection belongs to, should be a single entry',
|
|
26
17
|
type: 'stringArray',
|
|
27
18
|
defaultValue: [],
|
|
28
19
|
},
|
|
29
20
|
}, {
|
|
30
|
-
/**
|
|
31
|
-
* #baseConfiguration
|
|
32
|
-
*/
|
|
33
21
|
baseConfiguration: models_1.baseConnectionConfig,
|
|
34
22
|
});
|
|
35
23
|
exports.default = JBrowse1Connection;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function JBrowse1ConnectionF(pluginManager: PluginManager): void;
|
|
@@ -5,9 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.default = JBrowse1ConnectionF;
|
|
7
7
|
const ConnectionType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/ConnectionType"));
|
|
8
|
-
// locals
|
|
9
|
-
const model_1 = __importDefault(require("./model"));
|
|
10
8
|
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
9
|
+
const model_1 = __importDefault(require("./model"));
|
|
11
10
|
function JBrowse1ConnectionF(pluginManager) {
|
|
12
11
|
pluginManager.addConnectionType(() => new ConnectionType_1.default({
|
|
13
12
|
name: 'JBrowse1Connection',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Config, JBLocation } from './types';
|
|
2
2
|
export declare function fetchJb1(dataRoot?: JBLocation, baseConfig?: Config, baseConfigRoot?: JBLocation): Promise<Config>;
|
|
3
3
|
export declare function createFinalConfig(baseConfig: Config, defaults?: {
|
|
4
4
|
tracks: never[];
|
|
@@ -8,22 +8,14 @@ const io_1 = require("@jbrowse/core/util/io");
|
|
|
8
8
|
const jb1ConfigParse_1 = require("./jb1ConfigParse");
|
|
9
9
|
const util_1 = require("./util");
|
|
10
10
|
function isUriLocation(location) {
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
12
11
|
return location.uri !== undefined;
|
|
13
12
|
}
|
|
14
13
|
function isLocalPathLocation(location) {
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
16
14
|
return location.localPath !== undefined;
|
|
17
15
|
}
|
|
18
|
-
async function fetchJb1(
|
|
19
|
-
// eslint-disable-next-line unicorn/no-object-as-default-parameter
|
|
20
|
-
dataRoot = { uri: '', locationType: 'UriLocation' },
|
|
21
|
-
// eslint-disable-next-line unicorn/no-object-as-default-parameter
|
|
22
|
-
baseConfig = {
|
|
16
|
+
async function fetchJb1(dataRoot = { uri: '', locationType: 'UriLocation' }, baseConfig = {
|
|
23
17
|
include: ['{dataRoot}/trackList.json', '{dataRoot}/tracks.conf'],
|
|
24
|
-
},
|
|
25
|
-
// eslint-disable-next-line unicorn/no-object-as-default-parameter
|
|
26
|
-
baseConfigRoot = { uri: '', locationType: 'UriLocation' }) {
|
|
18
|
+
}, baseConfigRoot = { uri: '', locationType: 'UriLocation' }) {
|
|
27
19
|
const protocol = 'uri' in dataRoot ? 'uri' : 'localPath';
|
|
28
20
|
const dataRootReg = JSON.parse(JSON.stringify(dataRoot));
|
|
29
21
|
let dataRootLocation = '';
|
|
@@ -53,7 +45,6 @@ baseConfigRoot = { uri: '', locationType: 'UriLocation' }) {
|
|
|
53
45
|
for (const conf of ['jbrowse.conf', 'jbrowse_conf.json']) {
|
|
54
46
|
let fetchedConfig = null;
|
|
55
47
|
try {
|
|
56
|
-
// @ts-expect-error
|
|
57
48
|
fetchedConfig = await fetchConfigFile({
|
|
58
49
|
[baseProtocol]: `${baseConfigLocation}/${conf}`,
|
|
59
50
|
});
|
|
@@ -75,7 +66,7 @@ baseConfigRoot = { uri: '', locationType: 'UriLocation' }) {
|
|
|
75
66
|
return createFinalConfig(newConfig);
|
|
76
67
|
}
|
|
77
68
|
async function createFinalConfig(baseConfig, defaults = configDefaults) {
|
|
78
|
-
const configWithDefaults = (0, util_1.deepUpdate)((
|
|
69
|
+
const configWithDefaults = (0, util_1.deepUpdate)(structuredClone(defaults), baseConfig);
|
|
79
70
|
let finalConfig = await loadIncludes(configWithDefaults);
|
|
80
71
|
finalConfig = mergeConfigs(finalConfig, baseConfig) || finalConfig;
|
|
81
72
|
fillTemplates(finalConfig, finalConfig);
|
|
@@ -98,9 +89,6 @@ function parseJb1(config, url = '') {
|
|
|
98
89
|
}
|
|
99
90
|
return (0, jb1ConfigParse_1.parseJB1Conf)(config, url);
|
|
100
91
|
}
|
|
101
|
-
/**
|
|
102
|
-
* Merges config object b into a. Properties in b override those in a.
|
|
103
|
-
*/
|
|
104
92
|
function mergeConfigs(a, b) {
|
|
105
93
|
if (b === null) {
|
|
106
94
|
return null;
|
|
@@ -121,11 +109,8 @@ function mergeConfigs(a, b) {
|
|
|
121
109
|
}
|
|
122
110
|
else if (!noRecursiveMerge(prop) &&
|
|
123
111
|
prop in a &&
|
|
124
|
-
// @ts-expect-error
|
|
125
112
|
typeof b[prop] === 'object' &&
|
|
126
|
-
// @ts-expect-error
|
|
127
113
|
typeof a[prop] === 'object') {
|
|
128
|
-
// @ts-expect-error
|
|
129
114
|
a[prop] = (0, util_1.deepUpdate)(a[prop], b[prop]);
|
|
130
115
|
}
|
|
131
116
|
else if (prop === 'dataRoot') {
|
|
@@ -133,23 +118,17 @@ function mergeConfigs(a, b) {
|
|
|
133
118
|
(a[prop] === 'data' && b[prop] !== undefined)) {
|
|
134
119
|
a[prop] = b[prop];
|
|
135
120
|
}
|
|
136
|
-
// @ts-expect-error
|
|
137
121
|
}
|
|
138
122
|
else if (a[prop] === undefined || b[prop] !== undefined) {
|
|
139
|
-
// @ts-expect-error
|
|
140
123
|
a[prop] = b[prop];
|
|
141
124
|
}
|
|
142
125
|
}
|
|
143
126
|
return a;
|
|
144
127
|
}
|
|
145
|
-
/**
|
|
146
|
-
* Special-case merging of two `tracks` configuration arrays.
|
|
147
|
-
*/
|
|
148
128
|
function mergeTrackConfigs(a, b) {
|
|
149
129
|
if (!b.length) {
|
|
150
130
|
return a;
|
|
151
131
|
}
|
|
152
|
-
// index the tracks in `a` by track label
|
|
153
132
|
const aTracks = {};
|
|
154
133
|
a.forEach((t, i) => {
|
|
155
134
|
t.index = i;
|
|
@@ -166,19 +145,14 @@ function mergeTrackConfigs(a, b) {
|
|
|
166
145
|
});
|
|
167
146
|
return a;
|
|
168
147
|
}
|
|
169
|
-
/**
|
|
170
|
-
* Recursively fetch, parse, and merge all the includes in the given config
|
|
171
|
-
* object. Calls the callback with the resulting configuration when finished.
|
|
172
|
-
* @param inputConfig - Config to load includes into
|
|
173
|
-
*/
|
|
174
148
|
async function loadIncludes(inputConfig) {
|
|
175
|
-
inputConfig = (
|
|
149
|
+
inputConfig = structuredClone(inputConfig);
|
|
176
150
|
async function loadRecur(config, upstreamConf) {
|
|
177
151
|
const sourceUrl = config.sourceUrl || config.baseUrl;
|
|
178
152
|
if (!sourceUrl) {
|
|
179
153
|
throw new Error(`Could not determine source URL: ${JSON.stringify(config)}`);
|
|
180
154
|
}
|
|
181
|
-
const newUpstreamConf = mergeConfigs((
|
|
155
|
+
const newUpstreamConf = mergeConfigs(structuredClone(upstreamConf), config);
|
|
182
156
|
if (!newUpstreamConf) {
|
|
183
157
|
throw new Error('Problem merging configs');
|
|
184
158
|
}
|
|
@@ -204,16 +178,13 @@ function regularizeIncludes(includes) {
|
|
|
204
178
|
if (!includes) {
|
|
205
179
|
return [];
|
|
206
180
|
}
|
|
207
|
-
// coerce include to an array
|
|
208
181
|
if (!Array.isArray(includes)) {
|
|
209
182
|
includes = [includes];
|
|
210
183
|
}
|
|
211
184
|
return includes.map((include) => {
|
|
212
|
-
// coerce bare strings in the includes to URLs
|
|
213
185
|
if (typeof include === 'string') {
|
|
214
186
|
include = { url: include };
|
|
215
187
|
}
|
|
216
|
-
// set defaults for format and version
|
|
217
188
|
if (!('format' in include)) {
|
|
218
189
|
include.format = include.url.endsWith('.conf') ? 'conf' : 'JB_json';
|
|
219
190
|
}
|
|
@@ -239,15 +210,10 @@ function fillTemplates(subconfig, config) {
|
|
|
239
210
|
}
|
|
240
211
|
}
|
|
241
212
|
else if (typeof subconfig === 'string') {
|
|
242
|
-
// @ts-expect-error
|
|
243
213
|
return (0, util_1.fillTemplate)(subconfig, config);
|
|
244
214
|
}
|
|
245
215
|
return subconfig;
|
|
246
216
|
}
|
|
247
|
-
/**
|
|
248
|
-
* list of config properties that should not be recursively merged
|
|
249
|
-
* @param propName - name of config property
|
|
250
|
-
*/
|
|
251
217
|
function noRecursiveMerge(propName) {
|
|
252
218
|
return propName === 'datasets';
|
|
253
219
|
}
|
|
@@ -277,11 +243,6 @@ const configDefaults = {
|
|
|
277
243
|
highlightSearchedRegions: false,
|
|
278
244
|
highResolutionMode: 'auto',
|
|
279
245
|
};
|
|
280
|
-
/**
|
|
281
|
-
* Examine the loaded and merged configuration for errors. Throws
|
|
282
|
-
* exceptions if it finds anything amiss.
|
|
283
|
-
* @returns nothing meaningful
|
|
284
|
-
*/
|
|
285
246
|
function validateConfig(config) {
|
|
286
247
|
if (!config.tracks) {
|
|
287
248
|
config.tracks = [];
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { Config } from './types';
|
|
1
|
+
import type { Config } from './types';
|
|
2
2
|
export declare function parseJB1Json(config: Config | string, url: string): Config;
|
|
3
3
|
export declare function parseJB1Conf(config: string, url: string): Config;
|
|
4
|
-
/**
|
|
5
|
-
* Applies defaults and any other necessary tweaks to the loaded configuration.
|
|
6
|
-
* @param conf - the object containing the configuration, which it modifies
|
|
7
|
-
* in-place
|
|
8
|
-
* @param url - URL of the config file
|
|
9
|
-
* @returns the same object it was passed
|
|
10
|
-
*/
|
|
11
4
|
export declare function regularizeConf(conf: Config, url: string): Config;
|
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.parseJB1Json = parseJB1Json;
|
|
7
7
|
exports.parseJB1Conf = parseJB1Conf;
|
|
8
8
|
exports.regularizeConf = regularizeConf;
|
|
9
|
-
|
|
9
|
+
const util_1 = require("@jbrowse/core/util");
|
|
10
10
|
const get_value_1 = __importDefault(require("get-value"));
|
|
11
11
|
const set_value_1 = __importDefault(require("set-value"));
|
|
12
|
-
const util_1 = require("@jbrowse/core/util");
|
|
13
12
|
const util_2 = require("./util");
|
|
14
13
|
function parseJB1Json(config, url) {
|
|
15
14
|
if (typeof config === 'string') {
|
|
@@ -51,12 +50,10 @@ function parse(text, url) {
|
|
|
51
50
|
if (value !== undefined) {
|
|
52
51
|
let parsedValue;
|
|
53
52
|
try {
|
|
54
|
-
// parse json
|
|
55
53
|
const match = /^json:(.+)/i.exec(value);
|
|
56
54
|
if (match) {
|
|
57
55
|
parsedValue = JSON.parse(match[1]);
|
|
58
56
|
}
|
|
59
|
-
// parse numbers if it looks numeric
|
|
60
57
|
else if (/^[+-]?[\d.,]+([eE][-+]?\d+)?$/.test(value)) {
|
|
61
58
|
parsedValue = Number.parseFloat(value.replaceAll(',', ''));
|
|
62
59
|
}
|
|
@@ -96,10 +93,8 @@ function parse(text, url) {
|
|
|
96
93
|
text.split(/\n|\r\n|\r/).forEach((textLine, i) => {
|
|
97
94
|
lineNumber = i + 1;
|
|
98
95
|
const line = textLine.replace(/^\s*#.+/, '');
|
|
99
|
-
// new section
|
|
100
96
|
let match;
|
|
101
97
|
if ((match = /^\s*\[([^\]]+)/.exec(line))) {
|
|
102
|
-
// new section
|
|
103
98
|
recordVal();
|
|
104
99
|
keyPath = undefined;
|
|
105
100
|
value = undefined;
|
|
@@ -108,7 +103,6 @@ function parse(text, url) {
|
|
|
108
103
|
section = [];
|
|
109
104
|
}
|
|
110
105
|
}
|
|
111
|
-
// new value
|
|
112
106
|
else if ((match = line.match(value === undefined ? /^([^+=]+)(\+?=)(.*)/ : /^(\S[^+=]+)(\+?=)(.*)/))) {
|
|
113
107
|
recordVal();
|
|
114
108
|
keyPath = match[1].trim().split(/\s*\.\s*/);
|
|
@@ -118,19 +112,16 @@ function parse(text, url) {
|
|
|
118
112
|
}
|
|
119
113
|
value = match[3].trim();
|
|
120
114
|
}
|
|
121
|
-
// add to existing array value
|
|
122
115
|
else if (keyPath !== undefined &&
|
|
123
116
|
(match = /^\s{0,4}\+\s*(.+)/.exec(line))) {
|
|
124
117
|
recordVal();
|
|
125
118
|
operation = '+=';
|
|
126
119
|
value = match[1].trim();
|
|
127
120
|
}
|
|
128
|
-
// add to existing value
|
|
129
121
|
else if (value !== undefined && (match = /^\s+(\S.*)/.exec(line))) {
|
|
130
122
|
const m = match[1];
|
|
131
123
|
value += value.length ? ` ${m.trim()}` : m.trim();
|
|
132
124
|
}
|
|
133
|
-
// done with last value
|
|
134
125
|
else {
|
|
135
126
|
recordVal();
|
|
136
127
|
keyPath = undefined;
|
|
@@ -140,21 +131,11 @@ function parse(text, url) {
|
|
|
140
131
|
recordVal();
|
|
141
132
|
return data;
|
|
142
133
|
}
|
|
143
|
-
/**
|
|
144
|
-
* Applies defaults and any other necessary tweaks to the loaded configuration.
|
|
145
|
-
* @param conf - the object containing the configuration, which it modifies
|
|
146
|
-
* in-place
|
|
147
|
-
* @param url - URL of the config file
|
|
148
|
-
* @returns the same object it was passed
|
|
149
|
-
*/
|
|
150
134
|
function regularizeConf(conf, url) {
|
|
151
|
-
// if tracks is not an array, convert it to one
|
|
152
135
|
if (conf.tracks && !Array.isArray(conf.tracks)) {
|
|
153
|
-
// if it's a single track config, wrap it in an arrayref
|
|
154
136
|
if ((0, util_2.isTrack)(conf.tracks)) {
|
|
155
137
|
conf.tracks = [conf.tracks];
|
|
156
138
|
}
|
|
157
|
-
// otherwise, coerce it to an array
|
|
158
139
|
else {
|
|
159
140
|
const tracks = [];
|
|
160
141
|
for (const label of Object.keys(conf.tracks)) {
|
|
@@ -169,10 +150,8 @@ function regularizeConf(conf, url) {
|
|
|
169
150
|
conf.tracks = tracks;
|
|
170
151
|
}
|
|
171
152
|
}
|
|
172
|
-
// regularize trackMetadata.sources
|
|
173
153
|
const meta = conf.trackMetadata;
|
|
174
154
|
if (meta === null || meta === void 0 ? void 0 : meta.sources) {
|
|
175
|
-
// if it's a single source config, wrap it in an arrayref
|
|
176
155
|
if (typeof meta.sources === 'string') {
|
|
177
156
|
meta.sources = [meta.sources];
|
|
178
157
|
}
|
|
@@ -190,7 +169,6 @@ function regularizeConf(conf, url) {
|
|
|
190
169
|
}
|
|
191
170
|
meta.sources = sources;
|
|
192
171
|
}
|
|
193
|
-
// coerce any string source defs to be URLs, and try to detect their types
|
|
194
172
|
meta.sources = meta.sources.map((sourceDef) => {
|
|
195
173
|
if (typeof sourceDef === 'string') {
|
|
196
174
|
const newSourceDef = { url: sourceDef };
|
|
@@ -212,8 +190,6 @@ function regularizeConf(conf, url) {
|
|
|
212
190
|
conf.baseUrl += '/';
|
|
213
191
|
}
|
|
214
192
|
if (conf.sourceUrl) {
|
|
215
|
-
// set a default baseUrl in each of the track and store confs, and the names
|
|
216
|
-
// conf, if needed
|
|
217
193
|
const addBase = [];
|
|
218
194
|
if (conf.tracks) {
|
|
219
195
|
addBase.push(...conf.tracks);
|
|
@@ -229,7 +205,6 @@ function regularizeConf(conf, url) {
|
|
|
229
205
|
t.baseUrl = conf.baseUrl || '/';
|
|
230
206
|
}
|
|
231
207
|
});
|
|
232
|
-
// resolve the refSeqs and nameUrl if present
|
|
233
208
|
if (conf.refSeqs && typeof conf.refSeqs === 'string') {
|
|
234
209
|
conf.refSeqs = new URL(conf.refSeqs, conf.sourceUrl).href;
|
|
235
210
|
}
|
|
@@ -239,14 +214,11 @@ function regularizeConf(conf, url) {
|
|
|
239
214
|
}
|
|
240
215
|
conf.stores = conf.stores || {};
|
|
241
216
|
(conf.tracks || []).forEach((trackConfig) => {
|
|
242
|
-
// if there is a `config` subpart, just copy its keys in to the top-level
|
|
243
|
-
// config
|
|
244
217
|
if (trackConfig.config) {
|
|
245
218
|
const c = trackConfig.config;
|
|
246
219
|
trackConfig.config = undefined;
|
|
247
220
|
trackConfig = { ...c, ...trackConfig };
|
|
248
221
|
}
|
|
249
|
-
// skip if it's a new-style track def
|
|
250
222
|
if (trackConfig.store) {
|
|
251
223
|
return;
|
|
252
224
|
}
|
|
@@ -277,11 +249,6 @@ function regularizeConf(conf, url) {
|
|
|
277
249
|
});
|
|
278
250
|
return conf;
|
|
279
251
|
}
|
|
280
|
-
/**
|
|
281
|
-
* prefix class name with `root` if it contains no slashes
|
|
282
|
-
* @param root - Prefix root
|
|
283
|
-
* @param className - class name
|
|
284
|
-
*/
|
|
285
252
|
function regularizeClass(root, className) {
|
|
286
253
|
if (!className) {
|
|
287
254
|
return '';
|
|
@@ -346,8 +313,6 @@ function guessStoreClass(trackConfig, urlTemplate) {
|
|
|
346
313
|
}
|
|
347
314
|
function synthesizeTrackStoreConfig(mainConf, trackConfig) {
|
|
348
315
|
var _a;
|
|
349
|
-
// figure out what data store class to use with the track, applying some
|
|
350
|
-
// defaults if it is not explicit in the configuration
|
|
351
316
|
const { urlTemplate = '' } = trackConfig;
|
|
352
317
|
const storeClass = trackConfig.storeClass
|
|
353
318
|
? regularizeClass('JBrowse/Store', trackConfig.storeClass)
|
|
@@ -356,10 +321,7 @@ function synthesizeTrackStoreConfig(mainConf, trackConfig) {
|
|
|
356
321
|
console.warn(`Unable to determine an appropriate data store to use with track '${trackConfig.label}', please explicitly specify a storeClass in the configuration.`);
|
|
357
322
|
return;
|
|
358
323
|
}
|
|
359
|
-
// synthesize a separate store conf
|
|
360
324
|
const storeConf = { ...trackConfig, type: storeClass };
|
|
361
|
-
// if this is the first sequence store we see, and we have no refseqs store
|
|
362
|
-
// defined explicitly, make this the refseqs store.
|
|
363
325
|
storeConf.name =
|
|
364
326
|
(storeClass === 'JBrowse/Store/Sequence/StaticChunked' ||
|
|
365
327
|
storeClass === 'JBrowse/Store/Sequence/IndexedFasta' ||
|
|
@@ -371,11 +333,9 @@ function synthesizeTrackStoreConfig(mainConf, trackConfig) {
|
|
|
371
333
|
!((_a = mainConf.stores) === null || _a === void 0 ? void 0 : _a.refseqs)
|
|
372
334
|
? 'refseqs'
|
|
373
335
|
: `store${(0, util_1.objectHash)(storeConf)}`;
|
|
374
|
-
// record it
|
|
375
336
|
if (!mainConf.stores) {
|
|
376
337
|
mainConf.stores = {};
|
|
377
338
|
}
|
|
378
339
|
mainConf.stores[storeConf.name] = storeConf;
|
|
379
|
-
// connect it to the track conf
|
|
380
340
|
trackConfig.store = storeConf.name;
|
|
381
341
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertTrackConfig = convertTrackConfig;
|
|
4
4
|
exports.createRefSeqsAdapter = createRefSeqsAdapter;
|
|
5
|
-
const io_1 = require("@jbrowse/core/util/io");
|
|
6
5
|
const util_1 = require("@jbrowse/core/util");
|
|
6
|
+
const io_1 = require("@jbrowse/core/util/io");
|
|
7
7
|
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
8
8
|
function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
|
|
9
9
|
var _a, _b, _c, _d, _e;
|
|
@@ -317,8 +317,6 @@ function convertTrackConfig(jb1TrackConfig, dataRoot, sequenceAdapter) {
|
|
|
317
317
|
};
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
|
-
// If we don't recognize the store class, make a best effort to guess by file
|
|
321
|
-
// type
|
|
322
320
|
jb2TrackConfig.adapter = (0, tracks_1.guessAdapter)({ uri: urlTemplate, locationType: 'UriLocation' }, undefined, urlTemplate);
|
|
323
321
|
if (jb2TrackConfig.adapter.type === tracks_1.UNSUPPORTED) {
|
|
324
322
|
return (0, tracks_1.generateUnsupportedTrackConf)(jb2TrackConfig.name, urlTemplate, jb2TrackConfig.category);
|
|
@@ -354,12 +352,10 @@ function generateFromConfigTrackConfig(jb1TrackConfig, jb2TrackConfig) {
|
|
|
354
352
|
}
|
|
355
353
|
async function createRefSeqsAdapter(refSeqs) {
|
|
356
354
|
if (typeof refSeqs === 'string') {
|
|
357
|
-
// assume refSeqs is a url if it is string
|
|
358
355
|
refSeqs = {
|
|
359
356
|
url: refSeqs,
|
|
360
357
|
};
|
|
361
358
|
}
|
|
362
|
-
// check refseq urls
|
|
363
359
|
if (refSeqs.url) {
|
|
364
360
|
if (/.fai$/.exec(refSeqs.url)) {
|
|
365
361
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
3
3
|
name: import("mobx-state-tree").ISimpleType<string>;
|
|
4
4
|
tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
|
|
@@ -46,7 +46,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
46
46
|
connect(_arg: import("@jbrowse/core/configuration").AnyConfigurationModel): void;
|
|
47
47
|
} & {
|
|
48
48
|
afterAttach(): void;
|
|
49
|
-
addTrackConf(trackConf: ({
|
|
49
|
+
addTrackConf(trackConf: Record<string, unknown> | ({
|
|
50
50
|
[x: string]: any;
|
|
51
51
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
52
52
|
setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
|
|
@@ -56,8 +56,8 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
56
56
|
[x: string]: any;
|
|
57
57
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
|
|
58
58
|
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
|
|
59
|
-
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)
|
|
60
|
-
addTrackConfs(trackConfs: (({
|
|
59
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)): any;
|
|
60
|
+
addTrackConfs(trackConfs: (Record<string, unknown> | ({
|
|
61
61
|
[x: string]: any;
|
|
62
62
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
63
63
|
setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
|
|
@@ -67,7 +67,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
67
67
|
[x: string]: any;
|
|
68
68
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
|
|
69
69
|
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
|
|
70
|
-
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)
|
|
70
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>))[]): void;
|
|
71
71
|
setTrackConfs(trackConfs: import("@jbrowse/core/configuration").AnyConfigurationModel[]): void;
|
|
72
72
|
clear(): void;
|
|
73
73
|
} & {
|
|
@@ -28,10 +28,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.default = stateModelFactory;
|
|
30
30
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
31
|
-
const util_1 = require("@jbrowse/core/util");
|
|
32
31
|
const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
|
|
32
|
+
const util_1 = require("@jbrowse/core/util");
|
|
33
33
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
34
|
-
// locals
|
|
35
34
|
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
36
35
|
function stateModelFactory(pluginManager) {
|
|
37
36
|
return mobx_state_tree_1.types
|
|
@@ -57,7 +56,6 @@ function stateModelFactory(pluginManager) {
|
|
|
57
56
|
throw new Error(`Assembly "${assemblyName}" not found`);
|
|
58
57
|
}
|
|
59
58
|
const sequenceAdapter = (0, configuration_1.readConfObject)(conf, ['sequence', 'adapter']);
|
|
60
|
-
// @ts-expect-error
|
|
61
59
|
const jb2Tracks = (_a = config.tracks) === null || _a === void 0 ? void 0 : _a.map(jb1Track => ({
|
|
62
60
|
...convertTrackConfig(jb1Track, config.dataRoot || '', sequenceAdapter),
|
|
63
61
|
assemblyNames: [assemblyName],
|
|
@@ -1,27 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Source, Track } from './types';
|
|
2
2
|
export declare function isTrack(arg: any): arg is Track;
|
|
3
3
|
export declare function isSource(arg: any): arg is Source;
|
|
4
|
-
/**
|
|
5
|
-
* updates a with values from b, recursively
|
|
6
|
-
*/
|
|
7
4
|
type Obj = Record<string, any>;
|
|
8
5
|
export declare function deepUpdate(a: Obj, b: Obj): Obj;
|
|
9
|
-
/**
|
|
10
|
-
* replace variables in a template string with values
|
|
11
|
-
*
|
|
12
|
-
* @param template - String with variable names in curly brackets
|
|
13
|
-
* e.g., `http://foo/{bar}?arg={baz.foo}`
|
|
14
|
-
* @param fillWith - object with attribute-value mappings
|
|
15
|
-
* e.g., `{ 'bar': 'someurl', 'baz': { 'foo': 42 } }`
|
|
16
|
-
* @returns the template string with variables in fillWith replaced
|
|
17
|
-
* e.g., 'htp://foo/someurl?arg=valueforbaz'
|
|
18
|
-
*/
|
|
19
6
|
export declare function fillTemplate(template: string, fillWith: Obj): string;
|
|
20
|
-
|
|
21
|
-
* Clones objects (including DOM nodes) and all children.
|
|
22
|
-
* Warning: do not clone cyclic structures
|
|
23
|
-
* (Lifted from dojo https://github.com/dojo/dojo/blob/master/_base/lang.js)
|
|
24
|
-
* @param src - The object to clone
|
|
25
|
-
*/
|
|
26
|
-
export declare function clone(src: any): any;
|
|
7
|
+
export declare function structuredClone(src: any): any;
|
|
27
8
|
export {};
|