@jbrowse/cli 2.2.2 → 2.3.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/README.md +36 -20
- package/lib/commands/add-assembly.js +8 -3
- package/lib/commands/text-index.d.ts +20 -10
- package/lib/commands/text-index.js +112 -81
- package/lib/types/common.d.ts +4 -4
- package/lib/types/common.js +9 -14
- package/lib/types/gff3Adapter.d.ts +8 -1
- package/lib/types/gff3Adapter.js +3 -3
- package/lib/types/vcfAdapter.d.ts +8 -1
- package/lib/types/vcfAdapter.js +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +3 -4
- package/lib/types/gtfAdapter.d.ts +0 -2
- package/lib/types/gtfAdapter.js +0 -108
package/README.md
CHANGED
|
@@ -4,12 +4,12 @@ id: cli
|
|
|
4
4
|
toplevel: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
This document covers the CLI tools. Note: for @jbrowse/img static export
|
|
8
|
-
|
|
7
|
+
This document covers the CLI tools. Note: for @jbrowse/img static export tool,
|
|
8
|
+
see https://www.npmjs.com/package/@jbrowse/img
|
|
9
9
|
|
|
10
10
|
Note: the @jbrowse/cli may not do all types of operations, some use cases may
|
|
11
|
-
best be handled by creating your own tools to manipulate a config.json by
|
|
12
|
-
|
|
11
|
+
best be handled by creating your own tools to manipulate a config.json by hand
|
|
12
|
+
or by using a script file.
|
|
13
13
|
|
|
14
14
|
A simple script that does not use @jbrowse/cli at all may just look like this
|
|
15
15
|
|
|
@@ -40,7 +40,8 @@ It is also possible to do one-off executions using npx, e.g.
|
|
|
40
40
|
npx @jbrowse/cli create myfolder
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
It is likely preferable in most cases to install the tools globally with
|
|
43
|
+
It is likely preferable in most cases to install the tools globally with
|
|
44
|
+
`npm install @jbrowse/cli -g` however
|
|
44
45
|
|
|
45
46
|
## Commands
|
|
46
47
|
|
|
@@ -171,7 +172,8 @@ EXAMPLES
|
|
|
171
172
|
$ jbrowse add-assembly myfile.fa.gz --load copy
|
|
172
173
|
```
|
|
173
174
|
|
|
174
|
-
_See code:
|
|
175
|
+
_See code:
|
|
176
|
+
[src/commands/add-assembly.ts](https://github.com/GMOD/jbrowse-components/blob/v2.3.0/products/jbrowse-cli/src/commands/add-assembly.ts)_
|
|
175
177
|
|
|
176
178
|
## `jbrowse add-connection CONNECTIONURLORPATH`
|
|
177
179
|
|
|
@@ -225,7 +227,8 @@ EXAMPLES
|
|
|
225
227
|
/path/to/jb2/installation/config.json
|
|
226
228
|
```
|
|
227
229
|
|
|
228
|
-
_See code:
|
|
230
|
+
_See code:
|
|
231
|
+
[src/commands/add-connection.ts](https://github.com/GMOD/jbrowse-components/blob/v2.3.0/products/jbrowse-cli/src/commands/add-connection.ts)_
|
|
229
232
|
|
|
230
233
|
## `jbrowse add-track TRACK`
|
|
231
234
|
|
|
@@ -299,11 +302,13 @@ EXAMPLES
|
|
|
299
302
|
$ jbrowse add-track /url/relative/path.bam --load inPlace
|
|
300
303
|
```
|
|
301
304
|
|
|
302
|
-
_See code:
|
|
305
|
+
_See code:
|
|
306
|
+
[src/commands/add-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.3.0/products/jbrowse-cli/src/commands/add-track.ts)_
|
|
303
307
|
|
|
304
308
|
## `jbrowse add-track-json TRACK`
|
|
305
309
|
|
|
306
|
-
Add a track configuration directly from a JSON hunk to the JBrowse 2
|
|
310
|
+
Add a track configuration directly from a JSON hunk to the JBrowse 2
|
|
311
|
+
configuration
|
|
307
312
|
|
|
308
313
|
```
|
|
309
314
|
USAGE
|
|
@@ -324,7 +329,8 @@ EXAMPLES
|
|
|
324
329
|
$ jbrowse add-track-json track.json --update
|
|
325
330
|
```
|
|
326
331
|
|
|
327
|
-
_See code:
|
|
332
|
+
_See code:
|
|
333
|
+
[src/commands/add-track-json.ts](https://github.com/GMOD/jbrowse-components/blob/v2.3.0/products/jbrowse-cli/src/commands/add-track-json.ts)_
|
|
328
334
|
|
|
329
335
|
## `jbrowse admin-server`
|
|
330
336
|
|
|
@@ -354,7 +360,8 @@ EXAMPLES
|
|
|
354
360
|
$ jbrowse admin-server -p 8888
|
|
355
361
|
```
|
|
356
362
|
|
|
357
|
-
_See code:
|
|
363
|
+
_See code:
|
|
364
|
+
[src/commands/admin-server.ts](https://github.com/GMOD/jbrowse-components/blob/v2.3.0/products/jbrowse-cli/src/commands/admin-server.ts)_
|
|
358
365
|
|
|
359
366
|
## `jbrowse create LOCALPATH`
|
|
360
367
|
|
|
@@ -398,7 +405,8 @@ EXAMPLES
|
|
|
398
405
|
$ jbrowse create --listVersions
|
|
399
406
|
```
|
|
400
407
|
|
|
401
|
-
_See code:
|
|
408
|
+
_See code:
|
|
409
|
+
[src/commands/create.ts](https://github.com/GMOD/jbrowse-components/blob/v2.3.0/products/jbrowse-cli/src/commands/create.ts)_
|
|
402
410
|
|
|
403
411
|
## `jbrowse help [COMMAND]`
|
|
404
412
|
|
|
@@ -415,11 +423,13 @@ OPTIONS
|
|
|
415
423
|
--all see all commands in CLI
|
|
416
424
|
```
|
|
417
425
|
|
|
418
|
-
_See code:
|
|
426
|
+
_See code:
|
|
427
|
+
[@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.14/src/commands/help.ts)_
|
|
419
428
|
|
|
420
429
|
## `jbrowse remove-track TRACK`
|
|
421
430
|
|
|
422
|
-
Remove a track configuration from a JBrowse 2 configuration. Be aware that this
|
|
431
|
+
Remove a track configuration from a JBrowse 2 configuration. Be aware that this
|
|
432
|
+
can cause crashes in saved sessions that refer to this track!
|
|
423
433
|
|
|
424
434
|
```
|
|
425
435
|
USAGE
|
|
@@ -438,7 +448,8 @@ EXAMPLE
|
|
|
438
448
|
$ jbrowse remove-track-json trackId
|
|
439
449
|
```
|
|
440
450
|
|
|
441
|
-
_See code:
|
|
451
|
+
_See code:
|
|
452
|
+
[src/commands/remove-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.3.0/products/jbrowse-cli/src/commands/remove-track.ts)_
|
|
442
453
|
|
|
443
454
|
## `jbrowse set-default-session`
|
|
444
455
|
|
|
@@ -475,7 +486,8 @@ EXAMPLES
|
|
|
475
486
|
$ jbrowse set-default-session --currentSession # Prints out current default session
|
|
476
487
|
```
|
|
477
488
|
|
|
478
|
-
_See code:
|
|
489
|
+
_See code:
|
|
490
|
+
[src/commands/set-default-session.ts](https://github.com/GMOD/jbrowse-components/blob/v2.3.0/products/jbrowse-cli/src/commands/set-default-session.ts)_
|
|
479
491
|
|
|
480
492
|
## `jbrowse text-index`
|
|
481
493
|
|
|
@@ -510,8 +522,10 @@ OPTIONS
|
|
|
510
522
|
|
|
511
523
|
--perTrack If set, creates an index per track
|
|
512
524
|
|
|
513
|
-
--prefixSize=prefixSize
|
|
514
|
-
|
|
525
|
+
--prefixSize=prefixSize Specify the prefix size for the ixx index. We attempt to automatically calculate this,
|
|
526
|
+
but you can manually specify this too. If many genes have similar gene IDs e.g.
|
|
527
|
+
Z000000001, Z000000002 the prefix size should be larger so that they get split into
|
|
528
|
+
different bins
|
|
515
529
|
|
|
516
530
|
--target=target Path to config file in JB2 installation directory to read from.
|
|
517
531
|
|
|
@@ -536,7 +550,8 @@ EXAMPLES
|
|
|
536
550
|
$ jbrowse text-index --file myfile.gff3.gz --file myfile.vcfgz --out indexes
|
|
537
551
|
```
|
|
538
552
|
|
|
539
|
-
_See code:
|
|
553
|
+
_See code:
|
|
554
|
+
[src/commands/text-index.ts](https://github.com/GMOD/jbrowse-components/blob/v2.3.0/products/jbrowse-cli/src/commands/text-index.ts)_
|
|
540
555
|
|
|
541
556
|
## `jbrowse upgrade [LOCALPATH]`
|
|
542
557
|
|
|
@@ -584,7 +599,8 @@ EXAMPLES
|
|
|
584
599
|
$ jbrowse upgrade --nightly
|
|
585
600
|
```
|
|
586
601
|
|
|
587
|
-
_See code:
|
|
602
|
+
_See code:
|
|
603
|
+
[src/commands/upgrade.ts](https://github.com/GMOD/jbrowse-components/blob/v2.3.0/products/jbrowse-cli/src/commands/upgrade.ts)_
|
|
588
604
|
|
|
589
605
|
<!-- commandsstop -->
|
|
590
606
|
|
|
@@ -208,10 +208,15 @@ class AddAssembly extends base_1.default {
|
|
|
208
208
|
const { args: runArgs, flags: runFlags } = this.parse(AddAssembly);
|
|
209
209
|
const output = runFlags.target || runFlags.out || '.';
|
|
210
210
|
if (!(await exists(output))) {
|
|
211
|
-
|
|
211
|
+
const dir = output.endsWith('.json') ? path_1.default.dirname(output) : output;
|
|
212
|
+
await mkdir(dir, { recursive: true });
|
|
212
213
|
}
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
let isDir = false;
|
|
215
|
+
try {
|
|
216
|
+
isDir = fs_1.default.statSync(output).isDirectory();
|
|
217
|
+
}
|
|
218
|
+
catch (e) { }
|
|
219
|
+
this.target = isDir ? path_1.default.join(output, 'config.json') : output;
|
|
215
220
|
const { sequence: argsSequence } = runArgs;
|
|
216
221
|
this.debug(`Sequence location is: ${argsSequence}`);
|
|
217
222
|
const { name } = runFlags;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Readable } from 'stream';
|
|
3
3
|
import { flags } from '@oclif/command';
|
|
4
|
-
import JBrowseCommand, { Track
|
|
4
|
+
import JBrowseCommand, { Track } from '../base';
|
|
5
5
|
export default class TextIndex extends JBrowseCommand {
|
|
6
6
|
static description: string;
|
|
7
7
|
static examples: string[];
|
|
@@ -16,7 +16,7 @@ export default class TextIndex extends JBrowseCommand {
|
|
|
16
16
|
quiet: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
17
17
|
perTrack: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
18
18
|
exclude: flags.IOptionFlag<string>;
|
|
19
|
-
prefixSize: import("@oclif/parser/lib/flags").IOptionFlag<number>;
|
|
19
|
+
prefixSize: import("@oclif/parser/lib/flags").IOptionFlag<number | undefined>;
|
|
20
20
|
file: flags.IOptionFlag<string[]>;
|
|
21
21
|
fileId: flags.IOptionFlag<string[]>;
|
|
22
22
|
dryrun: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
@@ -25,18 +25,28 @@ export default class TextIndex extends JBrowseCommand {
|
|
|
25
25
|
aggregateIndex(): Promise<void>;
|
|
26
26
|
perTrackIndex(): Promise<void>;
|
|
27
27
|
indexFileList(): Promise<void>;
|
|
28
|
-
indexDriver({
|
|
29
|
-
|
|
28
|
+
indexDriver({ trackConfigs, attributes, outLocation, name, quiet, typesToExclude, assemblyNames, prefixSize, }: {
|
|
29
|
+
trackConfigs: Track[];
|
|
30
30
|
attributes: string[];
|
|
31
|
-
|
|
31
|
+
outLocation: string;
|
|
32
32
|
name: string;
|
|
33
33
|
quiet: boolean;
|
|
34
|
-
|
|
34
|
+
typesToExclude: string[];
|
|
35
35
|
assemblyNames: string[];
|
|
36
|
-
prefixSize
|
|
36
|
+
prefixSize?: number;
|
|
37
|
+
}): Promise<void>;
|
|
38
|
+
indexFiles({ trackConfigs, attributes, outLocation, quiet, typesToExclude, }: {
|
|
39
|
+
trackConfigs: Track[];
|
|
40
|
+
attributes: string[];
|
|
41
|
+
outLocation: string;
|
|
42
|
+
quiet: boolean;
|
|
43
|
+
typesToExclude: string[];
|
|
44
|
+
}): AsyncGenerator<string, void, unknown>;
|
|
45
|
+
runIxIxx({ readStream, outLocation, name, prefixSize, }: {
|
|
46
|
+
readStream: Readable;
|
|
47
|
+
outLocation: string;
|
|
48
|
+
name: string;
|
|
49
|
+
prefixSize?: number;
|
|
37
50
|
}): Promise<void>;
|
|
38
|
-
getLoc(elt: UriLocation | LocalPathLocation): string;
|
|
39
|
-
indexFiles(trackConfigs: Track[], attributes: string[], outLocation: string, quiet: boolean, typesToExclude: string[]): AsyncGenerator<string, void, unknown>;
|
|
40
|
-
runIxIxx(readStream: Readable, outLocation: string, name: string, prefixSize: number): Promise<void>;
|
|
41
51
|
getTrackConfigs(configPath: string, trackIds?: string[], assemblyName?: string): Promise<Track[]>;
|
|
42
52
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
2
3
|
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
4
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
5
|
var m = o[Symbol.asyncIterator], i;
|
|
@@ -6,7 +7,6 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
6
7
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
7
8
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
8
9
|
};
|
|
9
|
-
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
10
10
|
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
|
11
11
|
var i, p;
|
|
12
12
|
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
@@ -32,17 +32,19 @@ const path_1 = __importDefault(require("path"));
|
|
|
32
32
|
const stream_1 = require("stream");
|
|
33
33
|
const ixixx_1 = require("ixixx");
|
|
34
34
|
const command_1 = require("@oclif/command");
|
|
35
|
+
// locals
|
|
35
36
|
const gff3Adapter_1 = require("../types/gff3Adapter");
|
|
36
37
|
const vcfAdapter_1 = require("../types/vcfAdapter");
|
|
37
38
|
const base_1 = __importDefault(require("../base"));
|
|
38
39
|
const common_1 = require("../types/common");
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
function readConf(path) {
|
|
41
|
+
return JSON.parse(fs_1.default.readFileSync(path, 'utf8'));
|
|
42
|
+
}
|
|
43
|
+
function writeConf(obj, path) {
|
|
44
|
+
fs_1.default.writeFileSync(path, JSON.stringify(obj, null, 2));
|
|
43
45
|
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
46
|
+
function getLoc(elt) {
|
|
47
|
+
return elt.locationType === 'LocalPathLocation' ? elt.localPath : elt.uri;
|
|
46
48
|
}
|
|
47
49
|
class TextIndex extends base_1.default {
|
|
48
50
|
async run() {
|
|
@@ -66,13 +68,13 @@ class TextIndex extends base_1.default {
|
|
|
66
68
|
const outFlag = target || out || '.';
|
|
67
69
|
const isDir = fs_1.default.lstatSync(outFlag).isDirectory();
|
|
68
70
|
const confPath = isDir ? path_1.default.join(outFlag, 'config.json') : outFlag;
|
|
69
|
-
const
|
|
71
|
+
const outLocation = path_1.default.dirname(confPath);
|
|
70
72
|
const config = readConf(confPath);
|
|
71
|
-
const trixDir = path_1.default.join(
|
|
73
|
+
const trixDir = path_1.default.join(outLocation, 'trix');
|
|
72
74
|
if (!fs_1.default.existsSync(trixDir)) {
|
|
73
75
|
fs_1.default.mkdirSync(trixDir);
|
|
74
76
|
}
|
|
75
|
-
const
|
|
77
|
+
const aggregateTextSearchAdapters = config.aggregateTextSearchAdapters || [];
|
|
76
78
|
const asms = (assemblies === null || assemblies === void 0 ? void 0 : assemblies.split(',')) ||
|
|
77
79
|
((_a = config.assemblies) === null || _a === void 0 ? void 0 : _a.map(a => a.name)) ||
|
|
78
80
|
(config.assembly ? [config.assembly.name] : []);
|
|
@@ -80,28 +82,29 @@ class TextIndex extends base_1.default {
|
|
|
80
82
|
throw new Error('No assemblies found');
|
|
81
83
|
}
|
|
82
84
|
for (const asm of asms) {
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
const trackConfigs = await this.getTrackConfigs(confPath, tracks === null || tracks === void 0 ? void 0 : tracks.split(','), asm);
|
|
86
|
+
if (!trackConfigs.length) {
|
|
87
|
+
this.log('Indexing assembly ' + asm + '...(no tracks found)...');
|
|
86
88
|
continue;
|
|
87
89
|
}
|
|
90
|
+
this.log('Indexing assembly ' + asm + '...');
|
|
88
91
|
if (dryrun) {
|
|
89
|
-
this.log(
|
|
92
|
+
this.log(trackConfigs.map(e => `${e.trackId}\t${e.adapter.type}`).join('\n'));
|
|
90
93
|
}
|
|
91
94
|
else {
|
|
92
95
|
const id = asm + '-index';
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
96
|
+
const idx = aggregateTextSearchAdapters.findIndex(x => x.textSearchAdapterId === id);
|
|
97
|
+
if (idx !== -1 && !force) {
|
|
95
98
|
this.log(`Note: ${asm} has already been indexed with this configuration, use --force to overwrite this assembly. Skipping for now`);
|
|
96
99
|
continue;
|
|
97
100
|
}
|
|
98
101
|
await this.indexDriver({
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
trackConfigs,
|
|
103
|
+
outLocation,
|
|
101
104
|
quiet,
|
|
102
105
|
name: asm,
|
|
103
106
|
attributes: attributes.split(','),
|
|
104
|
-
|
|
107
|
+
typesToExclude: exclude.split(','),
|
|
105
108
|
assemblyNames: [asm],
|
|
106
109
|
prefixSize,
|
|
107
110
|
});
|
|
@@ -122,16 +125,16 @@ class TextIndex extends base_1.default {
|
|
|
122
125
|
},
|
|
123
126
|
assemblyNames: [asm],
|
|
124
127
|
};
|
|
125
|
-
if (
|
|
126
|
-
|
|
128
|
+
if (idx === -1) {
|
|
129
|
+
aggregateTextSearchAdapters.push(trixConf);
|
|
127
130
|
}
|
|
128
131
|
else {
|
|
129
|
-
|
|
132
|
+
aggregateTextSearchAdapters[idx] = trixConf;
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
135
|
}
|
|
133
136
|
if (!dryrun) {
|
|
134
|
-
|
|
137
|
+
writeConf(Object.assign(Object.assign({}, config), { aggregateTextSearchAdapters }), confPath);
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
140
|
async perTrackIndex() {
|
|
@@ -140,10 +143,10 @@ class TextIndex extends base_1.default {
|
|
|
140
143
|
const outFlag = target || out || '.';
|
|
141
144
|
const isDir = fs_1.default.lstatSync(outFlag).isDirectory();
|
|
142
145
|
const confFilePath = isDir ? path_1.default.join(outFlag, 'config.json') : outFlag;
|
|
143
|
-
const
|
|
146
|
+
const outLocation = path_1.default.dirname(confFilePath);
|
|
144
147
|
const config = readConf(confFilePath);
|
|
145
148
|
const configTracks = config.tracks || [];
|
|
146
|
-
const trixDir = path_1.default.join(
|
|
149
|
+
const trixDir = path_1.default.join(outLocation, 'trix');
|
|
147
150
|
if (!fs_1.default.existsSync(trixDir)) {
|
|
148
151
|
fs_1.default.mkdirSync(trixDir);
|
|
149
152
|
}
|
|
@@ -161,40 +164,43 @@ class TextIndex extends base_1.default {
|
|
|
161
164
|
continue;
|
|
162
165
|
}
|
|
163
166
|
this.log('Indexing track ' + trackId + '...');
|
|
164
|
-
const id = trackId + '-index';
|
|
165
167
|
await this.indexDriver({
|
|
166
|
-
|
|
168
|
+
trackConfigs: [trackConfig],
|
|
167
169
|
attributes: attributes.split(','),
|
|
168
|
-
|
|
170
|
+
outLocation,
|
|
169
171
|
quiet,
|
|
170
172
|
name: trackId,
|
|
171
|
-
|
|
173
|
+
typesToExclude: exclude.split(','),
|
|
172
174
|
assemblyNames,
|
|
173
175
|
prefixSize,
|
|
174
176
|
});
|
|
175
|
-
if (!
|
|
176
|
-
const newTrackConfig = Object.assign(Object.assign({}, trackConfig), { textSearching: Object.assign(Object.assign({}, textSearching), { textSearchAdapter: {
|
|
177
|
-
type: 'TrixTextSearchAdapter',
|
|
178
|
-
textSearchAdapterId: id,
|
|
179
|
-
ixFilePath: {
|
|
180
|
-
uri: `trix/${trackId}.ix`,
|
|
181
|
-
locationType: 'UriLocation',
|
|
182
|
-
},
|
|
183
|
-
ixxFilePath: {
|
|
184
|
-
uri: `trix/${trackId}.ixx`,
|
|
185
|
-
locationType: 'UriLocation',
|
|
186
|
-
},
|
|
187
|
-
metaFilePath: {
|
|
188
|
-
uri: `trix/${trackId}_meta.json`,
|
|
189
|
-
locationType: 'UriLocation',
|
|
190
|
-
},
|
|
191
|
-
assemblyNames: assemblyNames,
|
|
192
|
-
} }) });
|
|
177
|
+
if (!(textSearching === null || textSearching === void 0 ? void 0 : textSearching.textSearchAdapter)) {
|
|
193
178
|
// modifies track with new text search adapter
|
|
194
179
|
const index = configTracks.findIndex(track => trackId === track.trackId);
|
|
195
|
-
|
|
180
|
+
if (index !== -1) {
|
|
181
|
+
configTracks[index] = Object.assign(Object.assign({}, trackConfig), { textSearching: Object.assign(Object.assign({}, textSearching), { textSearchAdapter: {
|
|
182
|
+
type: 'TrixTextSearchAdapter',
|
|
183
|
+
textSearchAdapterId: trackId + '-index',
|
|
184
|
+
ixFilePath: {
|
|
185
|
+
uri: `trix/${trackId}.ix`,
|
|
186
|
+
locationType: 'UriLocation',
|
|
187
|
+
},
|
|
188
|
+
ixxFilePath: {
|
|
189
|
+
uri: `trix/${trackId}.ixx`,
|
|
190
|
+
locationType: 'UriLocation',
|
|
191
|
+
},
|
|
192
|
+
metaFilePath: {
|
|
193
|
+
uri: `trix/${trackId}_meta.json`,
|
|
194
|
+
locationType: 'UriLocation',
|
|
195
|
+
},
|
|
196
|
+
assemblyNames: assemblyNames,
|
|
197
|
+
} }) });
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
this.log("Error: can't find trackId");
|
|
201
|
+
}
|
|
196
202
|
}
|
|
197
|
-
|
|
203
|
+
writeConf(Object.assign(Object.assign({}, config), { tracks: configTracks }), confFilePath);
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
206
|
async indexFileList() {
|
|
@@ -205,71 +211,97 @@ class TextIndex extends base_1.default {
|
|
|
205
211
|
if (!fs_1.default.existsSync(trixDir)) {
|
|
206
212
|
fs_1.default.mkdirSync(trixDir);
|
|
207
213
|
}
|
|
208
|
-
const
|
|
214
|
+
const trackConfigs = file
|
|
209
215
|
.map(file => (0, common_1.guessAdapterFromFileName)(file))
|
|
210
216
|
.filter(fileConfig => (0, common_1.supported)(fileConfig.adapter.type));
|
|
211
217
|
if (fileId === null || fileId === void 0 ? void 0 : fileId.length) {
|
|
212
218
|
for (let i = 0; i < fileId.length; i++) {
|
|
213
|
-
|
|
219
|
+
trackConfigs[i].trackId = fileId[i];
|
|
214
220
|
}
|
|
215
221
|
}
|
|
216
222
|
await this.indexDriver({
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
name:
|
|
223
|
+
trackConfigs,
|
|
224
|
+
outLocation: outFlag,
|
|
225
|
+
name: trackConfigs.length > 1 ? 'aggregate' : path_1.default.basename(file[0]),
|
|
220
226
|
quiet,
|
|
221
227
|
attributes: attributes.split(','),
|
|
222
|
-
|
|
228
|
+
typesToExclude: exclude.split(','),
|
|
223
229
|
assemblyNames: [],
|
|
224
230
|
prefixSize,
|
|
225
231
|
});
|
|
226
232
|
this.log('Successfully created index for these files. See https://jbrowse.org/storybook/lgv/main/?path=/story/text-searching--page for info about usage');
|
|
227
233
|
}
|
|
228
|
-
async indexDriver({
|
|
229
|
-
const
|
|
230
|
-
|
|
234
|
+
async indexDriver({ trackConfigs, attributes, outLocation, name, quiet, typesToExclude, assemblyNames, prefixSize, }) {
|
|
235
|
+
const readStream = stream_1.Readable.from(this.indexFiles({
|
|
236
|
+
trackConfigs,
|
|
237
|
+
attributes,
|
|
238
|
+
outLocation,
|
|
239
|
+
quiet,
|
|
240
|
+
typesToExclude,
|
|
241
|
+
}));
|
|
242
|
+
const ixIxxStream = await this.runIxIxx({
|
|
243
|
+
readStream,
|
|
244
|
+
outLocation,
|
|
245
|
+
name,
|
|
246
|
+
prefixSize,
|
|
247
|
+
});
|
|
231
248
|
await (0, common_1.generateMeta)({
|
|
232
|
-
|
|
249
|
+
trackConfigs,
|
|
233
250
|
attributes,
|
|
234
|
-
|
|
251
|
+
outLocation,
|
|
235
252
|
name,
|
|
236
|
-
|
|
253
|
+
typesToExclude,
|
|
237
254
|
assemblyNames,
|
|
238
255
|
});
|
|
239
256
|
return ixIxxStream;
|
|
240
257
|
}
|
|
241
|
-
|
|
242
|
-
if (elt.locationType === 'LocalPathLocation') {
|
|
243
|
-
return elt.localPath;
|
|
244
|
-
}
|
|
245
|
-
return elt.uri;
|
|
246
|
-
}
|
|
247
|
-
indexFiles(trackConfigs, attributes, outLocation, quiet, typesToExclude) {
|
|
258
|
+
indexFiles({ trackConfigs, attributes, outLocation, quiet, typesToExclude, }) {
|
|
248
259
|
return __asyncGenerator(this, arguments, function* indexFiles_1() {
|
|
249
260
|
for (const config of trackConfigs) {
|
|
250
261
|
const { adapter, textSearching } = config;
|
|
251
262
|
const { type } = adapter;
|
|
252
|
-
const { indexingFeatureTypesToExclude
|
|
263
|
+
const { indexingFeatureTypesToExclude = typesToExclude, indexingAttributes = attributes, } = textSearching || {};
|
|
264
|
+
let loc;
|
|
253
265
|
if (type === 'Gff3TabixAdapter') {
|
|
254
|
-
|
|
266
|
+
loc = adapter.gffGzLocation;
|
|
255
267
|
}
|
|
256
268
|
else if (type === 'Gff3Adapter') {
|
|
257
|
-
|
|
269
|
+
loc = adapter.gffLocation;
|
|
270
|
+
}
|
|
271
|
+
else if (type === 'VcfAdapter') {
|
|
272
|
+
loc = adapter.vcfLocation;
|
|
258
273
|
}
|
|
259
274
|
else if (type === 'VcfTabixAdapter') {
|
|
260
|
-
|
|
275
|
+
loc = adapter.vcfGzLocation;
|
|
261
276
|
}
|
|
262
|
-
|
|
263
|
-
yield __await(
|
|
277
|
+
if (!loc) {
|
|
278
|
+
return yield __await(void 0);
|
|
279
|
+
}
|
|
280
|
+
if (type === 'Gff3TabixAdapter' || type === 'Gff3Adapter') {
|
|
281
|
+
yield __await(yield* __asyncDelegator(__asyncValues((0, gff3Adapter_1.indexGff3)({
|
|
282
|
+
config,
|
|
283
|
+
attributesToIndex: indexingAttributes,
|
|
284
|
+
inLocation: getLoc(loc),
|
|
285
|
+
outLocation,
|
|
286
|
+
typesToExclude: indexingFeatureTypesToExclude,
|
|
287
|
+
quiet,
|
|
288
|
+
}))));
|
|
289
|
+
}
|
|
290
|
+
else if (type === 'VcfTabixAdapter' || type === 'VcfAdapter') {
|
|
291
|
+
yield __await(yield* __asyncDelegator(__asyncValues((0, vcfAdapter_1.indexVcf)({
|
|
292
|
+
config,
|
|
293
|
+
attributesToIndex: indexingAttributes,
|
|
294
|
+
inLocation: getLoc(loc),
|
|
295
|
+
outLocation,
|
|
296
|
+
typesToExclude: indexingFeatureTypesToExclude,
|
|
297
|
+
quiet,
|
|
298
|
+
}))));
|
|
264
299
|
}
|
|
265
|
-
// gtf unused currently
|
|
266
300
|
}
|
|
267
301
|
});
|
|
268
302
|
}
|
|
269
|
-
runIxIxx(readStream, outLocation, name, prefixSize) {
|
|
270
|
-
|
|
271
|
-
const ixxFilename = path_1.default.join(outLocation, 'trix', `${name}.ixx`);
|
|
272
|
-
return (0, ixixx_1.ixIxxStream)(readStream, ixFilename, ixxFilename, prefixSize);
|
|
303
|
+
runIxIxx({ readStream, outLocation, name, prefixSize, }) {
|
|
304
|
+
return (0, ixixx_1.ixIxxStream)(readStream, path_1.default.join(outLocation, 'trix', `${name}.ix`), path_1.default.join(outLocation, 'trix', `${name}.ixx`), prefixSize);
|
|
273
305
|
}
|
|
274
306
|
async getTrackConfigs(configPath, trackIds, assemblyName) {
|
|
275
307
|
const { tracks } = readConf(configPath);
|
|
@@ -344,8 +376,7 @@ TextIndex.flags = {
|
|
|
344
376
|
default: 'CDS,exon',
|
|
345
377
|
}),
|
|
346
378
|
prefixSize: command_1.flags.integer({
|
|
347
|
-
description: 'Specify the prefix size for the ixx index,
|
|
348
|
-
default: 6,
|
|
379
|
+
description: 'Specify the prefix size for the ixx index. We attempt to automatically calculate this, but you can manually specify this too. If many genes have similar gene IDs e.g. Z000000001, Z000000002 the prefix size should be larger so that they get split into different bins',
|
|
349
380
|
}),
|
|
350
381
|
file: command_1.flags.string({
|
|
351
382
|
description: 'File or files to index (can be used to create trix indexes for embedded component use cases not using a config.json for example)',
|
package/lib/types/common.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ export declare function createRemoteStream(urlIn: string): Promise<import("node-
|
|
|
3
3
|
export declare function isURL(FileName: string): boolean;
|
|
4
4
|
export declare function guessAdapterFromFileName(filePath: string): Track;
|
|
5
5
|
export declare function supported(type: string): boolean;
|
|
6
|
-
export declare function generateMeta({
|
|
7
|
-
|
|
6
|
+
export declare function generateMeta({ trackConfigs, attributes, outLocation, name, typesToExclude, assemblyNames, }: {
|
|
7
|
+
trackConfigs: Track[];
|
|
8
8
|
attributes: string[];
|
|
9
|
-
|
|
9
|
+
outLocation: string;
|
|
10
10
|
name: string;
|
|
11
|
-
|
|
11
|
+
typesToExclude: string[];
|
|
12
12
|
assemblyNames: string[];
|
|
13
13
|
}): Promise<void>;
|
package/lib/types/common.js
CHANGED
|
@@ -10,7 +10,7 @@ const fetchWithProxy_1 = __importDefault(require("../fetchWithProxy"));
|
|
|
10
10
|
async function createRemoteStream(urlIn) {
|
|
11
11
|
const response = await (0, fetchWithProxy_1.default)(urlIn);
|
|
12
12
|
if (!response.ok) {
|
|
13
|
-
throw new Error(`Failed to fetch ${urlIn} status ${response.status} ${response.
|
|
13
|
+
throw new Error(`Failed to fetch ${urlIn} status ${response.status} ${await response.text()}`);
|
|
14
14
|
}
|
|
15
15
|
return response;
|
|
16
16
|
}
|
|
@@ -111,19 +111,14 @@ function supported(type) {
|
|
|
111
111
|
].includes(type);
|
|
112
112
|
}
|
|
113
113
|
exports.supported = supported;
|
|
114
|
-
async function generateMeta({
|
|
115
|
-
const tracks =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
excludedTypes: includeExclude,
|
|
123
|
-
adapterConf: adapter,
|
|
124
|
-
};
|
|
125
|
-
});
|
|
126
|
-
fs_1.default.writeFileSync(path_1.default.join(outDir, 'trix', `${name}_meta.json`), JSON.stringify({
|
|
114
|
+
async function generateMeta({ trackConfigs, attributes, outLocation, name, typesToExclude, assemblyNames, }) {
|
|
115
|
+
const tracks = trackConfigs.map(({ adapter, textSearching, trackId }) => ({
|
|
116
|
+
trackId,
|
|
117
|
+
attributesIndexed: (textSearching === null || textSearching === void 0 ? void 0 : textSearching.indexingAttributes) || attributes,
|
|
118
|
+
excludedTypes: (textSearching === null || textSearching === void 0 ? void 0 : textSearching.indexingFeatureTypesToExclude) || typesToExclude,
|
|
119
|
+
adapterConf: adapter,
|
|
120
|
+
}));
|
|
121
|
+
fs_1.default.writeFileSync(path_1.default.join(outLocation, 'trix', `${name}_meta.json`), JSON.stringify({
|
|
127
122
|
dateCreated: new Date().toISOString(),
|
|
128
123
|
tracks,
|
|
129
124
|
assemblyNames,
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { Track } from '../base';
|
|
2
|
-
export declare function indexGff3(config
|
|
2
|
+
export declare function indexGff3({ config, attributesToIndex, inLocation, outLocation, typesToExclude, quiet, }: {
|
|
3
|
+
config: Track;
|
|
4
|
+
attributesToIndex: string[];
|
|
5
|
+
inLocation: string;
|
|
6
|
+
outLocation: string;
|
|
7
|
+
typesToExclude: string[];
|
|
8
|
+
quiet: boolean;
|
|
9
|
+
}): AsyncGenerator<string, void, unknown>;
|
package/lib/types/gff3Adapter.js
CHANGED
|
@@ -23,11 +23,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.indexGff3 = void 0;
|
|
26
|
-
const util_1 = require("../util");
|
|
27
26
|
const cli_progress_1 = require("cli-progress");
|
|
28
27
|
const zlib_1 = require("zlib");
|
|
29
28
|
const readline_1 = __importDefault(require("readline"));
|
|
30
|
-
|
|
29
|
+
const util_1 = require("../util");
|
|
30
|
+
function indexGff3({ config, attributesToIndex, inLocation, outLocation, typesToExclude, quiet, }) {
|
|
31
31
|
return __asyncGenerator(this, arguments, function* indexGff3_1() {
|
|
32
32
|
var _a, e_1, _b, _c;
|
|
33
33
|
const { trackId } = config;
|
|
@@ -75,7 +75,7 @@ function indexGff3(config, attributes, inLocation, outLocation, typesToExclude,
|
|
|
75
75
|
key.trim(),
|
|
76
76
|
decodeURIComponent(val).trim().split(',').join(' '),
|
|
77
77
|
]));
|
|
78
|
-
const attrs =
|
|
78
|
+
const attrs = attributesToIndex
|
|
79
79
|
.map(attr => col9attrs[attr])
|
|
80
80
|
.filter((f) => !!f);
|
|
81
81
|
if (attrs.length) {
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { Track } from '../base';
|
|
2
|
-
export declare function indexVcf(config
|
|
2
|
+
export declare function indexVcf({ config, attributesToIndex, inLocation, outLocation, quiet, }: {
|
|
3
|
+
config: Track;
|
|
4
|
+
attributesToIndex: string[];
|
|
5
|
+
inLocation: string;
|
|
6
|
+
outLocation: string;
|
|
7
|
+
typesToExclude: string[];
|
|
8
|
+
quiet: boolean;
|
|
9
|
+
}): AsyncGenerator<string, void, unknown>;
|
package/lib/types/vcfAdapter.js
CHANGED
|
@@ -23,11 +23,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.indexVcf = void 0;
|
|
26
|
-
const util_1 = require("../util");
|
|
27
26
|
const cli_progress_1 = require("cli-progress");
|
|
28
27
|
const zlib_1 = require("zlib");
|
|
29
28
|
const readline_1 = __importDefault(require("readline"));
|
|
30
|
-
|
|
29
|
+
const util_1 = require("../util");
|
|
30
|
+
function indexVcf({ config, attributesToIndex, inLocation, outLocation, quiet, }) {
|
|
31
31
|
return __asyncGenerator(this, arguments, function* indexVcf_1() {
|
|
32
32
|
var _a, e_1, _b, _c;
|
|
33
33
|
const { trackId } = config;
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.2.2","commands":{"add-assembly":{"id":"add-assembly","description":"Add an assembly to a JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# add assembly to installation in current directory. assumes .fai file also exists, and copies GRCh38.fa and GRCh38.fa.fai to current directory","$ jbrowse add-assembly GRCh38.fa --load copy","","# add assembly to a specific jb2 installation path using --out, and copies the .fa and .fa.fai file to /path/to/jb2","$ jbrowse add-assembly GRCh38.fa --out /path/to/jb2/ --load copy","","# force indexedFasta for add-assembly without relying on file extension","$ jbrowse add-assembly GRCh38.xyz --type indexedFasta --load copy","","# add displayName for an assembly","$ jbrowse add-assembly myFile.fa.gz --name hg38 --displayName \"Homo sapiens (hg38)\"","","# use chrom.sizes file for assembly instead of a fasta file","$ jbrowse add-assembly GRCh38.chrom.sizes --load inPlace","","# add assembly from preconfigured json file, expert option","$ jbrowse add-assembly GRCh38.config.json --load copy","","# add assembly from a 2bit file, also note pointing direct to a URL so no --load flag needed","$ jbrowse add-assembly https://example.com/data/sample.2bit","","# add a bgzip indexed fasta inferred by fa.gz extension. assumes .fa.gz.gzi and .fa.gz.fai files also exists","$ jbrowse add-assembly myfile.fa.gz --load copy"],"flags":{"type":{"name":"type","type":"option","char":"t","description":"type of sequence, by default inferred from sequence file\n\nindexedFasta An index FASTA (e.g. .fa or .fasta) file;\n can optionally specify --faiLocation\n\nbgzipFasta A block-gzipped and indexed FASTA (e.g. .fa.gz or .fasta.gz) file;\n can optionally specify --faiLocation and/or --gziLocation\n\ntwoBit A twoBit (e.g. .2bit) file\n\nchromSizes A chromosome sizes (e.g. .chrom.sizes) file\n\ncustom Either a JSON file location or inline JSON that defines a custom\n sequence adapter; must provide --name if using inline JSON","options":["indexedFasta","bgzipFasta","twoBit","chromSizes","custom"]},"name":{"name":"name","type":"option","char":"n","description":"Name of the assembly; if not specified, will be guessed using the sequence file name"},"alias":{"name":"alias","type":"option","char":"a","description":"An alias for the assembly name (e.g. \"hg38\" if the name of the assembly is \"GRCh38\");\ncan be specified multiple times"},"displayName":{"name":"displayName","type":"option","description":"The display name to specify for the assembly, e.g. \"Homo sapiens (hg38)\" while the name can be a shorter identifier like \"hg38\""},"faiLocation":{"name":"faiLocation","type":"option","description":"[default: <fastaLocation>.fai] FASTA index file or URL"},"gziLocation":{"name":"gziLocation","type":"option","description":"[default: <fastaLocation>.gzi] FASTA gzip index file or URL"},"refNameAliases":{"name":"refNameAliases","type":"option","description":"Reference sequence name aliases file or URL; assumed to be a tab-separated aliases\nfile unless --refNameAliasesType is specified"},"refNameAliasesType":{"name":"refNameAliasesType","type":"option","description":"Type of aliases defined by --refNameAliases; if \"custom\", --refNameAliases is either\na JSON file location or inline JSON that defines a custom sequence adapter","options":["aliases","custom"]},"refNameColors":{"name":"refNameColors","type":"option","description":"A comma-separated list of color strings for the reference sequence names; will cycle\nthrough colors if there are fewer colors than sequences"},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to.\nCreates ./config.json if nonexistent"},"out":{"name":"out","type":"option","description":"synonym for target"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"load":{"name":"load","type":"option","char":"l","description":"Required flag when using a local file. Choose how to manage the data directory. Copy, symlink, or move the data directory to the JBrowse directory. Or use inPlace to modify the config without doing any file operations","options":["copy","symlink","move","inPlace"]},"skipCheck":{"name":"skipCheck","type":"boolean","description":"Don't check whether or not the sequence file or URL exists or if you are in a JBrowse directory","allowNo":false},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrite existing assembly if one with the same name exists","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Equivalent to `--skipCheck --overwrite`","allowNo":false}},"args":[{"name":"sequence","description":"sequence file or URL\n\nIf TYPE is indexedFasta or bgzipFasta, the index file defaults to <location>.fai\nand can be optionally specified with --faiLocation\nIf TYPE is bgzipFasta, the gzip index file defaults to <location>.gzi and can be\noptionally specified with --gziLocation","required":true}]},"add-connection":{"id":"add-connection","description":"Add a connection to a JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse add-connection http://mysite.com/jbrowse/data/","$ jbrowse add-connection http://mysite.com/jbrowse/custom_data_folder/ --type JBrowse1Connection","$ jbrowse add-connection http://mysite.com/path/to/hub.txt --assemblyName hg19","$ jbrowse add-connection http://mysite.com/path/to/custom_hub_name.txt --type UCSCTrackHubConnection --assemblyName hg19","$ jbrowse add-connection http://mysite.com/path/to/custom --type custom --config '{\"uri\":{\"url\":\"https://mysite.com/path/to/custom\"}, \"locationType\": \"UriLocation\"}' --assemblyName hg19","$ jbrowse add-connection https://mysite.com/path/to/hub.txt --connectionId newId --name newName --target /path/to/jb2/installation/config.json"],"flags":{"type":{"name":"type","type":"option","char":"t","description":"type of connection, ex. JBrowse1Connection, UCSCTrackHubConnection, custom"},"assemblyName":{"name":"assemblyName","type":"option","char":"a","description":"Assembly name of the connection If none, will default to the assembly in your config file"},"config":{"name":"config","type":"option","char":"c","description":"Any extra config settings to add to connection in JSON object format, such as '{\"uri\":\"url\":\"https://sample.com\"}, \"locationType\": \"UriLocation\"}'"},"connectionId":{"name":"connectionId","type":"option","description":"Id for the connection that must be unique to JBrowse. Defaults to 'connectionType-assemblyName-currentTime'"},"name":{"name":"name","type":"option","char":"n","description":"Name of the connection. Defaults to connectionId if not provided"},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to."},"out":{"name":"out","type":"option","description":"synonym for target"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"skipCheck":{"name":"skipCheck","type":"boolean","description":"Don't check whether or not the data directory URL exists or if you are in a JBrowse directory","allowNo":false},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrites any existing connections if same connection id","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Equivalent to `--skipCheck --overwrite`","allowNo":false}},"args":[{"name":"connectionUrlOrPath","description":"URL of data directory\nFor hub file, usually called hub.txt\nFor JBrowse 1, location of JB1 data directory similar to http://mysite.com/jbrowse/data/ ","required":true}]},"add-track-json":{"id":"add-track-json","description":"Add a track configuration directly from a JSON hunk to the JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse add-track-json track.json","$ jbrowse add-track-json track.json --update"],"flags":{"update":{"name":"update","type":"boolean","char":"u","description":"update the contents of an existing track, matched based on trackId","allowNo":false},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to.\nCreates ./config.json if nonexistent"},"out":{"name":"out","type":"option","description":"synonym for target"}},"args":[{"name":"track","description":"track JSON file or command line arg blob","required":true}]},"add-track":{"id":"add-track","description":"Add a track to a JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# copy /path/to/my.bam and /path/to/my.bam.bai to current directory and adds track to config.json","$ jbrowse add-track /path/to/my.bam --load copy","","# copy my.bam and my.bam.bai to /path/to/jb2/bam and adds track entry to /path/to/jb2/bam/config.json","$ jbrowse add-track my.bam --load copy --out /path/to/jb2 --subDir bam","","# same as above, but specify path to bai file. needed for if the bai file does not have the extension .bam.bai","$ jbrowse add-track my.bam --indexFile my.bai --load copy","","# creates symlink for /path/to/my.bam and adds track to config.json","$ jbrowse add-track /path/to/my.bam --load symlink","","# add track from URL to config.json, no --load flag needed","$ jbrowse add-track https://mywebsite.com/my.bam","","# --load inPlace adds a track without doing file operations","$ jbrowse add-track /url/relative/path.bam --load inPlace"],"flags":{"trackType":{"name":"trackType","type":"option","char":"t","description":"Type of track, by default inferred from track file"},"name":{"name":"name","type":"option","char":"n","description":"Name of the track. Will be defaulted to the trackId if none specified"},"indexFile":{"name":"indexFile","type":"option","description":"Optional index file for the track"},"description":{"name":"description","type":"option","char":"d","description":"Optional description of the track"},"assemblyNames":{"name":"assemblyNames","type":"option","char":"a","description":"Assembly name or names for track as comma separated string. If none, will default to the assembly in your config file"},"category":{"name":"category","type":"option","description":"Optional Comma separated string of categories to group tracks"},"config":{"name":"config","type":"option","description":"Any extra config settings to add to a track. i.e '{\"defaultRendering\": \"density\"}'"},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation to write out to."},"out":{"name":"out","type":"option","description":"synonym for target"},"subDir":{"name":"subDir","type":"option","description":"when using --load a file, output to a subdirectory of the target dir","default":""},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"trackId":{"name":"trackId","type":"option","description":"trackId for the track, by default inferred from filename, must be unique throughout config"},"load":{"name":"load","type":"option","char":"l","description":"Required flag when using a local file. Choose how to manage the track. Copy, symlink, or move the track to the JBrowse directory. Or inPlace to leave track alone","options":["copy","symlink","move","inPlace"]},"skipCheck":{"name":"skipCheck","type":"boolean","description":"Skip check for whether or not the file or URL exists or if you are in a JBrowse directory","allowNo":false},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrites existing track if it shares the same trackId","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Equivalent to `--skipCheck --overwrite`","allowNo":false},"protocol":{"name":"protocol","type":"option","description":"Force protocol to a specific value","default":"uri"}},"args":[{"name":"track","description":"Track file or URL","required":true}]},"admin-server":{"id":"admin-server","description":"Start up a small admin server for JBrowse configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse admin-server","$ jbrowse admin-server -p 8888"],"flags":{"port":{"name":"port","type":"option","char":"p","description":"Specifified port to start the server on;\nDefault is 9090."},"root":{"name":"root","type":"option","description":"path to the root of the JB2 installation.\nCreates ./config.json if nonexistent. note that you can navigate to ?config=path/to/subconfig.json in the web browser and it will write to rootDir/path/to/subconfig.json"},"bodySizeLimit":{"name":"bodySizeLimit","type":"option","description":"Size limit of the update message; may need to increase if config is large.\nArgument is passed to bytes library for parsing: https://www.npmjs.com/package/bytes.","default":"25mb"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"create":{"id":"create","description":"Downloads and installs the latest JBrowse 2 release","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# Download latest release from github, and put in specific path","$ jbrowse create /path/to/new/installation","","# Download latest release from github and force overwrite existing contents at path","$ jbrowse create /path/to/new/installation --force","","# Download latest release from a specific URL","$ jbrowse create /path/to/new/installation --url url.com/directjbrowselink.zip","","# Download a specific tag from github","$ jbrowse create /path/to/new/installation --tag v1.0.0","","# List available versions","$ jbrowse create --listVersions"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Overwrites existing JBrowse 2 installation if present in path","allowNo":false},"listVersions":{"name":"listVersions","type":"boolean","char":"l","description":"Lists out all versions of JBrowse 2","allowNo":false},"branch":{"name":"branch","type":"option","description":"Download a development build from a named git branch"},"nightly":{"name":"nightly","type":"boolean","description":"Download the latest development build from the main branch","allowNo":false},"url":{"name":"url","type":"option","char":"u","description":"A direct URL to a JBrowse 2 release"},"tag":{"name":"tag","type":"option","char":"t","description":"Version of JBrowse 2 to install. Format is v1.0.0.\nDefaults to latest"}},"args":[{"name":"localPath","description":"Location where JBrowse 2 will be installed","required":true}]},"remove-track":{"id":"remove-track","description":"Remove a track configuration from a JBrowse 2 configuration. Be aware that this can cause crashes in saved sessions that refer to this track!","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse remove-track-json trackId"],"flags":{"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to.\nCreates ./config.json if nonexistent"},"out":{"name":"out","type":"option","description":"synonym for target"}},"args":[{"name":"track","description":"track JSON file or command line arg blob","required":true}]},"set-default-session":{"id":"set-default-session","description":"Set a default session with views and tracks","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse set-default-session --session /path/to/default/session.json","$ jbrowse set-default-session --target /path/to/jb2/installation/config.json --view LinearGenomeView --tracks track1, track2, track3","$ jbrowse set-default-session --view LinearGenomeView, --name newName --viewId view-no-tracks","$ jbrowse set-default-session --currentSession # Prints out current default session"],"flags":{"session":{"name":"session","type":"option","char":"s","description":"set path to a file containing session in json format"},"name":{"name":"name","type":"option","char":"n","description":"Give a name for the default session","default":"New Default Session"},"view":{"name":"view","type":"option","char":"v","description":"View type in config to be added as default session, i.e LinearGenomeView, CircularView, DotplotView.\nMust be provided if no default session file provided"},"viewId":{"name":"viewId","type":"option","description":"Identifier for the view. Will be generated on default"},"tracks":{"name":"tracks","type":"option","char":"t","description":"Track id or track ids as comma separated string to put into default session"},"currentSession":{"name":"currentSession","type":"boolean","char":"c","description":"List out the current default session","allowNo":false},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to"},"out":{"name":"out","type":"option","description":"synonym for target"},"delete":{"name":"delete","type":"boolean","description":"Delete any existing default session.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"text-index":{"id":"text-index","description":"Make a text-indexing file for any given track(s).","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# indexes all tracks that it can find in the current directory's config.json","$ jbrowse text-index","","# indexes specific trackIds that it can find in the current directory's config.json","$ jbrowse text-index --tracks=track1,track2,track3","","# indexes all tracks in a directory's config.json or in a specific config file","$ jbrowse text-index --out /path/to/jb2/","","# indexes only a specific assembly, and overwrite what was previously there using force (which is needed if a previous index already existed)","$ jbrowse text-index -a hg19 --force","","# create index for some files for use in @jbrowse/react-linear-genome-view or similar","$ jbrowse text-index --file myfile.gff3.gz --file myfile.vcfgz --out indexes"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"tracks":{"name":"tracks","type":"option","description":"Specific tracks to index, formatted as comma separated trackIds. If unspecified, indexes all available tracks"},"target":{"name":"target","type":"option","description":"Path to config file in JB2 installation directory to read from."},"out":{"name":"out","type":"option","description":"Synonym for target"},"attributes":{"name":"attributes","type":"option","description":"Comma separated list of attributes to index","default":"Name,ID"},"assemblies":{"name":"assemblies","type":"option","char":"a","description":"Specify the assembl(ies) to create an index for. If unspecified, creates an index for each assembly in the config"},"force":{"name":"force","type":"boolean","description":"Overwrite previously existing indexes","allowNo":false},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"Hide the progress bars","allowNo":false},"perTrack":{"name":"perTrack","type":"boolean","description":"If set, creates an index per track","allowNo":false},"exclude":{"name":"exclude","type":"option","description":"Adds gene type to list of excluded types","default":"CDS,exon"},"prefixSize":{"name":"prefixSize","type":"option","description":"Specify the prefix size for the ixx index, increase size if many of your gene IDs have same prefix e.g. Z000000001, Z000000002","default":6},"file":{"name":"file","type":"option","description":"File or files to index (can be used to create trix indexes for embedded component use cases not using a config.json for example)"},"fileId":{"name":"fileId","type":"option","description":"Set the trackId used for the indexes generated with the --file argument"},"dryrun":{"name":"dryrun","type":"boolean","description":"Just print out tracks that will be indexed by the process, without doing any indexing","allowNo":false}},"args":[]},"upgrade":{"id":"upgrade","description":"Upgrades JBrowse 2 to latest version","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# Upgrades current directory to latest jbrowse release","$ jbrowse upgrade","","# Upgrade jbrowse instance at a specific filesystem path","$ jbrowse upgrade /path/to/jbrowse2/installation","","# Upgrade to a specific tag","$ jbrowse upgrade /path/to/jbrowse2/installation --tag v1.0.0","","# List versions available on github","$ jbrowse upgrade --listVersions","","# Upgrade from a specific URL","$ jbrowse upgrade --url https://sample.com/jbrowse2.zip","","# Get nightly release from main branch","$ jbrowse upgrade --nightly"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"listVersions":{"name":"listVersions","type":"boolean","char":"l","description":"Lists out all versions of JBrowse 2","allowNo":false},"tag":{"name":"tag","type":"option","char":"t","description":"Version of JBrowse 2 to install. Format is v1.0.0.\nDefaults to latest"},"branch":{"name":"branch","type":"option","description":"Download a development build from a named git branch"},"nightly":{"name":"nightly","type":"boolean","description":"Download the latest development build from the main branch","allowNo":false},"clean":{"name":"clean","type":"boolean","description":"Removes old js,map,and LICENSE files in the installation","allowNo":false},"url":{"name":"url","type":"option","char":"u","description":"A direct URL to a JBrowse 2 release"}},"args":[{"name":"localPath","description":"Location where JBrowse 2 is installed","required":false,"default":"."}]}}}
|
|
1
|
+
{"version":"2.3.0","commands":{"add-assembly":{"id":"add-assembly","description":"Add an assembly to a JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# add assembly to installation in current directory. assumes .fai file also exists, and copies GRCh38.fa and GRCh38.fa.fai to current directory","$ jbrowse add-assembly GRCh38.fa --load copy","","# add assembly to a specific jb2 installation path using --out, and copies the .fa and .fa.fai file to /path/to/jb2","$ jbrowse add-assembly GRCh38.fa --out /path/to/jb2/ --load copy","","# force indexedFasta for add-assembly without relying on file extension","$ jbrowse add-assembly GRCh38.xyz --type indexedFasta --load copy","","# add displayName for an assembly","$ jbrowse add-assembly myFile.fa.gz --name hg38 --displayName \"Homo sapiens (hg38)\"","","# use chrom.sizes file for assembly instead of a fasta file","$ jbrowse add-assembly GRCh38.chrom.sizes --load inPlace","","# add assembly from preconfigured json file, expert option","$ jbrowse add-assembly GRCh38.config.json --load copy","","# add assembly from a 2bit file, also note pointing direct to a URL so no --load flag needed","$ jbrowse add-assembly https://example.com/data/sample.2bit","","# add a bgzip indexed fasta inferred by fa.gz extension. assumes .fa.gz.gzi and .fa.gz.fai files also exists","$ jbrowse add-assembly myfile.fa.gz --load copy"],"flags":{"type":{"name":"type","type":"option","char":"t","description":"type of sequence, by default inferred from sequence file\n\nindexedFasta An index FASTA (e.g. .fa or .fasta) file;\n can optionally specify --faiLocation\n\nbgzipFasta A block-gzipped and indexed FASTA (e.g. .fa.gz or .fasta.gz) file;\n can optionally specify --faiLocation and/or --gziLocation\n\ntwoBit A twoBit (e.g. .2bit) file\n\nchromSizes A chromosome sizes (e.g. .chrom.sizes) file\n\ncustom Either a JSON file location or inline JSON that defines a custom\n sequence adapter; must provide --name if using inline JSON","options":["indexedFasta","bgzipFasta","twoBit","chromSizes","custom"]},"name":{"name":"name","type":"option","char":"n","description":"Name of the assembly; if not specified, will be guessed using the sequence file name"},"alias":{"name":"alias","type":"option","char":"a","description":"An alias for the assembly name (e.g. \"hg38\" if the name of the assembly is \"GRCh38\");\ncan be specified multiple times"},"displayName":{"name":"displayName","type":"option","description":"The display name to specify for the assembly, e.g. \"Homo sapiens (hg38)\" while the name can be a shorter identifier like \"hg38\""},"faiLocation":{"name":"faiLocation","type":"option","description":"[default: <fastaLocation>.fai] FASTA index file or URL"},"gziLocation":{"name":"gziLocation","type":"option","description":"[default: <fastaLocation>.gzi] FASTA gzip index file or URL"},"refNameAliases":{"name":"refNameAliases","type":"option","description":"Reference sequence name aliases file or URL; assumed to be a tab-separated aliases\nfile unless --refNameAliasesType is specified"},"refNameAliasesType":{"name":"refNameAliasesType","type":"option","description":"Type of aliases defined by --refNameAliases; if \"custom\", --refNameAliases is either\na JSON file location or inline JSON that defines a custom sequence adapter","options":["aliases","custom"]},"refNameColors":{"name":"refNameColors","type":"option","description":"A comma-separated list of color strings for the reference sequence names; will cycle\nthrough colors if there are fewer colors than sequences"},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to.\nCreates ./config.json if nonexistent"},"out":{"name":"out","type":"option","description":"synonym for target"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"load":{"name":"load","type":"option","char":"l","description":"Required flag when using a local file. Choose how to manage the data directory. Copy, symlink, or move the data directory to the JBrowse directory. Or use inPlace to modify the config without doing any file operations","options":["copy","symlink","move","inPlace"]},"skipCheck":{"name":"skipCheck","type":"boolean","description":"Don't check whether or not the sequence file or URL exists or if you are in a JBrowse directory","allowNo":false},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrite existing assembly if one with the same name exists","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Equivalent to `--skipCheck --overwrite`","allowNo":false}},"args":[{"name":"sequence","description":"sequence file or URL\n\nIf TYPE is indexedFasta or bgzipFasta, the index file defaults to <location>.fai\nand can be optionally specified with --faiLocation\nIf TYPE is bgzipFasta, the gzip index file defaults to <location>.gzi and can be\noptionally specified with --gziLocation","required":true}]},"add-connection":{"id":"add-connection","description":"Add a connection to a JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse add-connection http://mysite.com/jbrowse/data/","$ jbrowse add-connection http://mysite.com/jbrowse/custom_data_folder/ --type JBrowse1Connection","$ jbrowse add-connection http://mysite.com/path/to/hub.txt --assemblyName hg19","$ jbrowse add-connection http://mysite.com/path/to/custom_hub_name.txt --type UCSCTrackHubConnection --assemblyName hg19","$ jbrowse add-connection http://mysite.com/path/to/custom --type custom --config '{\"uri\":{\"url\":\"https://mysite.com/path/to/custom\"}, \"locationType\": \"UriLocation\"}' --assemblyName hg19","$ jbrowse add-connection https://mysite.com/path/to/hub.txt --connectionId newId --name newName --target /path/to/jb2/installation/config.json"],"flags":{"type":{"name":"type","type":"option","char":"t","description":"type of connection, ex. JBrowse1Connection, UCSCTrackHubConnection, custom"},"assemblyName":{"name":"assemblyName","type":"option","char":"a","description":"Assembly name of the connection If none, will default to the assembly in your config file"},"config":{"name":"config","type":"option","char":"c","description":"Any extra config settings to add to connection in JSON object format, such as '{\"uri\":\"url\":\"https://sample.com\"}, \"locationType\": \"UriLocation\"}'"},"connectionId":{"name":"connectionId","type":"option","description":"Id for the connection that must be unique to JBrowse. Defaults to 'connectionType-assemblyName-currentTime'"},"name":{"name":"name","type":"option","char":"n","description":"Name of the connection. Defaults to connectionId if not provided"},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to."},"out":{"name":"out","type":"option","description":"synonym for target"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"skipCheck":{"name":"skipCheck","type":"boolean","description":"Don't check whether or not the data directory URL exists or if you are in a JBrowse directory","allowNo":false},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrites any existing connections if same connection id","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Equivalent to `--skipCheck --overwrite`","allowNo":false}},"args":[{"name":"connectionUrlOrPath","description":"URL of data directory\nFor hub file, usually called hub.txt\nFor JBrowse 1, location of JB1 data directory similar to http://mysite.com/jbrowse/data/ ","required":true}]},"add-track-json":{"id":"add-track-json","description":"Add a track configuration directly from a JSON hunk to the JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse add-track-json track.json","$ jbrowse add-track-json track.json --update"],"flags":{"update":{"name":"update","type":"boolean","char":"u","description":"update the contents of an existing track, matched based on trackId","allowNo":false},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to.\nCreates ./config.json if nonexistent"},"out":{"name":"out","type":"option","description":"synonym for target"}},"args":[{"name":"track","description":"track JSON file or command line arg blob","required":true}]},"add-track":{"id":"add-track","description":"Add a track to a JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# copy /path/to/my.bam and /path/to/my.bam.bai to current directory and adds track to config.json","$ jbrowse add-track /path/to/my.bam --load copy","","# copy my.bam and my.bam.bai to /path/to/jb2/bam and adds track entry to /path/to/jb2/bam/config.json","$ jbrowse add-track my.bam --load copy --out /path/to/jb2 --subDir bam","","# same as above, but specify path to bai file. needed for if the bai file does not have the extension .bam.bai","$ jbrowse add-track my.bam --indexFile my.bai --load copy","","# creates symlink for /path/to/my.bam and adds track to config.json","$ jbrowse add-track /path/to/my.bam --load symlink","","# add track from URL to config.json, no --load flag needed","$ jbrowse add-track https://mywebsite.com/my.bam","","# --load inPlace adds a track without doing file operations","$ jbrowse add-track /url/relative/path.bam --load inPlace"],"flags":{"trackType":{"name":"trackType","type":"option","char":"t","description":"Type of track, by default inferred from track file"},"name":{"name":"name","type":"option","char":"n","description":"Name of the track. Will be defaulted to the trackId if none specified"},"indexFile":{"name":"indexFile","type":"option","description":"Optional index file for the track"},"description":{"name":"description","type":"option","char":"d","description":"Optional description of the track"},"assemblyNames":{"name":"assemblyNames","type":"option","char":"a","description":"Assembly name or names for track as comma separated string. If none, will default to the assembly in your config file"},"category":{"name":"category","type":"option","description":"Optional Comma separated string of categories to group tracks"},"config":{"name":"config","type":"option","description":"Any extra config settings to add to a track. i.e '{\"defaultRendering\": \"density\"}'"},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation to write out to."},"out":{"name":"out","type":"option","description":"synonym for target"},"subDir":{"name":"subDir","type":"option","description":"when using --load a file, output to a subdirectory of the target dir","default":""},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"trackId":{"name":"trackId","type":"option","description":"trackId for the track, by default inferred from filename, must be unique throughout config"},"load":{"name":"load","type":"option","char":"l","description":"Required flag when using a local file. Choose how to manage the track. Copy, symlink, or move the track to the JBrowse directory. Or inPlace to leave track alone","options":["copy","symlink","move","inPlace"]},"skipCheck":{"name":"skipCheck","type":"boolean","description":"Skip check for whether or not the file or URL exists or if you are in a JBrowse directory","allowNo":false},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrites existing track if it shares the same trackId","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Equivalent to `--skipCheck --overwrite`","allowNo":false},"protocol":{"name":"protocol","type":"option","description":"Force protocol to a specific value","default":"uri"}},"args":[{"name":"track","description":"Track file or URL","required":true}]},"admin-server":{"id":"admin-server","description":"Start up a small admin server for JBrowse configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse admin-server","$ jbrowse admin-server -p 8888"],"flags":{"port":{"name":"port","type":"option","char":"p","description":"Specifified port to start the server on;\nDefault is 9090."},"root":{"name":"root","type":"option","description":"path to the root of the JB2 installation.\nCreates ./config.json if nonexistent. note that you can navigate to ?config=path/to/subconfig.json in the web browser and it will write to rootDir/path/to/subconfig.json"},"bodySizeLimit":{"name":"bodySizeLimit","type":"option","description":"Size limit of the update message; may need to increase if config is large.\nArgument is passed to bytes library for parsing: https://www.npmjs.com/package/bytes.","default":"25mb"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"create":{"id":"create","description":"Downloads and installs the latest JBrowse 2 release","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# Download latest release from github, and put in specific path","$ jbrowse create /path/to/new/installation","","# Download latest release from github and force overwrite existing contents at path","$ jbrowse create /path/to/new/installation --force","","# Download latest release from a specific URL","$ jbrowse create /path/to/new/installation --url url.com/directjbrowselink.zip","","# Download a specific tag from github","$ jbrowse create /path/to/new/installation --tag v1.0.0","","# List available versions","$ jbrowse create --listVersions"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Overwrites existing JBrowse 2 installation if present in path","allowNo":false},"listVersions":{"name":"listVersions","type":"boolean","char":"l","description":"Lists out all versions of JBrowse 2","allowNo":false},"branch":{"name":"branch","type":"option","description":"Download a development build from a named git branch"},"nightly":{"name":"nightly","type":"boolean","description":"Download the latest development build from the main branch","allowNo":false},"url":{"name":"url","type":"option","char":"u","description":"A direct URL to a JBrowse 2 release"},"tag":{"name":"tag","type":"option","char":"t","description":"Version of JBrowse 2 to install. Format is v1.0.0.\nDefaults to latest"}},"args":[{"name":"localPath","description":"Location where JBrowse 2 will be installed","required":true}]},"remove-track":{"id":"remove-track","description":"Remove a track configuration from a JBrowse 2 configuration. Be aware that this can cause crashes in saved sessions that refer to this track!","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse remove-track-json trackId"],"flags":{"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to.\nCreates ./config.json if nonexistent"},"out":{"name":"out","type":"option","description":"synonym for target"}},"args":[{"name":"track","description":"track JSON file or command line arg blob","required":true}]},"set-default-session":{"id":"set-default-session","description":"Set a default session with views and tracks","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse set-default-session --session /path/to/default/session.json","$ jbrowse set-default-session --target /path/to/jb2/installation/config.json --view LinearGenomeView --tracks track1, track2, track3","$ jbrowse set-default-session --view LinearGenomeView, --name newName --viewId view-no-tracks","$ jbrowse set-default-session --currentSession # Prints out current default session"],"flags":{"session":{"name":"session","type":"option","char":"s","description":"set path to a file containing session in json format"},"name":{"name":"name","type":"option","char":"n","description":"Give a name for the default session","default":"New Default Session"},"view":{"name":"view","type":"option","char":"v","description":"View type in config to be added as default session, i.e LinearGenomeView, CircularView, DotplotView.\nMust be provided if no default session file provided"},"viewId":{"name":"viewId","type":"option","description":"Identifier for the view. Will be generated on default"},"tracks":{"name":"tracks","type":"option","char":"t","description":"Track id or track ids as comma separated string to put into default session"},"currentSession":{"name":"currentSession","type":"boolean","char":"c","description":"List out the current default session","allowNo":false},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to"},"out":{"name":"out","type":"option","description":"synonym for target"},"delete":{"name":"delete","type":"boolean","description":"Delete any existing default session.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"text-index":{"id":"text-index","description":"Make a text-indexing file for any given track(s).","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# indexes all tracks that it can find in the current directory's config.json","$ jbrowse text-index","","# indexes specific trackIds that it can find in the current directory's config.json","$ jbrowse text-index --tracks=track1,track2,track3","","# indexes all tracks in a directory's config.json or in a specific config file","$ jbrowse text-index --out /path/to/jb2/","","# indexes only a specific assembly, and overwrite what was previously there using force (which is needed if a previous index already existed)","$ jbrowse text-index -a hg19 --force","","# create index for some files for use in @jbrowse/react-linear-genome-view or similar","$ jbrowse text-index --file myfile.gff3.gz --file myfile.vcfgz --out indexes"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"tracks":{"name":"tracks","type":"option","description":"Specific tracks to index, formatted as comma separated trackIds. If unspecified, indexes all available tracks"},"target":{"name":"target","type":"option","description":"Path to config file in JB2 installation directory to read from."},"out":{"name":"out","type":"option","description":"Synonym for target"},"attributes":{"name":"attributes","type":"option","description":"Comma separated list of attributes to index","default":"Name,ID"},"assemblies":{"name":"assemblies","type":"option","char":"a","description":"Specify the assembl(ies) to create an index for. If unspecified, creates an index for each assembly in the config"},"force":{"name":"force","type":"boolean","description":"Overwrite previously existing indexes","allowNo":false},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"Hide the progress bars","allowNo":false},"perTrack":{"name":"perTrack","type":"boolean","description":"If set, creates an index per track","allowNo":false},"exclude":{"name":"exclude","type":"option","description":"Adds gene type to list of excluded types","default":"CDS,exon"},"prefixSize":{"name":"prefixSize","type":"option","description":"Specify the prefix size for the ixx index. We attempt to automatically calculate this, but you can manually specify this too. If many genes have similar gene IDs e.g. Z000000001, Z000000002 the prefix size should be larger so that they get split into different bins"},"file":{"name":"file","type":"option","description":"File or files to index (can be used to create trix indexes for embedded component use cases not using a config.json for example)"},"fileId":{"name":"fileId","type":"option","description":"Set the trackId used for the indexes generated with the --file argument"},"dryrun":{"name":"dryrun","type":"boolean","description":"Just print out tracks that will be indexed by the process, without doing any indexing","allowNo":false}},"args":[]},"upgrade":{"id":"upgrade","description":"Upgrades JBrowse 2 to latest version","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# Upgrades current directory to latest jbrowse release","$ jbrowse upgrade","","# Upgrade jbrowse instance at a specific filesystem path","$ jbrowse upgrade /path/to/jbrowse2/installation","","# Upgrade to a specific tag","$ jbrowse upgrade /path/to/jbrowse2/installation --tag v1.0.0","","# List versions available on github","$ jbrowse upgrade --listVersions","","# Upgrade from a specific URL","$ jbrowse upgrade --url https://sample.com/jbrowse2.zip","","# Get nightly release from main branch","$ jbrowse upgrade --nightly"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"listVersions":{"name":"listVersions","type":"boolean","char":"l","description":"Lists out all versions of JBrowse 2","allowNo":false},"tag":{"name":"tag","type":"option","char":"t","description":"Version of JBrowse 2 to install. Format is v1.0.0.\nDefaults to latest"},"branch":{"name":"branch","type":"option","description":"Download a development build from a named git branch"},"nightly":{"name":"nightly","type":"boolean","description":"Download the latest development build from the main branch","allowNo":false},"clean":{"name":"clean","type":"boolean","description":"Removes old js,map,and LICENSE files in the installation","allowNo":false},"url":{"name":"url","type":"option","char":"u","description":"A direct URL to a JBrowse 2 release"}},"args":[{"name":"localPath","description":"Location where JBrowse 2 is installed","required":false,"default":"."}]}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "A command line tool for working with JBrowse 2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -54,10 +54,9 @@
|
|
|
54
54
|
"cors": "^2.8.5",
|
|
55
55
|
"del": "^6.0.0",
|
|
56
56
|
"express": "^4.17.1",
|
|
57
|
-
"ixixx": "^
|
|
57
|
+
"ixixx": "^2.0.1",
|
|
58
58
|
"json-parse-better-errors": "^1.0.2",
|
|
59
59
|
"node-fetch": "^2.6.0",
|
|
60
|
-
"object.fromentries": "^2.0.5",
|
|
61
60
|
"proxy-agent": "^5.0.0",
|
|
62
61
|
"rimraf": "^3.0.2",
|
|
63
62
|
"tslib": "^2.3.1",
|
|
@@ -77,5 +76,5 @@
|
|
|
77
76
|
"publishConfig": {
|
|
78
77
|
"access": "public"
|
|
79
78
|
},
|
|
80
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "a85b280a8af4d1a11e81ab42913f5f6049e6e580"
|
|
81
80
|
}
|
package/lib/types/gtfAdapter.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
3
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
4
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
5
|
-
var m = o[Symbol.asyncIterator], i;
|
|
6
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
7
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
8
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
9
|
-
};
|
|
10
|
-
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
11
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
12
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
13
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
14
|
-
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
15
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
16
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
17
|
-
function fulfill(value) { resume("next", value); }
|
|
18
|
-
function reject(value) { resume("throw", value); }
|
|
19
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.indexGtf = void 0;
|
|
26
|
-
const util_1 = require("../util");
|
|
27
|
-
const cli_progress_1 = require("cli-progress");
|
|
28
|
-
const zlib_1 = require("zlib");
|
|
29
|
-
const readline_1 = __importDefault(require("readline"));
|
|
30
|
-
function indexGtf(config, attributes, outLocation, typesToExclude, quiet) {
|
|
31
|
-
return __asyncGenerator(this, arguments, function* indexGtf_1() {
|
|
32
|
-
var _a, e_1, _b, _c;
|
|
33
|
-
const { adapter, trackId } = config;
|
|
34
|
-
const { gtfLocation: { uri }, } = adapter;
|
|
35
|
-
// progress bar code was aided by blog post at
|
|
36
|
-
// https://webomnizz.com/download-a-file-with-progressbar-using-node-js/
|
|
37
|
-
const progressBar = new cli_progress_1.SingleBar({
|
|
38
|
-
format: '{bar} ' + trackId + ' {percentage}% | ETA: {eta}s',
|
|
39
|
-
etaBuffer: 2000,
|
|
40
|
-
}, cli_progress_1.Presets.shades_classic);
|
|
41
|
-
let receivedBytes = 0;
|
|
42
|
-
const { totalBytes, stream } = yield __await((0, util_1.getLocalOrRemoteStream)(uri, outLocation));
|
|
43
|
-
if (!quiet) {
|
|
44
|
-
progressBar.start(totalBytes, 0);
|
|
45
|
-
}
|
|
46
|
-
stream.on('data', chunk => {
|
|
47
|
-
receivedBytes += chunk.length;
|
|
48
|
-
progressBar.update(receivedBytes);
|
|
49
|
-
});
|
|
50
|
-
const gzStream = uri.match(/.b?gz$/) ? stream.pipe((0, zlib_1.createGunzip)()) : stream;
|
|
51
|
-
const rl = readline_1.default.createInterface({
|
|
52
|
-
input: gzStream,
|
|
53
|
-
});
|
|
54
|
-
try {
|
|
55
|
-
for (var _d = true, rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield __await(rl_1.next()), _a = rl_1_1.done, !_a;) {
|
|
56
|
-
_c = rl_1_1.value;
|
|
57
|
-
_d = false;
|
|
58
|
-
try {
|
|
59
|
-
const line = _c;
|
|
60
|
-
if (line.startsWith('#')) {
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
else if (line.startsWith('>')) {
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
const [seq_name, , type, start, end, , , , col9] = line.split('\t');
|
|
67
|
-
const locStr = `${seq_name}:${start}..${end}`;
|
|
68
|
-
if (!typesToExclude.includes(type)) {
|
|
69
|
-
const col9Attrs = Object.fromEntries(col9
|
|
70
|
-
.split(';')
|
|
71
|
-
.map(f => f.trim())
|
|
72
|
-
.filter(f => !!f)
|
|
73
|
-
.map(f => f.split(' '))
|
|
74
|
-
.map(([key, val]) => {
|
|
75
|
-
return [
|
|
76
|
-
key.trim(),
|
|
77
|
-
val.trim().split(',').join(' ').replace(/("|')/g, ''),
|
|
78
|
-
];
|
|
79
|
-
}));
|
|
80
|
-
const attrs = attributes
|
|
81
|
-
.map(attr => col9Attrs[attr])
|
|
82
|
-
.filter((f) => !!f);
|
|
83
|
-
if (attrs.length) {
|
|
84
|
-
const record = JSON.stringify([
|
|
85
|
-
encodeURIComponent(locStr),
|
|
86
|
-
encodeURIComponent(trackId),
|
|
87
|
-
...attrs.map(a => encodeURIComponent(a || '')),
|
|
88
|
-
]).replace(/,/g, '|');
|
|
89
|
-
yield yield __await(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
finally {
|
|
94
|
-
_d = true;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
99
|
-
finally {
|
|
100
|
-
try {
|
|
101
|
-
if (!_d && !_a && (_b = rl_1.return)) yield __await(_b.call(rl_1));
|
|
102
|
-
}
|
|
103
|
-
finally { if (e_1) throw e_1.error; }
|
|
104
|
-
}
|
|
105
|
-
progressBar.stop();
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
exports.indexGtf = indexGtf;
|