@jbrowse/cli 2.8.0 → 2.9.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 +73 -72
- package/lib/commands/add-track.js +45 -31
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -204,7 +204,7 @@ EXAMPLES
|
|
|
204
204
|
```
|
|
205
205
|
|
|
206
206
|
_See code:
|
|
207
|
-
[src/commands/add-assembly.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
207
|
+
[src/commands/add-assembly.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/add-assembly.ts)_
|
|
208
208
|
|
|
209
209
|
## `jbrowse add-connection CONNECTIONURLORPATH`
|
|
210
210
|
|
|
@@ -229,13 +229,13 @@ FLAGS
|
|
|
229
229
|
-h, --help Show CLI help.
|
|
230
230
|
-n, --name=<value> Name of the connection. Defaults to connectionId if not provided
|
|
231
231
|
-t, --type=<value> type of connection, ex. JBrowse1Connection, UCSCTrackHubConnection, custom
|
|
232
|
-
|
|
232
|
+
--connectionId=<value> Id for the connection that must be unique to JBrowse. Defaults to
|
|
233
233
|
'connectionType-assemblyName-currentTime'
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
--out=<value> synonym for target
|
|
235
|
+
--overwrite Overwrites any existing connections if same connection id
|
|
236
|
+
--skipCheck Don't check whether or not the data directory URL exists or if you are in a JBrowse
|
|
237
237
|
directory
|
|
238
|
-
|
|
238
|
+
--target=<value> path to config file in JB2 installation directory to write out to.
|
|
239
239
|
|
|
240
240
|
DESCRIPTION
|
|
241
241
|
Add a connection to a JBrowse 2 configuration
|
|
@@ -255,7 +255,7 @@ EXAMPLES
|
|
|
255
255
|
```
|
|
256
256
|
|
|
257
257
|
_See code:
|
|
258
|
-
[src/commands/add-connection.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
258
|
+
[src/commands/add-connection.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/add-connection.ts)_
|
|
259
259
|
|
|
260
260
|
## `jbrowse add-track TRACK`
|
|
261
261
|
|
|
@@ -282,18 +282,18 @@ FLAGS
|
|
|
282
282
|
<options: copy|symlink|move|inPlace>
|
|
283
283
|
-n, --name=<value> Name of the track. Will be defaulted to the trackId if none specified
|
|
284
284
|
-t, --trackType=<value> Type of track, by default inferred from track file
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
285
|
+
--bed1=<value> Used only for mcscan anchors/simpleAnchors types
|
|
286
|
+
--bed2=<value> Used only for mcscan anchors/simpleAnchors types
|
|
287
|
+
--category=<value> Optional Comma separated string of categories to group tracks
|
|
288
|
+
--config=<value> Any extra config settings to add to a track. i.e '{"defaultRendering": "density"}'
|
|
289
|
+
--indexFile=<value> Optional index file for the track
|
|
290
|
+
--out=<value> synonym for target
|
|
291
|
+
--overwrite Overwrites existing track if it shares the same trackId
|
|
292
|
+
--protocol=<value> [default: uri] Force protocol to a specific value
|
|
293
|
+
--skipCheck Skip check for whether or not the file or URL exists or if you are in a JBrowse directory
|
|
294
|
+
--subDir=<value> when using --load a file, output to a subdirectory of the target dir
|
|
295
|
+
--target=<value> path to config file in JB2 installation to write out to.
|
|
296
|
+
--trackId=<value> trackId for the track, by default inferred from filename, must be unique throughout
|
|
297
297
|
config
|
|
298
298
|
|
|
299
299
|
DESCRIPTION
|
|
@@ -336,7 +336,7 @@ EXAMPLES
|
|
|
336
336
|
```
|
|
337
337
|
|
|
338
338
|
_See code:
|
|
339
|
-
[src/commands/add-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
339
|
+
[src/commands/add-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/add-track.ts)_
|
|
340
340
|
|
|
341
341
|
## `jbrowse add-track-json TRACK`
|
|
342
342
|
|
|
@@ -351,10 +351,10 @@ ARGUMENTS
|
|
|
351
351
|
TRACK track JSON file or command line arg blob
|
|
352
352
|
|
|
353
353
|
FLAGS
|
|
354
|
-
-u, --update
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
354
|
+
-u, --update update the contents of an existing track, matched based on trackId
|
|
355
|
+
--out=<value> synonym for target
|
|
356
|
+
--target=<value> path to config file in JB2 installation directory to write out to.
|
|
357
|
+
Creates ./config.json if nonexistent
|
|
358
358
|
|
|
359
359
|
DESCRIPTION
|
|
360
360
|
Add a track configuration directly from a JSON hunk to the JBrowse 2 configuration
|
|
@@ -366,7 +366,7 @@ EXAMPLES
|
|
|
366
366
|
```
|
|
367
367
|
|
|
368
368
|
_See code:
|
|
369
|
-
[src/commands/add-track-json.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
369
|
+
[src/commands/add-track-json.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/add-track-json.ts)_
|
|
370
370
|
|
|
371
371
|
## `jbrowse admin-server`
|
|
372
372
|
|
|
@@ -377,15 +377,16 @@ USAGE
|
|
|
377
377
|
$ jbrowse admin-server [-p <value>] [--root <value>] [--bodySizeLimit <value>] [-h]
|
|
378
378
|
|
|
379
379
|
FLAGS
|
|
380
|
-
-h, --help
|
|
381
|
-
-p, --port=<value>
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
380
|
+
-h, --help Show CLI help.
|
|
381
|
+
-p, --port=<value> Specifified port to start the server on;
|
|
382
|
+
Default is 9090.
|
|
383
|
+
--bodySizeLimit=<value> [default: 25mb] Size limit of the update message; may need to increase if config is
|
|
384
|
+
large.
|
|
385
|
+
Argument is passed to bytes library for parsing: https://www.npmjs.com/package/bytes.
|
|
386
|
+
--root=<value> path to the root of the JB2 installation.
|
|
387
|
+
Creates ./config.json if nonexistent. note that you can navigate to
|
|
388
|
+
?config=path/to/subconfig.json in the web browser and it will write to
|
|
389
|
+
rootDir/path/to/subconfig.json
|
|
389
390
|
|
|
390
391
|
DESCRIPTION
|
|
391
392
|
Start up a small admin server for JBrowse configuration
|
|
@@ -397,7 +398,7 @@ EXAMPLES
|
|
|
397
398
|
```
|
|
398
399
|
|
|
399
400
|
_See code:
|
|
400
|
-
[src/commands/admin-server.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
401
|
+
[src/commands/admin-server.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/admin-server.ts)_
|
|
401
402
|
|
|
402
403
|
## `jbrowse create LOCALPATH`
|
|
403
404
|
|
|
@@ -411,14 +412,14 @@ ARGUMENTS
|
|
|
411
412
|
LOCALPATH Location where JBrowse 2 will be installed
|
|
412
413
|
|
|
413
414
|
FLAGS
|
|
414
|
-
-f, --force
|
|
415
|
-
-h, --help
|
|
416
|
-
-l, --listVersions
|
|
417
|
-
-t, --tag=<value>
|
|
418
|
-
|
|
419
|
-
-u, --url=<value>
|
|
420
|
-
|
|
421
|
-
|
|
415
|
+
-f, --force Overwrites existing JBrowse 2 installation if present in path
|
|
416
|
+
-h, --help Show CLI help.
|
|
417
|
+
-l, --listVersions Lists out all versions of JBrowse 2
|
|
418
|
+
-t, --tag=<value> Version of JBrowse 2 to install. Format is v1.0.0.
|
|
419
|
+
Defaults to latest
|
|
420
|
+
-u, --url=<value> A direct URL to a JBrowse 2 release
|
|
421
|
+
--branch=<value> Download a development build from a named git branch
|
|
422
|
+
--nightly Download the latest development build from the main branch
|
|
422
423
|
|
|
423
424
|
DESCRIPTION
|
|
424
425
|
Downloads and installs the latest JBrowse 2 release
|
|
@@ -454,7 +455,7 @@ EXAMPLES
|
|
|
454
455
|
```
|
|
455
456
|
|
|
456
457
|
_See code:
|
|
457
|
-
[src/commands/create.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
458
|
+
[src/commands/create.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/create.ts)_
|
|
458
459
|
|
|
459
460
|
## `jbrowse help [COMMANDS]`
|
|
460
461
|
|
|
@@ -503,7 +504,7 @@ EXAMPLES
|
|
|
503
504
|
```
|
|
504
505
|
|
|
505
506
|
_See code:
|
|
506
|
-
[src/commands/remove-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
507
|
+
[src/commands/remove-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/remove-track.ts)_
|
|
507
508
|
|
|
508
509
|
## `jbrowse set-default-session`
|
|
509
510
|
|
|
@@ -523,10 +524,10 @@ FLAGS
|
|
|
523
524
|
-v, --view=<value> View type in config to be added as default session, i.e LinearGenomeView, CircularView,
|
|
524
525
|
DotplotView.
|
|
525
526
|
Must be provided if no default session file provided
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
527
|
+
--delete Delete any existing default session.
|
|
528
|
+
--out=<value> synonym for target
|
|
529
|
+
--target=<value> path to config file in JB2 installation directory to write out to
|
|
530
|
+
--viewId=<value> Identifier for the view. Will be generated on default
|
|
530
531
|
|
|
531
532
|
DESCRIPTION
|
|
532
533
|
Set a default session with views and tracks
|
|
@@ -542,7 +543,7 @@ EXAMPLES
|
|
|
542
543
|
```
|
|
543
544
|
|
|
544
545
|
_See code:
|
|
545
|
-
[src/commands/set-default-session.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
546
|
+
[src/commands/set-default-session.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/set-default-session.ts)_
|
|
546
547
|
|
|
547
548
|
## `jbrowse sort-gff FILE`
|
|
548
549
|
|
|
@@ -570,7 +571,7 @@ EXAMPLES
|
|
|
570
571
|
```
|
|
571
572
|
|
|
572
573
|
_See code:
|
|
573
|
-
[src/commands/sort-gff.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
574
|
+
[src/commands/sort-gff.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/sort-gff.ts)_
|
|
574
575
|
|
|
575
576
|
## `jbrowse text-index`
|
|
576
577
|
|
|
@@ -587,20 +588,20 @@ FLAGS
|
|
|
587
588
|
assembly in the config
|
|
588
589
|
-h, --help Show CLI help.
|
|
589
590
|
-q, --quiet Hide the progress bars
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
591
|
+
--attributes=<value> [default: Name,ID] Comma separated list of attributes to index
|
|
592
|
+
--dryrun Just print out tracks that will be indexed by the process, without doing any indexing
|
|
593
|
+
--exclude=<value> [default: CDS,exon] Adds gene type to list of excluded types
|
|
594
|
+
--file=<value>... File or files to index (can be used to create trix indexes for embedded component use cases
|
|
594
595
|
not using a config.json for example)
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
596
|
+
--fileId=<value>... Set the trackId used for the indexes generated with the --file argument
|
|
597
|
+
--force Overwrite previously existing indexes
|
|
598
|
+
--out=<value> Synonym for target
|
|
599
|
+
--perTrack If set, creates an index per track
|
|
600
|
+
--prefixSize=<value> Specify the prefix size for the ixx index. We attempt to automatically calculate this, but
|
|
600
601
|
you can manually specify this too. If many genes have similar gene IDs e.g. Z000000001,
|
|
601
602
|
Z000000002 the prefix size should be larger so that they get split into different bins
|
|
602
|
-
|
|
603
|
-
|
|
603
|
+
--target=<value> Path to config file in JB2 installation directory to read from.
|
|
604
|
+
--tracks=<value> Specific tracks to index, formatted as comma separated trackIds. If unspecified, indexes all
|
|
604
605
|
available tracks
|
|
605
606
|
|
|
606
607
|
DESCRIPTION
|
|
@@ -637,7 +638,7 @@ EXAMPLES
|
|
|
637
638
|
```
|
|
638
639
|
|
|
639
640
|
_See code:
|
|
640
|
-
[src/commands/text-index.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
641
|
+
[src/commands/text-index.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/text-index.ts)_
|
|
641
642
|
|
|
642
643
|
## `jbrowse upgrade [LOCALPATH]`
|
|
643
644
|
|
|
@@ -651,14 +652,14 @@ ARGUMENTS
|
|
|
651
652
|
LOCALPATH [default: .] Location where JBrowse 2 is installed
|
|
652
653
|
|
|
653
654
|
FLAGS
|
|
654
|
-
-h, --help
|
|
655
|
-
-l, --listVersions
|
|
656
|
-
-t, --tag=<value>
|
|
657
|
-
|
|
658
|
-
-u, --url=<value>
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
655
|
+
-h, --help Show CLI help.
|
|
656
|
+
-l, --listVersions Lists out all versions of JBrowse 2
|
|
657
|
+
-t, --tag=<value> Version of JBrowse 2 to install. Format is v1.0.0.
|
|
658
|
+
Defaults to latest
|
|
659
|
+
-u, --url=<value> A direct URL to a JBrowse 2 release
|
|
660
|
+
--branch=<value> Download a development build from a named git branch
|
|
661
|
+
--clean Removes old js,map,and LICENSE files in the installation
|
|
662
|
+
--nightly Download the latest development build from the main branch
|
|
662
663
|
|
|
663
664
|
DESCRIPTION
|
|
664
665
|
Upgrades JBrowse 2 to latest version
|
|
@@ -700,7 +701,7 @@ EXAMPLES
|
|
|
700
701
|
```
|
|
701
702
|
|
|
702
703
|
_See code:
|
|
703
|
-
[src/commands/upgrade.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
704
|
+
[src/commands/upgrade.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/upgrade.ts)_
|
|
704
705
|
|
|
705
706
|
<!-- commandsstop -->
|
|
706
707
|
|
|
@@ -27,6 +27,34 @@ function makeLocationProtocol(protocol) {
|
|
|
27
27
|
throw new Error(`invalid protocol ${protocol}`);
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
function fileOperation({ srcFilename, destFilename, mode, }) {
|
|
31
|
+
if (mode === 'copy') {
|
|
32
|
+
return copyFile(srcFilename, destFilename, COPYFILE_EXCL);
|
|
33
|
+
}
|
|
34
|
+
else if (mode === 'move') {
|
|
35
|
+
return rename(srcFilename, destFilename);
|
|
36
|
+
}
|
|
37
|
+
else if (mode === 'symlink') {
|
|
38
|
+
return symlink(path_1.default.resolve(srcFilename), destFilename);
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
// get path of destination, and remove file at that path if it exists and force
|
|
43
|
+
// is set
|
|
44
|
+
function destinationFn({ destinationDir, srcFilename, subDir, force, }) {
|
|
45
|
+
const dest = path_1.default.resolve(path_1.default.join(destinationDir, subDir, path_1.default.basename(srcFilename)));
|
|
46
|
+
if (force) {
|
|
47
|
+
try {
|
|
48
|
+
fs_1.default.unlinkSync(dest);
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
/* unconditionally unlinkSync, due to
|
|
52
|
+
* https://github.com/nodejs/node/issues/14025#issuecomment-754021370
|
|
53
|
+
* and https://github.com/GMOD/jbrowse-components/issues/2768 */
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return dest;
|
|
57
|
+
}
|
|
30
58
|
const isUrl = (loc) => loc?.match(/^https?:\/\//);
|
|
31
59
|
class AddTrack extends base_1.default {
|
|
32
60
|
async run() {
|
|
@@ -37,12 +65,12 @@ class AddTrack extends base_1.default {
|
|
|
37
65
|
const isDir = fs_1.default.lstatSync(output).isDirectory();
|
|
38
66
|
this.target = isDir ? `${output}/config.json` : output;
|
|
39
67
|
let { trackType, trackId, name, assemblyNames } = runFlags;
|
|
40
|
-
const
|
|
68
|
+
const configDir = path_1.default.dirname(this.target);
|
|
41
69
|
if (!argsTrack) {
|
|
42
70
|
this.error('No track provided. Example usage: jbrowse add-track yourfile.bam', { exit: 120 });
|
|
43
71
|
}
|
|
44
72
|
if (subDir) {
|
|
45
|
-
const dir = path_1.default.join(
|
|
73
|
+
const dir = path_1.default.join(configDir, subDir);
|
|
46
74
|
if (!fs_1.default.existsSync(dir)) {
|
|
47
75
|
fs_1.default.mkdirSync(dir);
|
|
48
76
|
}
|
|
@@ -124,7 +152,7 @@ class AddTrack extends base_1.default {
|
|
|
124
152
|
if (!configContents.tracks) {
|
|
125
153
|
configContents.tracks = [];
|
|
126
154
|
}
|
|
127
|
-
const idx = configContents.tracks.findIndex(
|
|
155
|
+
const idx = configContents.tracks.findIndex(c => c.trackId === trackId);
|
|
128
156
|
if (idx !== -1) {
|
|
129
157
|
this.debug(`Found existing trackId ${trackId} in configuration`);
|
|
130
158
|
if (force || overwrite) {
|
|
@@ -138,34 +166,20 @@ class AddTrack extends base_1.default {
|
|
|
138
166
|
else {
|
|
139
167
|
configContents.tracks.push(trackConfig);
|
|
140
168
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return dest;
|
|
156
|
-
};
|
|
157
|
-
const loadType = load || 'inPlace';
|
|
158
|
-
const callbacks = {
|
|
159
|
-
copy: (src, dest) => copyFile(src, dest, COPYFILE_EXCL),
|
|
160
|
-
move: (src, dest) => rename(src, dest),
|
|
161
|
-
symlink: (src, dest) => symlink(path_1.default.resolve(src), dest),
|
|
162
|
-
inPlace: () => {
|
|
163
|
-
/* do nothing */
|
|
164
|
-
},
|
|
165
|
-
};
|
|
166
|
-
await Promise.all(Object.values(this.guessFileNames({ location, index, bed1, bed2 }))
|
|
167
|
-
.filter(f => !!f)
|
|
168
|
-
.map(src => callbacks[loadType](src, destinationFn(configDirectory, src))));
|
|
169
|
+
if (load && load !== 'inPlace') {
|
|
170
|
+
await Promise.all(Object.values(this.guessFileNames({ location, index, bed1, bed2 }))
|
|
171
|
+
.filter(f => !!f)
|
|
172
|
+
.map(srcFilename => fileOperation({
|
|
173
|
+
mode: load,
|
|
174
|
+
srcFilename,
|
|
175
|
+
destFilename: destinationFn({
|
|
176
|
+
destinationDir: configDir,
|
|
177
|
+
srcFilename,
|
|
178
|
+
force,
|
|
179
|
+
subDir,
|
|
180
|
+
}),
|
|
181
|
+
})));
|
|
182
|
+
}
|
|
169
183
|
this.debug(`Writing configuration to file ${this.target}`);
|
|
170
184
|
await this.writeJsonFile(this.target, configContents);
|
|
171
185
|
this.log(`${idx !== -1 ? 'Overwrote' : 'Added'} track with name "${name}" and trackId "${trackId}" ${idx !== -1 ? 'in' : 'to'} ${this.target}`);
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "A command line tool for working with JBrowse 2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "a50b6f67cf8c8f3c65a7b8cd858de2fcca1f2909"
|
|
79
79
|
}
|