@jbrowse/cli 4.3.0 → 5.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +331 -57
  2. package/bin/run +1 -1
  3. package/bundle/index.js +457 -2574
  4. package/dist/base.js +0 -3
  5. package/dist/bin.js +2 -1
  6. package/dist/cliFetch.js +3 -0
  7. package/dist/commands/add-assembly/index.js +46 -19
  8. package/dist/commands/add-assembly/utils.js +204 -290
  9. package/dist/commands/add-connection.js +73 -79
  10. package/dist/commands/add-track-json.js +24 -12
  11. package/dist/commands/add-track-utils/adapter-utils.js +173 -288
  12. package/dist/commands/add-track-utils/file-operations.js +27 -11
  13. package/dist/commands/add-track-utils/multiwig.js +47 -0
  14. package/dist/commands/add-track-utils/track-config.js +68 -25
  15. package/dist/commands/add-track-utils/validators.js +36 -20
  16. package/dist/commands/add-track.js +178 -62
  17. package/dist/commands/admin-server/index.js +30 -49
  18. package/dist/commands/admin-server/utils.js +235 -125
  19. package/dist/commands/create.js +18 -34
  20. package/dist/commands/make-pif/cigar-utils.js +62 -19
  21. package/dist/commands/make-pif/index.js +98 -11
  22. package/dist/commands/make-pif/pif-generator.js +276 -42
  23. package/dist/commands/process-utils.js +13 -2
  24. package/dist/commands/remove-track.js +20 -13
  25. package/dist/commands/set-default-session.js +35 -31
  26. package/dist/commands/shared/config-operations.js +3 -10
  27. package/dist/commands/shared/sort-utils.js +67 -10
  28. package/dist/commands/shared/validators.js +38 -3
  29. package/dist/commands/sort-bed.js +2 -33
  30. package/dist/commands/sort-gff.js +2 -33
  31. package/dist/commands/text-index/adapter-utils.js +6 -23
  32. package/dist/commands/text-index/aggregate.js +40 -34
  33. package/dist/commands/text-index/command.js +35 -7
  34. package/dist/commands/text-index/config-utils.js +60 -83
  35. package/dist/commands/text-index/file-list.js +32 -18
  36. package/dist/commands/text-index/index.js +4 -4
  37. package/dist/commands/text-index/indexing-utils.js +49 -73
  38. package/dist/commands/text-index/per-track.js +44 -31
  39. package/dist/commands/text-index/validators.js +1 -1
  40. package/dist/commands/upgrade.js +20 -32
  41. package/dist/commands/validate/configManifest.generated.js +5394 -0
  42. package/dist/commands/validate/displayDefaultKeys.js +28 -0
  43. package/dist/commands/validate/index.js +97 -0
  44. package/dist/commands/validate/suggest.js +35 -0
  45. package/dist/commands/validate/types.js +6 -0
  46. package/dist/commands/validate/validateConfig.js +457 -0
  47. package/dist/index.js +99 -50
  48. package/dist/types/common.js +3 -27
  49. package/dist/utils.js +309 -128
  50. package/dist/version.js +1 -1
  51. package/package.json +8 -10
  52. package/dist/commands/make-pif/file-utils.js +0 -30
  53. package/dist/commands/track-utils.js +0 -74
  54. package/dist/util.js +0 -35
package/README.md CHANGED
@@ -54,12 +54,13 @@ COMMANDS
54
54
  create Downloads and installs the latest JBrowse 2 release
55
55
  add-assembly Add an assembly to a JBrowse 2 configuration
56
56
  add-track Add a track to a JBrowse 2 configuration
57
+ validate Check a configuration for errors, including ones JBrowse accepts silently
57
58
  text-index Make a text-indexing file for any given track(s)
58
59
  admin-server Start up a small admin server for JBrowse configuration
59
60
  upgrade Upgrades JBrowse 2 to latest version
60
61
  make-pif Creates pairwise indexed PAF (PIF), with bgzip and tabix
61
- sort-gff Helper utility to sort GFF files for tabix
62
- sort-bed Helper utility to sort BED files for tabix
62
+ sort-gff Sort a GFF/GTF for tabix: sort -k1,1 -k4,4n, header kept on top
63
+ sort-bed Sort a BED for tabix: sort -k1,1 -k2,2n, header kept on top
63
64
  add-connection Add a connection to a JBrowse 2 configuration
64
65
  add-track-json Add a track configuration directly from a JSON hunk
65
66
  remove-track Remove a track configuration from a JBrowse 2 configuration
@@ -100,6 +101,8 @@ Options:
100
101
  -t, --tag Version of JBrowse 2 to install. Format is v1.0.0.
101
102
  Defaults to latest
102
103
 
104
+ Examples:
105
+
103
106
  # Download latest release from github, and put in specific path
104
107
  $ jbrowse create /path/to/new/installation
105
108
 
@@ -127,19 +130,19 @@ Usage: jbrowse add-assembly <sequence> [options]
127
130
  Options:
128
131
  -t, --type type of sequence, by default inferred from sequence
129
132
  file
130
-
133
+
131
134
  indexedFasta - An index FASTA (e.g. .fa or .fasta)
132
135
  file; can optionally specify --faiLocation
133
-
136
+
134
137
  bgzipFasta - A block-gzipped and indexed FASTA
135
138
  (e.g. .fa.gz or .fasta.gz) file; can optionally
136
139
  specify --faiLocation and/or --gziLocation
137
-
140
+
138
141
  twoBit - A twoBit (e.g. .2bit) file
139
-
142
+
140
143
  chromSizes - A chromosome sizes (e.g. .chrom.sizes)
141
144
  file
142
-
145
+
143
146
  custom - Either a JSON file location or inline JSON
144
147
  that defines a custom sequence adapter; must
145
148
  provide --name if using inline JSON [choices:
@@ -191,13 +194,21 @@ Options:
191
194
  any file operations [choices: copy, symlink, move,
192
195
  inPlace]
193
196
 
194
- --skipCheck Don't check whether or not the sequence file or URL
195
- exists or if you are in a JBrowse directory
197
+ -f, --force Overwrite existing assembly and skip file existence
198
+ checks
196
199
 
197
- --overwrite Overwrite existing assembly if one with the same
198
- name exists
200
+ --config Any extra config settings to add to the assembly
199
201
 
200
- -f, --force Equivalent to `--skipCheck --overwrite`
202
+ Notes:
203
+
204
+ --config takes inline JSON (not a file path) that is merged into the generated
205
+ assembly config, so you can set fields the dedicated flags do not cover. A
206
+ "sequence" object in it is merged into the generated ReferenceSequenceTrack
207
+ rather than replacing it, e.g. --config
208
+ '{"sequence":{"formatAbout":{"hideUris":true}}}' hides file URIs in the
209
+ assembly's About dialog.
210
+
211
+ Examples:
201
212
 
202
213
  # add assembly to installation in current directory. assumes .fai file also exists, and copies GRCh38.fa and GRCh38.fa.fai to current directory
203
214
  $ jbrowse add-assembly GRCh38.fa --load copy
@@ -222,6 +233,9 @@ $ jbrowse add-assembly https://example.com/data/sample.2bit
222
233
 
223
234
  # add a bgzip indexed fasta inferred by fa.gz extension. assumes .fa.gz.gzi and .fa.gz.fai files also exists
224
235
  $ jbrowse add-assembly myfile.fa.gz --load copy
236
+
237
+ # hide file URIs in the assembly About dialog
238
+ $ jbrowse add-assembly GRCh38.fa --load copy --config '{"sequence":{"formatAbout":{"hideUris":true}}}'
225
239
  ```
226
240
 
227
241
 
@@ -233,10 +247,12 @@ Add a track to a JBrowse 2 configuration
233
247
  Usage: jbrowse add-track <track> [options]
234
248
 
235
249
  Options:
236
- -h, --help
250
+ -h, --help Show help
237
251
 
238
252
  -t, --trackType Type of track, by default inferred from track file
239
253
 
254
+ --adapterType Adapter type, by default inferred from track file
255
+
240
256
  -n, --name Name of the track. Will be defaulted to the trackId
241
257
  if none specified
242
258
 
@@ -245,13 +261,32 @@ Options:
245
261
  -d, --description Optional description of the track
246
262
 
247
263
  -a, --assemblyNames Assembly name or names for track as comma separated
248
- string
264
+ string. For pairwise synteny tracks the order is
265
+ query,target (reverse of minimap2/nucmer argument
266
+ order); for all-vs-all adapters
267
+ (AllVsAllPAFAdapter/AllVsAllIndexedPAFAdapter) list
268
+ every assembly the file covers, in any order
249
269
 
250
270
  --category Optional comma separated string of categories to
251
271
  group tracks
252
272
 
253
273
  --config Any extra config settings to add to a track
254
274
 
275
+ --color Track color: a plain CSS color or a jexl callback.
276
+ Merged into displayDefaults
277
+
278
+ --height Track display height in pixels. Merged into
279
+ displayDefaults
280
+
281
+ --displayDefaults Inline JSON merged into the track displayDefaults
282
+ (labels, mouseover, jexlFilters, etc.)
283
+
284
+ --multiwig Build a MultiQuantitativeTrack from several BigWigs
285
+ (in place of the positional track arg): a
286
+ comma-separated list of BigWig files/URLs, or a
287
+ .json file holding an array of BigWig locations or
288
+ subadapter objects, each with its own name/color
289
+
255
290
  --target Path to config file in JB2 installation to write
256
291
  out to
257
292
 
@@ -263,15 +298,11 @@ Options:
263
298
  --trackId trackId for the track, by default inferred from
264
299
  filename
265
300
 
266
- -l, --load How to manage the track (copy, symlink, move,
267
- inPlace)
301
+ -l, --load How to manage the track file relative to
302
+ config.json. Required for local files, omit for
303
+ URLs [choices: copy, symlink, move, inPlace]
268
304
 
269
- --skipCheck Skip check for whether file or URL exists
270
-
271
- --overwrite Overwrites existing track if it shares the same
272
- trackId
273
-
274
- -f, --force Equivalent to --skipCheck --overwrite
305
+ -f, --force Overwrite existing track and any existing files
275
306
 
276
307
  --protocol Force protocol to a specific value
277
308
 
@@ -279,6 +310,41 @@ Options:
279
310
 
280
311
  --bed2 Used only for mcscan anchors/simpleAnchors types
281
312
 
313
+ Notes:
314
+
315
+ --load controls how the data file is placed relative to config.json: copy, move,
316
+ or symlink it into the install directory, or inPlace to reference a pre-staged
317
+ local file where it already sits. Omit --load entirely for URLs. For a local
318
+ file the matching index is whichever conventional spelling is actually beside it
319
+ — <file>.bai/.crai/.tbi, a <file>.csi, or the reads.bai form Picard writes
320
+ beside reads.bam. A URL cannot be checked, so it gets <file>.bai/.tbi; pass
321
+ --indexFile for anything else.
322
+
323
+ --config takes inline JSON (not a file path) that is merged into the generated
324
+ track config, so you can set fields the dedicated flags do not cover, e.g.
325
+ --config '{"metadata":{"skipTextIndex":true}}' to exclude the track from jbrowse
326
+ text-index.
327
+
328
+ --color and --height set the two most common appearance settings without writing
329
+ JSON. Wrap the value in single quotes and use double quotes inside a jexl
330
+ callback so nothing needs escaping, e.g. --color
331
+ 'jexl:feature.strand==1?"blue":"red"'. --displayDefaults takes inline JSON for
332
+ any other appearance setting (labels, mouseover, jexlFilters).
333
+
334
+ --multiwig bundles several BigWigs into one MultiQuantitativeTrack, in place of
335
+ the positional track argument: pass a comma-separated list of BigWig files/URLs,
336
+ or a .json file with an array of BigWig locations or subadapter objects (each
337
+ carrying its own name/color/group). With --load, local list entries are copied
338
+ like any other track file.
339
+
340
+ For pairwise synteny adapters (PAF/Delta/Chain) --assemblyNames is query,target
341
+ — the reverse of the minimap2/nucmer input order. For the all-vs-all adapters
342
+ (AllVsAllPAFAdapter, AllVsAllIndexedPAFAdapter) it is instead the full list of
343
+ assemblies the file covers, in any order, since one all-vs-all file backs every
344
+ pair.
345
+
346
+ Examples:
347
+
282
348
  # copy /path/to/my.bam and /path/to/my.bam.bai to current directory and adds track to config.json
283
349
  $ jbrowse add-track /path/to/my.bam --load copy
284
350
 
@@ -296,6 +362,65 @@ $ jbrowse add-track https://mywebsite.com/my.bam
296
362
 
297
363
  # --load inPlace adds a track without doing file operations
298
364
  $ jbrowse add-track /url/relative/path.bam --load inPlace
365
+
366
+ # color a track by strand and set its height (no escaping: single-quote the value, double-quote inside the jexl)
367
+ $ jbrowse add-track genes.gff3.gz --load copy --color 'jexl:feature.strand==1?"blue":"red"' --height 200
368
+
369
+ # bundle several BigWigs into one MultiQuantitativeTrack (no positional track arg)
370
+ $ jbrowse add-track --multiwig a.bw,b.bw,c.bw --load copy --name "Coverage"
371
+
372
+ # ...or from a sources.json carrying per-row name/color for each BigWig
373
+ $ jbrowse add-track --multiwig sources.json --name "CATlas ATAC"
374
+ ```
375
+
376
+
377
+ ## jbrowse validate
378
+
379
+ ```
380
+ Check a JBrowse configuration for errors, including the ones JBrowse itself
381
+ accepts silently
382
+
383
+ Usage: jbrowse validate [config.json] [options]
384
+
385
+ Options:
386
+ --json Output the findings as JSON instead of text
387
+
388
+ -q, --quiet Only print errors, suppressing warnings and notes
389
+
390
+ -h, --help Show help
391
+
392
+ Notes:
393
+
394
+ A config key JBrowse does not recognize is ignored rather than reported, so a
395
+ misspelled slot leaves the track loading normally with the setting doing
396
+ nothing. That is what this command is mainly for.
397
+
398
+ Two levels are reported:
399
+
400
+ error JBrowse accepts it and silently does the wrong thing — an unknown
401
+ slot, a track naming an assembly the config never defines, a
402
+ defaultSession naming a trackId that does not exist, a duplicate
403
+ trackId. Exits 1.
404
+
405
+ warning JBrowse will complain by itself on load, or handles it — a type name
406
+ the core plugins do not register (expected if one of your plugins
407
+ registers it), or a legacy key a migration rewrites. Never fails
408
+ the run.
409
+
410
+ Types registered by plugins are not known to this command, so they come through
411
+ as warnings rather than errors.
412
+
413
+ Examples:
414
+
415
+ # check the config.json in the current directory
416
+ $ jbrowse validate
417
+
418
+ # check a specific config or saved session
419
+ $ jbrowse validate /path/to/config.json
420
+ $ jbrowse validate mysession.jbrowse
421
+
422
+ # machine-readable output
423
+ $ jbrowse validate config.json --json
299
424
  ```
300
425
 
301
426
 
@@ -314,7 +439,9 @@ Options:
314
439
  available tracks
315
440
 
316
441
  --excludeTracks Specific tracks to exclude from indexing, formatted
317
- as comma separated trackIds
442
+ as comma separated trackIds. To exclude a track
443
+ permanently, set metadata.skipTextIndex on it in
444
+ config.json instead (see Notes)
318
445
 
319
446
  --target Path to config file in JB2 installation directory
320
447
  to read from.
@@ -322,7 +449,7 @@ Options:
322
449
  --out Synonym for target
323
450
 
324
451
  --attributes Comma separated list of attributes to index
325
- [default: Name,ID]
452
+ [default: Name,ID,symbol]
326
453
 
327
454
  -a, --assemblies Specify the assembl(ies) to create an index for. If
328
455
  unspecified, creates an index for each assembly in
@@ -335,8 +462,13 @@ Options:
335
462
 
336
463
  --perTrack If set, creates an index per track [default: false]
337
464
 
338
- --exclude Adds gene type to list of excluded types [default:
339
- CDS,exon]
465
+ --exclude Comma separated list of feature types to exclude
466
+ from indexing [default: CDS,exon]
467
+
468
+ --include Comma separated list of feature types to index,
469
+ dropping every other type. Unset by default, which
470
+ indexes every type --exclude does not name. GFF3
471
+ only
340
472
 
341
473
  --prefixSize Specify the prefix size for the ixx index. We
342
474
  attempt to automatically calculate this, but you
@@ -355,6 +487,33 @@ Options:
355
487
  --dryrun Just print out tracks that will be indexed by the
356
488
  process, without doing any indexing
357
489
 
490
+ Notes:
491
+
492
+ Individual tracks in config.json can be permanently excluded from indexing by
493
+ setting "metadata": { "skipTextIndex": true } on the track. Such tracks are
494
+ skipped even when indexing all tracks or a whole assembly, so you do not have to
495
+ pass --excludeTracks on every run.
496
+
497
+ Only tracks with an indexable adapter type (Gff3Adapter, Gff3TabixAdapter,
498
+ GtfAdapter, GtfTabixAdapter, VcfAdapter, VcfTabixAdapter) are indexed; tracks
499
+ with other adapter types are skipped automatically.
500
+
501
+ GTF has no Name/ID attributes, so the default --attributes also match their GTF
502
+ spellings (gene_name, transcript_name, gene_id, transcript_id).
503
+
504
+ --exclude names types not to index; --include names the only types to index.
505
+ Reach for --include when the file draws from a vocabulary you do not control: an
506
+ NCBI RefSeq GFF3 uses 115 feature types, 80 of them leaf records with no name to
507
+ search (a match is labelled with a bare UUID, a cDNA_match with an MD5, every
508
+ biological_region with the string "biological region"), so a deny list leaks
509
+ whichever type is added next while the allow list — gene, pseudogene and the
510
+ transcript types — does not grow. Both may be given: --include admits, --exclude
511
+ then narrows. Either can also be set per track in config.json as
512
+ textSearching.indexingFeatureTypesToInclude / indexingFeatureTypesToExclude,
513
+ which takes precedence over the flag.
514
+
515
+ Examples:
516
+
358
517
  # indexes all tracks that it can find in the current directory's config.json
359
518
  $ jbrowse text-index
360
519
 
@@ -362,7 +521,7 @@ $ jbrowse text-index
362
521
  $ jbrowse text-index --tracks=track1,track2,track3
363
522
 
364
523
  # indexes all tracks except specific trackIds
365
- $ jbrowse text-index --exclude-tracks=track1,track2,track3
524
+ $ jbrowse text-index --excludeTracks=track1,track2,track3
366
525
 
367
526
  # indexes all tracks in a directory's config.json or in a specific config file
368
527
  $ jbrowse text-index --out /path/to/jb2/
@@ -383,7 +542,7 @@ Start up a small admin server for JBrowse configuration
383
542
  Usage: jbrowse admin-server [options]
384
543
 
385
544
  Options:
386
- -h, --help
545
+ -h, --help Show help
387
546
 
388
547
  -p, --port Specified port to start the server on (default:
389
548
  9090)
@@ -392,8 +551,26 @@ Options:
392
551
 
393
552
  --bodySizeLimit Size limit of the update message (default: 25mb)
394
553
 
554
+ Notes:
555
+
556
+ The admin-server lets a browser session write changes back to config.json on
557
+ disk, authorized by a one-time key printed in the startup URL. It is meant for
558
+ local configuration only: run it on a trusted machine and do not expose the port
559
+ to untrusted networks or the public internet.
560
+
561
+ Examples:
562
+
563
+ # start the admin server for the JBrowse install in the current directory
395
564
  $ jbrowse admin-server
565
+
566
+ # start on a specific port
396
567
  $ jbrowse admin-server -p 8888
568
+
569
+ # point at a specific JBrowse installation directory
570
+ $ jbrowse admin-server --root /path/to/jb2/
571
+
572
+ # raise the body size limit for very large config updates
573
+ $ jbrowse admin-server --bodySizeLimit 100mb
397
574
  ```
398
575
 
399
576
 
@@ -423,6 +600,8 @@ Options:
423
600
 
424
601
  -u, --url A direct URL to a JBrowse 2 release
425
602
 
603
+ Examples:
604
+
426
605
  # Upgrades current directory to latest jbrowse release
427
606
  $ jbrowse upgrade
428
607
 
@@ -451,28 +630,64 @@ creates pairwise indexed PAF (PIF), with bgzip and tabix
451
630
  Usage: jbrowse make-pif <file> [options]
452
631
 
453
632
  Options:
454
- -h, --help
633
+ -h, --help Show help
455
634
 
456
635
  --out Where to write the output file. will write
457
636
  ${file}.pif.gz and ${file}.pif.gz.tbi
458
637
 
459
638
  --csi Create a CSI index for the PIF file instead of TBI
460
639
 
461
- $ jbrowse make-pif input.paf # creates input.pif.gz in same directory
640
+ --coarse Minimum insertion/deletion length (bp) at which a
641
+ coarse-tier row is split into multiple pieces so
642
+ each row stays tight — 0 emits an unsplit coarse
643
+ tier. Defaults to 10000. The no-CIGAR coarse tier
644
+ (prefix T/Q) is emitted alongside the per-row CIGAR
645
+ fine tier by default so whole-genome synteny views
646
+ can auto-switch to it; pass --no-coarse to omit it.
647
+
648
+ --no-coarse Do not emit the coarse no-CIGAR tier; write only
649
+ the per-row CIGAR fine tier.
462
650
 
463
- $ jbrowse make-pif input.paf --out output.pif.gz # specify output file, creates output.pif.gz.tbi also
651
+ Notes:
652
+
653
+ Use --csi for assemblies containing sequences longer than ~512 Mb. The default
654
+ TBI index cannot address coordinates beyond 2^29 (~536 Mb), so a CSI index is
655
+ required for large chromosomes (e.g. some plant and amphibian genomes). Requires
656
+ sh, sort, bgzip, and tabix on the PATH.
657
+
658
+ Examples:
659
+
660
+ # creates input.pif.gz and input.pif.gz.tbi in the same directory
661
+ $ jbrowse make-pif input.paf
662
+
663
+ # specify the output file, also creates output.pif.gz.tbi
664
+ $ jbrowse make-pif input.paf --out output.pif.gz
665
+
666
+ # use a CSI index for assemblies with chromosomes longer than ~512 Mb
667
+ $ jbrowse make-pif input.paf --csi
668
+
669
+ # emit an unsplit coarse tier (alongside the fine tier)
670
+ $ jbrowse make-pif input.paf --coarse 0
671
+
672
+ # emit only the per-row CIGAR fine tier, skipping the coarse tier
673
+ $ jbrowse make-pif input.paf --no-coarse
464
674
  ```
465
675
 
466
676
 
467
677
  ## jbrowse sort-gff
468
678
 
469
679
  ```
470
- Helper utility to sort GFF files for tabix. Moves all lines starting with # to the top of the file, and sort by refname and start position using unix utilities sort and grep
680
+ Sort a GFF or GTF for tabix — the two share a refname/start column layout. It is
681
+ `sort -k1,1 -k4,4n` with LC_ALL=C and a tab separator, plus every line starting
682
+ with # kept at the top rather than sorted into the data. Takes a file, or the
683
+ same data on stdin
471
684
 
472
685
  Usage: jbrowse sort-gff [file] [options]
473
686
 
474
687
  Options:
475
- -h, --help
688
+ -h, --help Show help
689
+
690
+ Examples:
476
691
 
477
692
  # sort gff and pipe to bgzip
478
693
  $ jbrowse sort-gff input.gff | bgzip > sorted.gff.gz
@@ -480,18 +695,26 @@ $ tabix sorted.gff.gz
480
695
 
481
696
  # sort gff from stdin
482
697
  $ cat input.gff | jbrowse sort-gff | bgzip > sorted.gff.gz
698
+
699
+ # also works on GTF
700
+ $ jbrowse sort-gff input.gtf | bgzip > sorted.gtf.gz
701
+ $ tabix -p gff sorted.gtf.gz
483
702
  ```
484
703
 
485
704
 
486
705
  ## jbrowse sort-bed
487
706
 
488
707
  ```
489
- Helper utility to sort BED files for tabix. Moves all lines starting with # to the top of the file, and sort by refname and start position using unix utilities sort and grep
708
+ Sort a BED file for tabix. It is `sort -k1,1 -k2,2n` with LC_ALL=C and a tab
709
+ separator, plus every line starting with # kept at the top rather than sorted
710
+ into the data. Takes a file, or the same data on stdin
490
711
 
491
712
  Usage: jbrowse sort-bed [file] [options]
492
713
 
493
714
  Options:
494
- -h, --help
715
+ -h, --help Show help
716
+
717
+ Examples:
495
718
 
496
719
  # sort bed and pipe to bgzip
497
720
  $ jbrowse sort-bed input.bed | bgzip > sorted.bed.gz
@@ -509,7 +732,7 @@ Add a connection to a JBrowse 2 configuration
509
732
  Usage: jbrowse add-connection <connectionUrlOrPath> [options]
510
733
 
511
734
  Options:
512
- -h, --help
735
+ -h, --help Show help
513
736
 
514
737
  -t, --type Type of connection (e.g. JBrowse1Connection,
515
738
  UCSCTrackHubConnection, custom)
@@ -532,18 +755,27 @@ Options:
532
755
 
533
756
  --out Synonym for target
534
757
 
535
- --skipCheck Don't check whether the data directory URL exists
758
+ -f, --force Overwrite existing connection if one with the same
759
+ id exists
760
+
761
+ Examples:
762
+
763
+ # add a JBrowse 1 data directory connection (type inferred from the jbrowse/data path)
764
+ $ jbrowse add-connection https://mysite.com/jbrowse/data/ -a hg19
765
+
766
+ # force the JBrowse1Connection type for a non-standard data folder path
767
+ $ jbrowse add-connection https://mysite.com/jbrowse/custom_data_folder/ --type JBrowse1Connection -a hg38
768
+
769
+ # add a UCSC track hub (type inferred from the hub.txt filename)
770
+ $ jbrowse add-connection https://mysite.com/path/to/hub.txt
536
771
 
537
- --overwrite Overwrites any existing connections if same
538
- connection id
772
+ # force the UCSCTrackHubConnection type for a hub file not named hub.txt
773
+ $ jbrowse add-connection https://mysite.com/path/to/custom_hub_name.txt --type UCSCTrackHubConnection
539
774
 
540
- -f, --force Equivalent to --skipCheck --overwrite
775
+ # add a custom connection type with extra config
776
+ $ jbrowse add-connection https://mysite.com/path/to/custom --type custom --config '{"uri":{"url":"https://mysite.com/path/to/custom"}, "locationType": "UriLocation"}' -a hg19
541
777
 
542
- $ jbrowse add-connection http://mysite.com/jbrowse/data/ -a hg19
543
- $ jbrowse add-connection http://mysite.com/jbrowse/custom_data_folder/ --type JBrowse1Connection -a hg38
544
- $ jbrowse add-connection http://mysite.com/path/to/hub.txt
545
- $ jbrowse add-connection http://mysite.com/path/to/custom_hub_name.txt --type UCSCTrackHubConnection
546
- $ jbrowse add-connection http://mysite.com/path/to/custom --type custom --config '{"uri":{"url":"https://mysite.com/path/to/custom"}, "locationType": "UriLocation"}' -a hg19
778
+ # set an explicit id/name and write to a specific config file
547
779
  $ jbrowse add-connection https://mysite.com/path/to/hub.txt --connectionId newId --name newName --target /path/to/jb2/installation/config.json
548
780
  ```
549
781
 
@@ -551,12 +783,13 @@ $ jbrowse add-connection https://mysite.com/path/to/hub.txt --connectionId newId
551
783
  ## jbrowse add-track-json
552
784
 
553
785
  ```
554
- Add a track configuration directly from a JSON hunk to the JBrowse 2 configuration
786
+ Add a track configuration directly from a JSON hunk to the JBrowse 2
787
+ configuration
555
788
 
556
789
  Usage: jbrowse add-track-json <track> [options]
557
790
 
558
791
  Options:
559
- -h, --help
792
+ -h, --help Show help
560
793
 
561
794
  -u, --update Update the contents of an existing track, matched
562
795
  based on trackId
@@ -566,27 +799,56 @@ Options:
566
799
 
567
800
  --out Synonym for target
568
801
 
802
+ Notes:
803
+
804
+ The track argument is a JSON file, inline JSON, or "-" to read the JSON from
805
+ stdin, so a track config can be generated and piped straight in.
806
+
807
+ Examples:
808
+
809
+ # add a track from a JSON file
569
810
  $ jbrowse add-track-json track.json
811
+
812
+ # update an existing track (matched by trackId) with new JSON contents
570
813
  $ jbrowse add-track-json track.json --update
814
+
815
+ # pass the track config inline instead of via a file
816
+ $ jbrowse add-track-json '{"type":"FeatureTrack","trackId":"genes","assemblyNames":["hg38"],"adapter":{"type":"Gff3TabixAdapter","gffGzLocation":{"uri":"genes.gff.gz"}}}'
817
+
818
+ # pipe the track config in from another program
819
+ $ jq '.tracks[0]' other/config.json | jbrowse add-track-json -
820
+
821
+ # write to a config.json in a specific installation directory
822
+ $ jbrowse add-track-json track.json --out /path/to/jb2/
571
823
  ```
572
824
 
573
825
 
574
826
  ## jbrowse remove-track
575
827
 
576
828
  ```
577
- Remove a track configuration from a JBrowse 2 configuration. Be aware that this can cause crashes in saved sessions that refer to this track!
829
+ Remove a track configuration from a JBrowse 2 configuration. Be aware that this
830
+ can cause crashes in saved sessions that refer to this track!
578
831
 
579
832
  Usage: jbrowse remove-track <trackId> [options]
580
833
 
581
834
  Options:
582
- -h, --help
835
+ -h, --help Show help
583
836
 
584
837
  --target Path to config file in JB2 installation directory
585
838
  to write out to
586
839
 
587
840
  --out Synonym for target
588
841
 
589
- $ jbrowse remove-track trackId
842
+ Examples:
843
+
844
+ # remove a track from the config.json in the current directory
845
+ $ jbrowse remove-track my_track_id
846
+
847
+ # remove a track from a config.json in a specific installation directory
848
+ $ jbrowse remove-track my_track_id --out /path/to/jb2/
849
+
850
+ # remove a track from a specific config file
851
+ $ jbrowse remove-track my_track_id --target /path/to/jb2/config.json
590
852
  ```
591
853
 
592
854
 
@@ -595,15 +857,16 @@ $ jbrowse remove-track trackId
595
857
  ```
596
858
  Set a default session with views and tracks
597
859
 
598
- Usage: jbrowse add-track <track> [options]
860
+ Usage: jbrowse set-default-session [options]
599
861
 
600
862
  Options:
601
863
  -s, --session set path to a file containing session in json
602
- format (required, unless using
603
- delete/currentSession flags)
864
+ format, or "-" to read it from stdin (required,
865
+ unless using delete/currentSession flags)
604
866
 
605
- -n, --name Give a name for the default session [default: New
606
- Default Session]
867
+ -n, --name Give a name for the default session (overrides any
868
+ name in the session file; defaults to "New Default
869
+ Session")
607
870
 
608
871
  -c, --currentSession List out the current default session
609
872
 
@@ -616,14 +879,25 @@ Options:
616
879
 
617
880
  -h, --help Show help
618
881
 
882
+ Examples:
883
+
619
884
  # set default session for the config.json in your current directory
620
885
  $ jbrowse set-default-session --session /path/to/default/session.json
621
886
 
622
887
  # make session.json the defaultSession on the specified target config.json file
623
888
  $ jbrowse set-default-session --target /path/to/jb2/installation/config.json --session session.json
624
889
 
625
- # print current default session
626
- $ jbrowse set-default-session --currentSession # Prints out current default session
890
+ # override the name stored in the session file
891
+ $ jbrowse set-default-session --session session.json --name "My default view"
892
+
893
+ # pipe a session in from another program
894
+ $ jq '.defaultSession' other/config.json | jbrowse set-default-session --session -
895
+
896
+ # print the current default session
897
+ $ jbrowse set-default-session --currentSession
898
+
899
+ # remove the existing default session
900
+ $ jbrowse set-default-session --delete
627
901
  ```
628
902
 
629
903
 
package/bin/run CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
-
3
2
  import { main } from '../dist/index.js'
3
+
4
4
  main(process.argv.slice(2))