@jbrowse/img 2.13.1 → 2.14.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/index.js +6 -5
- package/dist/renderRegion.js +39 -22
- package/dist/setupEnv.js +1 -1
- package/dist/util.js +1 -1
- package/esm/index.js +6 -5
- package/esm/renderRegion.js +39 -22
- package/esm/setupEnv.js +1 -1
- package/esm/util.js +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -13,19 +13,20 @@ const setupEnv_1 = __importDefault(require("./setupEnv"));
|
|
|
13
13
|
(0, setupEnv_1.default)();
|
|
14
14
|
const err = console.error;
|
|
15
15
|
console.error = (...p) => {
|
|
16
|
-
if (
|
|
16
|
+
if (!/useLayoutEffect/.exec(`${p[0]}`)) {
|
|
17
17
|
err(p);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
const warn = console.warn;
|
|
21
21
|
console.warn = (...p) => {
|
|
22
|
-
if (
|
|
22
|
+
if (!/estimation reached timeout/.exec(`${p[0]}`)) {
|
|
23
23
|
warn(p);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
// note: yargs is actually unused except for printing help
|
|
27
|
-
//
|
|
28
|
-
//
|
|
26
|
+
// note: yargs is actually unused except for printing help we do custom command
|
|
27
|
+
// line parsing, see parseArgv.ts
|
|
28
|
+
//
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises,@typescript-eslint/no-unused-expressions
|
|
29
30
|
yargs_1.default
|
|
30
31
|
.command('jb2export', 'Creates a jbrowse 2 image snapshot')
|
|
31
32
|
.option('config', {
|
package/dist/renderRegion.js
CHANGED
|
@@ -17,7 +17,7 @@ function read(file) {
|
|
|
17
17
|
res = JSON.parse(fs_1.default.readFileSync(file, 'utf8'));
|
|
18
18
|
}
|
|
19
19
|
catch (e) {
|
|
20
|
-
throw new Error(`Failed to parse ${file} as JSON, use --fasta if you mean to pass a FASTA file
|
|
20
|
+
throw new Error(`Failed to parse ${file} as JSON, use --fasta if you mean to pass a FASTA file`, { cause: e });
|
|
21
21
|
}
|
|
22
22
|
return res;
|
|
23
23
|
}
|
|
@@ -40,8 +40,10 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
40
40
|
var _a;
|
|
41
41
|
const assemblyData = asm && fs_1.default.existsSync(asm) ? read(asm) : undefined;
|
|
42
42
|
const tracksData = tracks ? read(tracks) : undefined;
|
|
43
|
-
const configData =
|
|
44
|
-
let sessionData = session
|
|
43
|
+
const configData = config ? read(config) : {};
|
|
44
|
+
let sessionData = session
|
|
45
|
+
? read(session)
|
|
46
|
+
: undefined;
|
|
45
47
|
if (config) {
|
|
46
48
|
addRelativePaths(configData, path_1.default.dirname(path_1.default.resolve(config)));
|
|
47
49
|
}
|
|
@@ -60,6 +62,7 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
60
62
|
configData.assembly = assemblyData;
|
|
61
63
|
}
|
|
62
64
|
// else check if it was an assembly name in a config file
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
63
66
|
else if ((_a = configData.assemblies) === null || _a === void 0 ? void 0 : _a.length) {
|
|
64
67
|
configData.assemblies.find(entry => entry.name === asm);
|
|
65
68
|
if (asm) {
|
|
@@ -84,8 +87,8 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
84
87
|
adapter: {
|
|
85
88
|
type: bgzip ? 'BgzipFastaAdapter' : 'IndexedFastaAdapter',
|
|
86
89
|
fastaLocation: makeLocation(fasta),
|
|
87
|
-
faiLocation: makeLocation(fasta
|
|
88
|
-
gziLocation: bgzip ? makeLocation(fasta
|
|
90
|
+
faiLocation: makeLocation(`${fasta}.fai`),
|
|
91
|
+
gziLocation: bgzip ? makeLocation(`${fasta}.gzi`) : undefined,
|
|
89
92
|
},
|
|
90
93
|
},
|
|
91
94
|
};
|
|
@@ -107,12 +110,14 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
// throw if still no assembly
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
110
114
|
if (!configData.assembly) {
|
|
111
115
|
throw new Error('no assembly specified, use --fasta to supply an indexed FASTA file (generated with samtools faidx yourfile.fa). see README for alternatives with --assembly and --config');
|
|
112
116
|
}
|
|
113
117
|
if (tracksData) {
|
|
114
118
|
configData.tracks = tracksData;
|
|
115
119
|
}
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
116
121
|
else if (!configData.tracks) {
|
|
117
122
|
configData.tracks = [];
|
|
118
123
|
}
|
|
@@ -121,6 +126,9 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
121
126
|
const [type, opts] = track;
|
|
122
127
|
const [file, ...rest] = opts;
|
|
123
128
|
const index = (_a = rest.find(r => r.startsWith('index:'))) === null || _a === void 0 ? void 0 : _a.replace('index:', '');
|
|
129
|
+
if (!file) {
|
|
130
|
+
throw new Error('no file specified');
|
|
131
|
+
}
|
|
124
132
|
if (type === 'bam') {
|
|
125
133
|
configData.tracks = [
|
|
126
134
|
...configData.tracks,
|
|
@@ -133,7 +141,7 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
133
141
|
type: 'BamAdapter',
|
|
134
142
|
bamLocation: makeLocation(file),
|
|
135
143
|
index: {
|
|
136
|
-
location: makeLocation(index || file
|
|
144
|
+
location: makeLocation(index || `${file}.bai`),
|
|
137
145
|
indexType: (index === null || index === void 0 ? void 0 : index.endsWith('.csi')) ? 'CSI' : 'BAI',
|
|
138
146
|
},
|
|
139
147
|
sequenceAdapter: configData.assembly.sequence.adapter,
|
|
@@ -143,7 +151,7 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
143
151
|
displays: [
|
|
144
152
|
{
|
|
145
153
|
type: 'LinearSNPCoverageDisplay',
|
|
146
|
-
displayId: path_1.default.basename(file)
|
|
154
|
+
displayId: `${path_1.default.basename(file)}-${Math.random()}`,
|
|
147
155
|
},
|
|
148
156
|
],
|
|
149
157
|
}
|
|
@@ -162,7 +170,7 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
162
170
|
adapter: {
|
|
163
171
|
type: 'CramAdapter',
|
|
164
172
|
cramLocation: makeLocation(file),
|
|
165
|
-
craiLocation: makeLocation(index || file
|
|
173
|
+
craiLocation: makeLocation(index || `${file}.crai`),
|
|
166
174
|
sequenceAdapter: configData.assembly.sequence.adapter,
|
|
167
175
|
},
|
|
168
176
|
...(opts.includes('snpcov')
|
|
@@ -170,7 +178,7 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
170
178
|
displays: [
|
|
171
179
|
{
|
|
172
180
|
type: 'LinearSNPCoverageDisplay',
|
|
173
|
-
displayId: path_1.default.basename(file)
|
|
181
|
+
displayId: `${path_1.default.basename(file)}-${Math.random()}`,
|
|
174
182
|
},
|
|
175
183
|
],
|
|
176
184
|
}
|
|
@@ -205,7 +213,7 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
205
213
|
type: 'VcfTabixAdapter',
|
|
206
214
|
vcfGzLocation: makeLocation(file),
|
|
207
215
|
index: {
|
|
208
|
-
location: makeLocation(index || file
|
|
216
|
+
location: makeLocation(index || `${file}.tbi`),
|
|
209
217
|
indexType: (index === null || index === void 0 ? void 0 : index.endsWith('.csi')) ? 'CSI' : 'TBI',
|
|
210
218
|
},
|
|
211
219
|
},
|
|
@@ -224,7 +232,7 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
224
232
|
type: 'Gff3TabixAdapter',
|
|
225
233
|
gffGzLocation: makeLocation(file),
|
|
226
234
|
index: {
|
|
227
|
-
location: makeLocation(index || file
|
|
235
|
+
location: makeLocation(index || `${file}.tbi`),
|
|
228
236
|
indexType: (index === null || index === void 0 ? void 0 : index.endsWith('.csi')) ? 'CSI' : 'TBI',
|
|
229
237
|
},
|
|
230
238
|
},
|
|
@@ -273,7 +281,7 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
273
281
|
type: 'BedTabixAdapter',
|
|
274
282
|
bedGzLocation: makeLocation(file),
|
|
275
283
|
index: {
|
|
276
|
-
location: makeLocation(index || file
|
|
284
|
+
location: makeLocation(index || `${file}.tbi`),
|
|
277
285
|
indexType: (index === null || index === void 0 ? void 0 : index.endsWith('.csi')) ? 'CSI' : 'TBI',
|
|
278
286
|
},
|
|
279
287
|
},
|
|
@@ -284,7 +292,7 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
284
292
|
if (!defaultSession) {
|
|
285
293
|
// don't use defaultSession from config.json file, can result in assembly
|
|
286
294
|
// name confusion
|
|
287
|
-
|
|
295
|
+
configData.defaultSession = undefined;
|
|
288
296
|
}
|
|
289
297
|
// only allow an external manually specified session
|
|
290
298
|
if (sessionData) {
|
|
@@ -294,13 +302,18 @@ function readData({ assembly: asm, config, session, fasta, aliases, cytobands, d
|
|
|
294
302
|
}
|
|
295
303
|
function process(trackEntry, view, extra = c => c) {
|
|
296
304
|
const [, [track, ...opts]] = trackEntry;
|
|
305
|
+
if (!track) {
|
|
306
|
+
throw new Error('invalid command line args');
|
|
307
|
+
}
|
|
297
308
|
const currentTrack = view.showTrack(extra(track));
|
|
298
309
|
const display = currentTrack.displays[0];
|
|
299
310
|
opts.forEach(opt => {
|
|
300
311
|
// apply height to any track
|
|
301
312
|
if (opt.startsWith('height:')) {
|
|
302
313
|
const [, height] = opt.split(':');
|
|
303
|
-
|
|
314
|
+
if (height) {
|
|
315
|
+
display.setHeight(+height);
|
|
316
|
+
}
|
|
304
317
|
}
|
|
305
318
|
// apply sort to pileup
|
|
306
319
|
else if (opt.startsWith('sort:')) {
|
|
@@ -332,8 +345,12 @@ function process(trackEntry, view, extra = c => c) {
|
|
|
332
345
|
// apply min and max score to wiggle
|
|
333
346
|
else if (opt.startsWith('minmax:')) {
|
|
334
347
|
const [, min, max] = opt.split(':');
|
|
335
|
-
|
|
336
|
-
|
|
348
|
+
if (min) {
|
|
349
|
+
display.setMinScore(+min);
|
|
350
|
+
}
|
|
351
|
+
if (max) {
|
|
352
|
+
display.setMaxScore(+max);
|
|
353
|
+
}
|
|
337
354
|
}
|
|
338
355
|
// apply linear or log scale to wiggle
|
|
339
356
|
else if (opt.startsWith('scaletype:')) {
|
|
@@ -342,17 +359,17 @@ function process(trackEntry, view, extra = c => c) {
|
|
|
342
359
|
}
|
|
343
360
|
// draw crosshatches on wiggle
|
|
344
361
|
else if (opt.startsWith('crosshatch:')) {
|
|
345
|
-
const [, val] = opt.split(':');
|
|
362
|
+
const [, val = 'false'] = opt.split(':');
|
|
346
363
|
display.setCrossHatches((0, util_1.booleanize)(val));
|
|
347
364
|
}
|
|
348
365
|
// turn off fill on bigwig with fill:false
|
|
349
366
|
else if (opt.startsWith('fill:')) {
|
|
350
|
-
const [, val] = opt.split(':');
|
|
367
|
+
const [, val = 'true'] = opt.split(':');
|
|
351
368
|
display.setFill((0, util_1.booleanize)(val));
|
|
352
369
|
}
|
|
353
370
|
// set resolution:superfine to use finer bigwig bin size
|
|
354
371
|
else if (opt.startsWith('resolution:')) {
|
|
355
|
-
let [, val] = opt.split(':');
|
|
372
|
+
let [, val = 1] = opt.split(':');
|
|
356
373
|
if (val === 'fine') {
|
|
357
374
|
val = '10';
|
|
358
375
|
}
|
|
@@ -374,12 +391,12 @@ async function renderRegion(opts) {
|
|
|
374
391
|
const { assemblyManager } = model;
|
|
375
392
|
view.setWidth(width);
|
|
376
393
|
if (loc) {
|
|
377
|
-
const
|
|
394
|
+
const { name } = assemblyManager.assemblies[0];
|
|
378
395
|
if (loc === 'all') {
|
|
379
|
-
view.showAllRegionsInAssembly(
|
|
396
|
+
view.showAllRegionsInAssembly(name);
|
|
380
397
|
}
|
|
381
398
|
else {
|
|
382
|
-
await view.navToLocString(loc,
|
|
399
|
+
await view.navToLocString(loc, name);
|
|
383
400
|
}
|
|
384
401
|
}
|
|
385
402
|
else if (!sessionParam && !defaultSession) {
|
package/dist/setupEnv.js
CHANGED
|
@@ -32,7 +32,7 @@ function setupEnv() {
|
|
|
32
32
|
global.nodeImage = canvas_1.Image;
|
|
33
33
|
// @ts-expect-error
|
|
34
34
|
global.nodeCreateCanvas = canvas_1.createCanvas;
|
|
35
|
-
const window = new jsdom_1.JSDOM(
|
|
35
|
+
const window = new jsdom_1.JSDOM('...').window;
|
|
36
36
|
global.document = window.document;
|
|
37
37
|
// @ts-expect-error
|
|
38
38
|
global.window = window;
|
package/dist/util.js
CHANGED
|
@@ -26,6 +26,6 @@ function convert(result, args, spawnArgs = []) {
|
|
|
26
26
|
const a = ['-w', pngwidth, name, '-o', out, ...spawnArgs];
|
|
27
27
|
const ls = (0, child_process_1.spawnSync)('rsvg-convert', a);
|
|
28
28
|
console.error(`rsvg-convert stderr: ${ls.stderr.toString()}`);
|
|
29
|
-
console.log(`rsvg-convert stdout: ${ls.stdout.toString()}`);
|
|
29
|
+
console.log(`rsvg-convert stdout: ${ls.stdout.toString()}`);
|
|
30
30
|
fs_1.default.unlinkSync(name);
|
|
31
31
|
}
|
package/esm/index.js
CHANGED
|
@@ -8,19 +8,20 @@ import setupEnv from './setupEnv';
|
|
|
8
8
|
setupEnv();
|
|
9
9
|
const err = console.error;
|
|
10
10
|
console.error = (...p) => {
|
|
11
|
-
if (
|
|
11
|
+
if (!/useLayoutEffect/.exec(`${p[0]}`)) {
|
|
12
12
|
err(p);
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
const warn = console.warn;
|
|
16
16
|
console.warn = (...p) => {
|
|
17
|
-
if (
|
|
17
|
+
if (!/estimation reached timeout/.exec(`${p[0]}`)) {
|
|
18
18
|
warn(p);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
// note: yargs is actually unused except for printing help
|
|
22
|
-
//
|
|
23
|
-
//
|
|
21
|
+
// note: yargs is actually unused except for printing help we do custom command
|
|
22
|
+
// line parsing, see parseArgv.ts
|
|
23
|
+
//
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises,@typescript-eslint/no-unused-expressions
|
|
24
25
|
yargs
|
|
25
26
|
.command('jb2export', 'Creates a jbrowse 2 image snapshot')
|
|
26
27
|
.option('config', {
|
package/esm/renderRegion.js
CHANGED
|
@@ -10,7 +10,7 @@ function read(file) {
|
|
|
10
10
|
res = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
11
11
|
}
|
|
12
12
|
catch (e) {
|
|
13
|
-
throw new Error(`Failed to parse ${file} as JSON, use --fasta if you mean to pass a FASTA file
|
|
13
|
+
throw new Error(`Failed to parse ${file} as JSON, use --fasta if you mean to pass a FASTA file`, { cause: e });
|
|
14
14
|
}
|
|
15
15
|
return res;
|
|
16
16
|
}
|
|
@@ -33,8 +33,10 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
33
33
|
var _a;
|
|
34
34
|
const assemblyData = asm && fs.existsSync(asm) ? read(asm) : undefined;
|
|
35
35
|
const tracksData = tracks ? read(tracks) : undefined;
|
|
36
|
-
const configData =
|
|
37
|
-
let sessionData = session
|
|
36
|
+
const configData = config ? read(config) : {};
|
|
37
|
+
let sessionData = session
|
|
38
|
+
? read(session)
|
|
39
|
+
: undefined;
|
|
38
40
|
if (config) {
|
|
39
41
|
addRelativePaths(configData, path.dirname(path.resolve(config)));
|
|
40
42
|
}
|
|
@@ -53,6 +55,7 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
53
55
|
configData.assembly = assemblyData;
|
|
54
56
|
}
|
|
55
57
|
// else check if it was an assembly name in a config file
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
56
59
|
else if ((_a = configData.assemblies) === null || _a === void 0 ? void 0 : _a.length) {
|
|
57
60
|
configData.assemblies.find(entry => entry.name === asm);
|
|
58
61
|
if (asm) {
|
|
@@ -77,8 +80,8 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
77
80
|
adapter: {
|
|
78
81
|
type: bgzip ? 'BgzipFastaAdapter' : 'IndexedFastaAdapter',
|
|
79
82
|
fastaLocation: makeLocation(fasta),
|
|
80
|
-
faiLocation: makeLocation(fasta
|
|
81
|
-
gziLocation: bgzip ? makeLocation(fasta
|
|
83
|
+
faiLocation: makeLocation(`${fasta}.fai`),
|
|
84
|
+
gziLocation: bgzip ? makeLocation(`${fasta}.gzi`) : undefined,
|
|
82
85
|
},
|
|
83
86
|
},
|
|
84
87
|
};
|
|
@@ -100,12 +103,14 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
// throw if still no assembly
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
103
107
|
if (!configData.assembly) {
|
|
104
108
|
throw new Error('no assembly specified, use --fasta to supply an indexed FASTA file (generated with samtools faidx yourfile.fa). see README for alternatives with --assembly and --config');
|
|
105
109
|
}
|
|
106
110
|
if (tracksData) {
|
|
107
111
|
configData.tracks = tracksData;
|
|
108
112
|
}
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
109
114
|
else if (!configData.tracks) {
|
|
110
115
|
configData.tracks = [];
|
|
111
116
|
}
|
|
@@ -114,6 +119,9 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
114
119
|
const [type, opts] = track;
|
|
115
120
|
const [file, ...rest] = opts;
|
|
116
121
|
const index = (_a = rest.find(r => r.startsWith('index:'))) === null || _a === void 0 ? void 0 : _a.replace('index:', '');
|
|
122
|
+
if (!file) {
|
|
123
|
+
throw new Error('no file specified');
|
|
124
|
+
}
|
|
117
125
|
if (type === 'bam') {
|
|
118
126
|
configData.tracks = [
|
|
119
127
|
...configData.tracks,
|
|
@@ -126,7 +134,7 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
126
134
|
type: 'BamAdapter',
|
|
127
135
|
bamLocation: makeLocation(file),
|
|
128
136
|
index: {
|
|
129
|
-
location: makeLocation(index || file
|
|
137
|
+
location: makeLocation(index || `${file}.bai`),
|
|
130
138
|
indexType: (index === null || index === void 0 ? void 0 : index.endsWith('.csi')) ? 'CSI' : 'BAI',
|
|
131
139
|
},
|
|
132
140
|
sequenceAdapter: configData.assembly.sequence.adapter,
|
|
@@ -136,7 +144,7 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
136
144
|
displays: [
|
|
137
145
|
{
|
|
138
146
|
type: 'LinearSNPCoverageDisplay',
|
|
139
|
-
displayId: path.basename(file)
|
|
147
|
+
displayId: `${path.basename(file)}-${Math.random()}`,
|
|
140
148
|
},
|
|
141
149
|
],
|
|
142
150
|
}
|
|
@@ -155,7 +163,7 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
155
163
|
adapter: {
|
|
156
164
|
type: 'CramAdapter',
|
|
157
165
|
cramLocation: makeLocation(file),
|
|
158
|
-
craiLocation: makeLocation(index || file
|
|
166
|
+
craiLocation: makeLocation(index || `${file}.crai`),
|
|
159
167
|
sequenceAdapter: configData.assembly.sequence.adapter,
|
|
160
168
|
},
|
|
161
169
|
...(opts.includes('snpcov')
|
|
@@ -163,7 +171,7 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
163
171
|
displays: [
|
|
164
172
|
{
|
|
165
173
|
type: 'LinearSNPCoverageDisplay',
|
|
166
|
-
displayId: path.basename(file)
|
|
174
|
+
displayId: `${path.basename(file)}-${Math.random()}`,
|
|
167
175
|
},
|
|
168
176
|
],
|
|
169
177
|
}
|
|
@@ -198,7 +206,7 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
198
206
|
type: 'VcfTabixAdapter',
|
|
199
207
|
vcfGzLocation: makeLocation(file),
|
|
200
208
|
index: {
|
|
201
|
-
location: makeLocation(index || file
|
|
209
|
+
location: makeLocation(index || `${file}.tbi`),
|
|
202
210
|
indexType: (index === null || index === void 0 ? void 0 : index.endsWith('.csi')) ? 'CSI' : 'TBI',
|
|
203
211
|
},
|
|
204
212
|
},
|
|
@@ -217,7 +225,7 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
217
225
|
type: 'Gff3TabixAdapter',
|
|
218
226
|
gffGzLocation: makeLocation(file),
|
|
219
227
|
index: {
|
|
220
|
-
location: makeLocation(index || file
|
|
228
|
+
location: makeLocation(index || `${file}.tbi`),
|
|
221
229
|
indexType: (index === null || index === void 0 ? void 0 : index.endsWith('.csi')) ? 'CSI' : 'TBI',
|
|
222
230
|
},
|
|
223
231
|
},
|
|
@@ -266,7 +274,7 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
266
274
|
type: 'BedTabixAdapter',
|
|
267
275
|
bedGzLocation: makeLocation(file),
|
|
268
276
|
index: {
|
|
269
|
-
location: makeLocation(index || file
|
|
277
|
+
location: makeLocation(index || `${file}.tbi`),
|
|
270
278
|
indexType: (index === null || index === void 0 ? void 0 : index.endsWith('.csi')) ? 'CSI' : 'TBI',
|
|
271
279
|
},
|
|
272
280
|
},
|
|
@@ -277,7 +285,7 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
277
285
|
if (!defaultSession) {
|
|
278
286
|
// don't use defaultSession from config.json file, can result in assembly
|
|
279
287
|
// name confusion
|
|
280
|
-
|
|
288
|
+
configData.defaultSession = undefined;
|
|
281
289
|
}
|
|
282
290
|
// only allow an external manually specified session
|
|
283
291
|
if (sessionData) {
|
|
@@ -287,13 +295,18 @@ export function readData({ assembly: asm, config, session, fasta, aliases, cytob
|
|
|
287
295
|
}
|
|
288
296
|
function process(trackEntry, view, extra = c => c) {
|
|
289
297
|
const [, [track, ...opts]] = trackEntry;
|
|
298
|
+
if (!track) {
|
|
299
|
+
throw new Error('invalid command line args');
|
|
300
|
+
}
|
|
290
301
|
const currentTrack = view.showTrack(extra(track));
|
|
291
302
|
const display = currentTrack.displays[0];
|
|
292
303
|
opts.forEach(opt => {
|
|
293
304
|
// apply height to any track
|
|
294
305
|
if (opt.startsWith('height:')) {
|
|
295
306
|
const [, height] = opt.split(':');
|
|
296
|
-
|
|
307
|
+
if (height) {
|
|
308
|
+
display.setHeight(+height);
|
|
309
|
+
}
|
|
297
310
|
}
|
|
298
311
|
// apply sort to pileup
|
|
299
312
|
else if (opt.startsWith('sort:')) {
|
|
@@ -325,8 +338,12 @@ function process(trackEntry, view, extra = c => c) {
|
|
|
325
338
|
// apply min and max score to wiggle
|
|
326
339
|
else if (opt.startsWith('minmax:')) {
|
|
327
340
|
const [, min, max] = opt.split(':');
|
|
328
|
-
|
|
329
|
-
|
|
341
|
+
if (min) {
|
|
342
|
+
display.setMinScore(+min);
|
|
343
|
+
}
|
|
344
|
+
if (max) {
|
|
345
|
+
display.setMaxScore(+max);
|
|
346
|
+
}
|
|
330
347
|
}
|
|
331
348
|
// apply linear or log scale to wiggle
|
|
332
349
|
else if (opt.startsWith('scaletype:')) {
|
|
@@ -335,17 +352,17 @@ function process(trackEntry, view, extra = c => c) {
|
|
|
335
352
|
}
|
|
336
353
|
// draw crosshatches on wiggle
|
|
337
354
|
else if (opt.startsWith('crosshatch:')) {
|
|
338
|
-
const [, val] = opt.split(':');
|
|
355
|
+
const [, val = 'false'] = opt.split(':');
|
|
339
356
|
display.setCrossHatches(booleanize(val));
|
|
340
357
|
}
|
|
341
358
|
// turn off fill on bigwig with fill:false
|
|
342
359
|
else if (opt.startsWith('fill:')) {
|
|
343
|
-
const [, val] = opt.split(':');
|
|
360
|
+
const [, val = 'true'] = opt.split(':');
|
|
344
361
|
display.setFill(booleanize(val));
|
|
345
362
|
}
|
|
346
363
|
// set resolution:superfine to use finer bigwig bin size
|
|
347
364
|
else if (opt.startsWith('resolution:')) {
|
|
348
|
-
let [, val] = opt.split(':');
|
|
365
|
+
let [, val = 1] = opt.split(':');
|
|
349
366
|
if (val === 'fine') {
|
|
350
367
|
val = '10';
|
|
351
368
|
}
|
|
@@ -367,12 +384,12 @@ export async function renderRegion(opts) {
|
|
|
367
384
|
const { assemblyManager } = model;
|
|
368
385
|
view.setWidth(width);
|
|
369
386
|
if (loc) {
|
|
370
|
-
const
|
|
387
|
+
const { name } = assemblyManager.assemblies[0];
|
|
371
388
|
if (loc === 'all') {
|
|
372
|
-
view.showAllRegionsInAssembly(
|
|
389
|
+
view.showAllRegionsInAssembly(name);
|
|
373
390
|
}
|
|
374
391
|
else {
|
|
375
|
-
await view.navToLocString(loc,
|
|
392
|
+
await view.navToLocString(loc, name);
|
|
376
393
|
}
|
|
377
394
|
}
|
|
378
395
|
else if (!sessionParam && !defaultSession) {
|
package/esm/setupEnv.js
CHANGED
|
@@ -6,7 +6,7 @@ export default function setupEnv() {
|
|
|
6
6
|
global.nodeImage = Image;
|
|
7
7
|
// @ts-expect-error
|
|
8
8
|
global.nodeCreateCanvas = createCanvas;
|
|
9
|
-
const window = new JSDOM(
|
|
9
|
+
const window = new JSDOM('...').window;
|
|
10
10
|
global.document = window.document;
|
|
11
11
|
// @ts-expect-error
|
|
12
12
|
global.window = window;
|
package/esm/util.js
CHANGED
|
@@ -19,6 +19,6 @@ export function convert(result, args, spawnArgs = []) {
|
|
|
19
19
|
const a = ['-w', pngwidth, name, '-o', out, ...spawnArgs];
|
|
20
20
|
const ls = spawnSync('rsvg-convert', a);
|
|
21
21
|
console.error(`rsvg-convert stderr: ${ls.stderr.toString()}`);
|
|
22
|
-
console.log(`rsvg-convert stdout: ${ls.stdout.toString()}`);
|
|
22
|
+
console.log(`rsvg-convert stdout: ${ls.stdout.toString()}`);
|
|
23
23
|
fs.unlinkSync(name);
|
|
24
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/img",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"author": "JBrowse Team",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"@babel/runtime": "^7.17.9",
|
|
28
28
|
"@emotion/cache": "^11.7.1",
|
|
29
29
|
"@emotion/react": "^11.9.0",
|
|
30
|
-
"@jbrowse/plugin-linear-genome-view": "^2.
|
|
31
|
-
"@jbrowse/react-linear-genome-view": "^2.
|
|
30
|
+
"@jbrowse/plugin-linear-genome-view": "^2.14.0",
|
|
31
|
+
"@jbrowse/react-linear-genome-view": "^2.14.0",
|
|
32
32
|
"canvas": "^2.9.1",
|
|
33
33
|
"jsdom": "^24.0.0",
|
|
34
34
|
"mobx": "^6.6.0",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "9fb8231d932db40adf0a283081765431756c66ff"
|
|
45
45
|
}
|