@jbrowse/cli 4.3.0 → 5.0.0-beta.2

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 (57) hide show
  1. package/README.md +413 -57
  2. package/bin/run +1 -1
  3. package/bundle/index.js +550 -2659
  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 +222 -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 +201 -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-density/density-generator.js +180 -0
  21. package/dist/commands/make-density/index.js +139 -0
  22. package/dist/commands/make-pif/index.js +128 -11
  23. package/dist/commands/make-pif/pif-generator.js +249 -43
  24. package/dist/commands/process-utils.js +13 -2
  25. package/dist/commands/remove-track.js +20 -13
  26. package/dist/commands/set-default-session.js +35 -31
  27. package/dist/commands/shared/config-operations.js +3 -10
  28. package/dist/commands/shared/density.js +12 -0
  29. package/dist/commands/shared/sort-utils.js +67 -10
  30. package/dist/commands/shared/validators.js +38 -3
  31. package/dist/commands/sort-bed.js +2 -33
  32. package/dist/commands/sort-gff.js +2 -33
  33. package/dist/commands/text-index/adapter-utils.js +6 -23
  34. package/dist/commands/text-index/aggregate.js +40 -34
  35. package/dist/commands/text-index/command.js +35 -7
  36. package/dist/commands/text-index/config-utils.js +60 -83
  37. package/dist/commands/text-index/file-list.js +32 -18
  38. package/dist/commands/text-index/index.js +4 -4
  39. package/dist/commands/text-index/indexing-utils.js +49 -73
  40. package/dist/commands/text-index/per-track.js +44 -31
  41. package/dist/commands/text-index/validators.js +1 -1
  42. package/dist/commands/upgrade.js +20 -32
  43. package/dist/commands/validate/configManifest.generated.js +5765 -0
  44. package/dist/commands/validate/displayDefaultKeys.js +28 -0
  45. package/dist/commands/validate/index.js +97 -0
  46. package/dist/commands/validate/suggest.js +35 -0
  47. package/dist/commands/validate/types.js +6 -0
  48. package/dist/commands/validate/validateConfig.js +522 -0
  49. package/dist/index.js +104 -50
  50. package/dist/types/common.js +3 -27
  51. package/dist/utils.js +309 -128
  52. package/dist/version.js +1 -1
  53. package/package.json +8 -10
  54. package/dist/commands/make-pif/cigar-utils.js +0 -24
  55. package/dist/commands/make-pif/file-utils.js +0 -30
  56. package/dist/commands/track-utils.js +0 -74
  57. package/dist/util.js +0 -35
package/README.md CHANGED
@@ -54,12 +54,14 @@ 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
+ make-density Counts feature starts per bin into a bigWig density sidecar, with bedGraphToBigWig
63
+ sort-gff Sort a GFF/GTF for tabix: sort -k1,1 -k4,4n, header kept on top
64
+ sort-bed Sort a BED for tabix: sort -k1,1 -k2,2n, header kept on top
63
65
  add-connection Add a connection to a JBrowse 2 configuration
64
66
  add-track-json Add a track configuration directly from a JSON hunk
65
67
  remove-track Remove a track configuration from a JBrowse 2 configuration
@@ -100,6 +102,8 @@ Options:
100
102
  -t, --tag Version of JBrowse 2 to install. Format is v1.0.0.
101
103
  Defaults to latest
102
104
 
105
+ Examples:
106
+
103
107
  # Download latest release from github, and put in specific path
104
108
  $ jbrowse create /path/to/new/installation
105
109
 
@@ -127,19 +131,19 @@ Usage: jbrowse add-assembly <sequence> [options]
127
131
  Options:
128
132
  -t, --type type of sequence, by default inferred from sequence
129
133
  file
130
-
134
+
131
135
  indexedFasta - An index FASTA (e.g. .fa or .fasta)
132
136
  file; can optionally specify --faiLocation
133
-
137
+
134
138
  bgzipFasta - A block-gzipped and indexed FASTA
135
139
  (e.g. .fa.gz or .fasta.gz) file; can optionally
136
140
  specify --faiLocation and/or --gziLocation
137
-
141
+
138
142
  twoBit - A twoBit (e.g. .2bit) file
139
-
143
+
140
144
  chromSizes - A chromosome sizes (e.g. .chrom.sizes)
141
145
  file
142
-
146
+
143
147
  custom - Either a JSON file location or inline JSON
144
148
  that defines a custom sequence adapter; must
145
149
  provide --name if using inline JSON [choices:
@@ -191,13 +195,21 @@ Options:
191
195
  any file operations [choices: copy, symlink, move,
192
196
  inPlace]
193
197
 
194
- --skipCheck Don't check whether or not the sequence file or URL
195
- exists or if you are in a JBrowse directory
198
+ -f, --force Overwrite existing assembly and skip file existence
199
+ checks
200
+
201
+ --config Any extra config settings to add to the assembly
202
+
203
+ Notes:
196
204
 
197
- --overwrite Overwrite existing assembly if one with the same
198
- name exists
205
+ --config takes inline JSON (not a file path) that is merged into the generated
206
+ assembly config, so you can set fields the dedicated flags do not cover. A
207
+ "sequence" object in it is merged into the generated ReferenceSequenceTrack
208
+ rather than replacing it, e.g. --config
209
+ '{"sequence":{"formatAbout":{"hideUris":true}}}' hides file URIs in the
210
+ assembly's About dialog.
199
211
 
200
- -f, --force Equivalent to `--skipCheck --overwrite`
212
+ Examples:
201
213
 
202
214
  # add assembly to installation in current directory. assumes .fai file also exists, and copies GRCh38.fa and GRCh38.fa.fai to current directory
203
215
  $ jbrowse add-assembly GRCh38.fa --load copy
@@ -222,6 +234,9 @@ $ jbrowse add-assembly https://example.com/data/sample.2bit
222
234
 
223
235
  # add a bgzip indexed fasta inferred by fa.gz extension. assumes .fa.gz.gzi and .fa.gz.fai files also exists
224
236
  $ jbrowse add-assembly myfile.fa.gz --load copy
237
+
238
+ # hide file URIs in the assembly About dialog
239
+ $ jbrowse add-assembly GRCh38.fa --load copy --config '{"sequence":{"formatAbout":{"hideUris":true}}}'
225
240
  ```
226
241
 
227
242
 
@@ -233,10 +248,12 @@ Add a track to a JBrowse 2 configuration
233
248
  Usage: jbrowse add-track <track> [options]
234
249
 
235
250
  Options:
236
- -h, --help
251
+ -h, --help Show help
237
252
 
238
253
  -t, --trackType Type of track, by default inferred from track file
239
254
 
255
+ --adapterType Adapter type, by default inferred from track file
256
+
240
257
  -n, --name Name of the track. Will be defaulted to the trackId
241
258
  if none specified
242
259
 
@@ -245,13 +262,32 @@ Options:
245
262
  -d, --description Optional description of the track
246
263
 
247
264
  -a, --assemblyNames Assembly name or names for track as comma separated
248
- string
265
+ string. For pairwise synteny tracks the order is
266
+ query,target (reverse of minimap2/nucmer argument
267
+ order); for all-vs-all adapters
268
+ (AllVsAllPAFAdapter/AllVsAllIndexedPAFAdapter) list
269
+ every assembly the file covers, in any order
249
270
 
250
271
  --category Optional comma separated string of categories to
251
272
  group tracks
252
273
 
253
274
  --config Any extra config settings to add to a track
254
275
 
276
+ --color Track color: a plain CSS color or a jexl callback.
277
+ Merged into displayDefaults
278
+
279
+ --height Track display height in pixels. Merged into
280
+ displayDefaults
281
+
282
+ --displayDefaults Inline JSON merged into the track displayDefaults
283
+ (labels, mouseover, jexlFilters, etc.)
284
+
285
+ --multiwig Build a MultiQuantitativeTrack from several BigWigs
286
+ (in place of the positional track arg): a
287
+ comma-separated list of BigWig files/URLs, or a
288
+ .json file holding an array of BigWig locations or
289
+ subadapter objects, each with its own name/color
290
+
255
291
  --target Path to config file in JB2 installation to write
256
292
  out to
257
293
 
@@ -263,15 +299,11 @@ Options:
263
299
  --trackId trackId for the track, by default inferred from
264
300
  filename
265
301
 
266
- -l, --load How to manage the track (copy, symlink, move,
267
- inPlace)
302
+ -l, --load How to manage the track file relative to
303
+ config.json. Required for local files, omit for
304
+ URLs [choices: copy, symlink, move, inPlace]
268
305
 
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
306
+ -f, --force Overwrite existing track and any existing files
275
307
 
276
308
  --protocol Force protocol to a specific value
277
309
 
@@ -279,6 +311,54 @@ Options:
279
311
 
280
312
  --bed2 Used only for mcscan anchors/simpleAnchors types
281
313
 
314
+ --density Path or URL of a features-per-bin bigWig (jbrowse
315
+ make-density) to attach as the adapter's
316
+ densityAdapter. A local <file>.density.bw beside
317
+ the track file is attached without this flag
318
+
319
+ Notes:
320
+
321
+ --load controls how the data file is placed relative to config.json: copy, move,
322
+ or symlink it into the install directory, or inPlace to reference a pre-staged
323
+ local file where it already sits. Omit --load entirely for URLs. For a local
324
+ file the matching index is whichever conventional spelling is actually beside it
325
+ — <file>.bai/.crai/.tbi, a <file>.csi, or the reads.bai form Picard writes
326
+ beside reads.bam. A URL cannot be checked, so it gets <file>.bai/.tbi; pass
327
+ --indexFile for anything else.
328
+
329
+ --config takes inline JSON (not a file path) that is merged into the generated
330
+ track config, so you can set fields the dedicated flags do not cover, e.g.
331
+ --config '{"metadata":{"skipTextIndex":true}}' to exclude the track from jbrowse
332
+ text-index.
333
+
334
+ --color and --height set the two most common appearance settings without writing
335
+ JSON. Wrap the value in single quotes and use double quotes inside a jexl
336
+ callback so nothing needs escaping, e.g. --color
337
+ 'jexl:feature.strand==1?"blue":"red"'. --displayDefaults takes inline JSON for
338
+ any other appearance setting (labels, mouseover, jexlFilters).
339
+
340
+ --multiwig bundles several BigWigs into one MultiQuantitativeTrack, in place of
341
+ the positional track argument: pass a comma-separated list of BigWig files/URLs,
342
+ or a .json file with an array of BigWig locations or subadapter objects (each
343
+ carrying its own name/color/group). With --load, local list entries are copied
344
+ like any other track file.
345
+
346
+ --density attaches a features-per-bin bigWig (jbrowse make-density) as the
347
+ adapter's densityAdapter, the band a display draws where the region is too large
348
+ to fetch features. A local <file>.density.bw beside the track file is attached
349
+ without the flag; a URL cannot be probed, so a remote sidecar needs it. The
350
+ adapters carrying the slot are BamAdapter, CramAdapter, HtsgetBamAdapter,
351
+ Gff3TabixAdapter, GtfTabixAdapter, BedTabixAdapter, BigBedAdapter,
352
+ VcfTabixAdapter and SplitVcfTabixAdapter.
353
+
354
+ For pairwise synteny adapters (PAF/Delta/Chain) --assemblyNames is query,target
355
+ — the reverse of the minimap2/nucmer input order. For the all-vs-all adapters
356
+ (AllVsAllPAFAdapter, AllVsAllIndexedPAFAdapter) it is instead the full list of
357
+ assemblies the file covers, in any order, since one all-vs-all file backs every
358
+ pair.
359
+
360
+ Examples:
361
+
282
362
  # copy /path/to/my.bam and /path/to/my.bam.bai to current directory and adds track to config.json
283
363
  $ jbrowse add-track /path/to/my.bam --load copy
284
364
 
@@ -296,6 +376,68 @@ $ jbrowse add-track https://mywebsite.com/my.bam
296
376
 
297
377
  # --load inPlace adds a track without doing file operations
298
378
  $ jbrowse add-track /url/relative/path.bam --load inPlace
379
+
380
+ # color a track by strand and set its height (no escaping: single-quote the value, double-quote inside the jexl)
381
+ $ jbrowse add-track genes.gff3.gz --load copy --color 'jexl:feature.strand==1?"blue":"red"' --height 200
382
+
383
+ # bundle several BigWigs into one MultiQuantitativeTrack (no positional track arg)
384
+ $ jbrowse add-track --multiwig a.bw,b.bw,c.bw --load copy --name "Coverage"
385
+
386
+ # ...or from a sources.json carrying per-row name/color for each BigWig
387
+ $ jbrowse add-track --multiwig sources.json --name "CATlas ATAC"
388
+
389
+ # attach a remote density sidecar (a local genes.gff3.density.bw needs no flag)
390
+ $ jbrowse add-track https://mywebsite.com/genes.gff3.gz --density https://mywebsite.com/genes.gff3.density.bw
391
+ ```
392
+
393
+
394
+ ## jbrowse validate
395
+
396
+ ```
397
+ Check a JBrowse configuration for errors, including the ones JBrowse itself
398
+ accepts silently
399
+
400
+ Usage: jbrowse validate [config.json] [options]
401
+
402
+ Options:
403
+ --json Output the findings as JSON instead of text
404
+
405
+ -q, --quiet Only print errors, suppressing warnings and notes
406
+
407
+ -h, --help Show help
408
+
409
+ Notes:
410
+
411
+ A config key JBrowse does not recognize is ignored rather than reported, so a
412
+ misspelled slot leaves the track loading normally with the setting doing
413
+ nothing. That is what this command is mainly for.
414
+
415
+ Two levels are reported:
416
+
417
+ error JBrowse accepts it and silently does the wrong thing — an unknown
418
+ slot, a key a defaultSession view or display does not declare, a
419
+ track naming an assembly the config never defines, a defaultSession
420
+ naming a trackId that does not exist, a duplicate trackId. Exits 1.
421
+
422
+ warning JBrowse will complain by itself on load, or handles it — a type name
423
+ the core plugins do not register (expected if one of your plugins
424
+ registers it), or a legacy key a migration rewrites, such as a view
425
+ nesting its settings under "init". Never fails the run.
426
+
427
+ Types registered by plugins are not known to this command, so they come through
428
+ as warnings rather than errors.
429
+
430
+ Examples:
431
+
432
+ # check the config.json in the current directory
433
+ $ jbrowse validate
434
+
435
+ # check a specific config or saved session
436
+ $ jbrowse validate /path/to/config.json
437
+ $ jbrowse validate mysession.jbrowse
438
+
439
+ # machine-readable output
440
+ $ jbrowse validate config.json --json
299
441
  ```
300
442
 
301
443
 
@@ -314,7 +456,9 @@ Options:
314
456
  available tracks
315
457
 
316
458
  --excludeTracks Specific tracks to exclude from indexing, formatted
317
- as comma separated trackIds
459
+ as comma separated trackIds. To exclude a track
460
+ permanently, set metadata.skipTextIndex on it in
461
+ config.json instead (see Notes)
318
462
 
319
463
  --target Path to config file in JB2 installation directory
320
464
  to read from.
@@ -322,7 +466,7 @@ Options:
322
466
  --out Synonym for target
323
467
 
324
468
  --attributes Comma separated list of attributes to index
325
- [default: Name,ID]
469
+ [default: Name,ID,symbol]
326
470
 
327
471
  -a, --assemblies Specify the assembl(ies) to create an index for. If
328
472
  unspecified, creates an index for each assembly in
@@ -335,8 +479,13 @@ Options:
335
479
 
336
480
  --perTrack If set, creates an index per track [default: false]
337
481
 
338
- --exclude Adds gene type to list of excluded types [default:
339
- CDS,exon]
482
+ --exclude Comma separated list of feature types to exclude
483
+ from indexing [default: CDS,exon]
484
+
485
+ --include Comma separated list of feature types to index,
486
+ dropping every other type. Unset by default, which
487
+ indexes every type --exclude does not name. GFF3
488
+ only
340
489
 
341
490
  --prefixSize Specify the prefix size for the ixx index. We
342
491
  attempt to automatically calculate this, but you
@@ -355,6 +504,33 @@ Options:
355
504
  --dryrun Just print out tracks that will be indexed by the
356
505
  process, without doing any indexing
357
506
 
507
+ Notes:
508
+
509
+ Individual tracks in config.json can be permanently excluded from indexing by
510
+ setting "metadata": { "skipTextIndex": true } on the track. Such tracks are
511
+ skipped even when indexing all tracks or a whole assembly, so you do not have to
512
+ pass --excludeTracks on every run.
513
+
514
+ Only tracks with an indexable adapter type (Gff3Adapter, Gff3TabixAdapter,
515
+ GtfAdapter, GtfTabixAdapter, VcfAdapter, VcfTabixAdapter) are indexed; tracks
516
+ with other adapter types are skipped automatically.
517
+
518
+ GTF has no Name/ID attributes, so the default --attributes also match their GTF
519
+ spellings (gene_name, transcript_name, gene_id, transcript_id).
520
+
521
+ --exclude names types not to index; --include names the only types to index.
522
+ Reach for --include when the file draws from a vocabulary you do not control: an
523
+ NCBI RefSeq GFF3 uses 115 feature types, 80 of them leaf records with no name to
524
+ search (a match is labelled with a bare UUID, a cDNA_match with an MD5, every
525
+ biological_region with the string "biological region"), so a deny list leaks
526
+ whichever type is added next while the allow list — gene, pseudogene and the
527
+ transcript types — does not grow. Both may be given: --include admits, --exclude
528
+ then narrows. Either can also be set per track in config.json as
529
+ textSearching.indexingFeatureTypesToInclude / indexingFeatureTypesToExclude,
530
+ which takes precedence over the flag.
531
+
532
+ Examples:
533
+
358
534
  # indexes all tracks that it can find in the current directory's config.json
359
535
  $ jbrowse text-index
360
536
 
@@ -362,7 +538,7 @@ $ jbrowse text-index
362
538
  $ jbrowse text-index --tracks=track1,track2,track3
363
539
 
364
540
  # indexes all tracks except specific trackIds
365
- $ jbrowse text-index --exclude-tracks=track1,track2,track3
541
+ $ jbrowse text-index --excludeTracks=track1,track2,track3
366
542
 
367
543
  # indexes all tracks in a directory's config.json or in a specific config file
368
544
  $ jbrowse text-index --out /path/to/jb2/
@@ -383,7 +559,7 @@ Start up a small admin server for JBrowse configuration
383
559
  Usage: jbrowse admin-server [options]
384
560
 
385
561
  Options:
386
- -h, --help
562
+ -h, --help Show help
387
563
 
388
564
  -p, --port Specified port to start the server on (default:
389
565
  9090)
@@ -392,8 +568,26 @@ Options:
392
568
 
393
569
  --bodySizeLimit Size limit of the update message (default: 25mb)
394
570
 
571
+ Notes:
572
+
573
+ The admin-server lets a browser session write changes back to config.json on
574
+ disk, authorized by a one-time key printed in the startup URL. It is meant for
575
+ local configuration only: run it on a trusted machine and do not expose the port
576
+ to untrusted networks or the public internet.
577
+
578
+ Examples:
579
+
580
+ # start the admin server for the JBrowse install in the current directory
395
581
  $ jbrowse admin-server
582
+
583
+ # start on a specific port
396
584
  $ jbrowse admin-server -p 8888
585
+
586
+ # point at a specific JBrowse installation directory
587
+ $ jbrowse admin-server --root /path/to/jb2/
588
+
589
+ # raise the body size limit for very large config updates
590
+ $ jbrowse admin-server --bodySizeLimit 100mb
397
591
  ```
398
592
 
399
593
 
@@ -423,6 +617,8 @@ Options:
423
617
 
424
618
  -u, --url A direct URL to a JBrowse 2 release
425
619
 
620
+ Examples:
621
+
426
622
  # Upgrades current directory to latest jbrowse release
427
623
  $ jbrowse upgrade
428
624
 
@@ -451,28 +647,129 @@ creates pairwise indexed PAF (PIF), with bgzip and tabix
451
647
  Usage: jbrowse make-pif <file> [options]
452
648
 
453
649
  Options:
454
- -h, --help
650
+ -h, --help Show help
455
651
 
456
652
  --out Where to write the output file. will write
457
653
  ${file}.pif.gz and ${file}.pif.gz.tbi
458
654
 
459
655
  --csi Create a CSI index for the PIF file instead of TBI
460
656
 
461
- $ jbrowse make-pif input.paf # creates input.pif.gz in same directory
657
+ --coarse Accuracy bound (bp) of the coarse tier. A coarse
658
+ row replaces its CIGAR with a coarse CIGAR (cr:Z:)
659
+ that keeps every indel longer than half this length
660
+ and folds the rest into runs, each run staying
661
+ within this many bp of the real alignment. Defaults
662
+ to 10000. The coarse tier (prefix T/Q) is emitted
663
+ alongside the per-row CIGAR fine tier by default so
664
+ whole-genome synteny views can auto-switch to it;
665
+ pass --no-coarse to omit it.
462
666
 
463
- $ jbrowse make-pif input.paf --out output.pif.gz # specify output file, creates output.pif.gz.tbi also
667
+ --no-coarse Do not emit the coarse tier; write only the per-row
668
+ CIGAR fine tier.
669
+
670
+ --threads Compression threads for bgzip. Defaults to 4. Raise
671
+ it on a machine with cores to spare, or set 1 to
672
+ leave the rest of the machine alone.
673
+
674
+ Notes:
675
+
676
+ Use --csi for assemblies containing sequences longer than ~512 Mb. The default
677
+ TBI index cannot address coordinates beyond 2^29 (~536 Mb), so a CSI index is
678
+ required for large chromosomes (e.g. some plant and amphibian genomes). Requires
679
+ sh, sort, bgzip, and tabix on the PATH.
680
+
681
+ Examples:
682
+
683
+ # creates input.pif.gz and input.pif.gz.tbi in the same directory
684
+ $ jbrowse make-pif input.paf
685
+
686
+ # specify the output file, also creates output.pif.gz.tbi
687
+ $ jbrowse make-pif input.paf --out output.pif.gz
688
+
689
+ # use a CSI index for assemblies with chromosomes longer than ~512 Mb
690
+ $ jbrowse make-pif input.paf --csi
691
+
692
+ # a looser coarse tier: runs within 50kb of the alignment, indels over 25kb kept
693
+ $ jbrowse make-pif input.paf --coarse 50000
694
+
695
+ # emit only the per-row CIGAR fine tier, skipping the coarse tier
696
+ $ jbrowse make-pif input.paf --no-coarse
697
+
698
+ # give bgzip more (or fewer) compression threads than the default 4
699
+ $ jbrowse make-pif input.paf --threads 8
700
+ ```
701
+
702
+
703
+ ## jbrowse make-density
704
+
705
+ ```
706
+ Counts feature starts per bin into a bigWig, the density sidecar a track draws
707
+ where the region is too large to fetch its features
708
+
709
+ Usage: jbrowse make-density <file> [options]
710
+
711
+ Options:
712
+ -h, --help Show help
713
+
714
+ --bin Width of each bin, in bp [default: 1000]
715
+
716
+ --chrom-sizes Two-column reference name and length table for the
717
+ assembly the file is on
718
+
719
+ --assembly FASTA of the assembly the file is on; its .fai
720
+ supplies the reference lengths, in place of
721
+ --chrom-sizes
722
+
723
+ --out Where to write the bigWig. Defaults to
724
+ <file>.density.bw beside the input, which is where
725
+ add-track looks for it
726
+
727
+ Notes:
728
+
729
+ The sidecar is attached to a track through its adapter's densityAdapter slot,
730
+ which BamAdapter, CramAdapter, HtsgetBamAdapter, Gff3TabixAdapter,
731
+ GtfTabixAdapter, BedTabixAdapter, BigBedAdapter, VcfTabixAdapter and
732
+ SplitVcfTabixAdapter declare. add-track attaches it on its own when the default
733
+ <file>.density.bw sits beside the track file, so building it before adding the
734
+ track is all it takes; --density attaches one by path or URL.
735
+
736
+ GFF3 counts only top-level features — a line whose attributes carry no Parent= —
737
+ so a gene is one count rather than one per exon. GTF, BED and VCF have no parent
738
+ link to follow, so every record counts.
739
+
740
+ BAM and CRAM are out of scope: read depth is not feature density, and the tools
741
+ that compute it already write bigWig. Point add-track --density at what they
742
+ produce.
743
+
744
+ Requires bedGraphToBigWig (UCSC) on the PATH.
745
+
746
+ Examples:
747
+
748
+ # writes genes.gff3.density.bw beside the input, in 1kb bins
749
+ $ jbrowse make-density genes.gff3.gz --chrom-sizes hg38.chrom.sizes
750
+
751
+ # take the reference lengths from the assembly FASTA index instead
752
+ $ jbrowse make-density variants.vcf.gz --assembly hg38.fa
753
+
754
+ # coarser bins, and a name of your own
755
+ $ jbrowse make-density genes.gff3.gz --assembly hg38.fa --bin 10000 --out genes.10kb.bw
464
756
  ```
465
757
 
466
758
 
467
759
  ## jbrowse sort-gff
468
760
 
469
761
  ```
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
762
+ Sort a GFF or GTF for tabix — the two share a refname/start column layout. It is
763
+ `sort -k1,1 -k4,4n` with LC_ALL=C and a tab separator, plus every line starting
764
+ with # kept at the top rather than sorted into the data. Takes a file, or the
765
+ same data on stdin
471
766
 
472
767
  Usage: jbrowse sort-gff [file] [options]
473
768
 
474
769
  Options:
475
- -h, --help
770
+ -h, --help Show help
771
+
772
+ Examples:
476
773
 
477
774
  # sort gff and pipe to bgzip
478
775
  $ jbrowse sort-gff input.gff | bgzip > sorted.gff.gz
@@ -480,18 +777,26 @@ $ tabix sorted.gff.gz
480
777
 
481
778
  # sort gff from stdin
482
779
  $ cat input.gff | jbrowse sort-gff | bgzip > sorted.gff.gz
780
+
781
+ # also works on GTF
782
+ $ jbrowse sort-gff input.gtf | bgzip > sorted.gtf.gz
783
+ $ tabix -p gff sorted.gtf.gz
483
784
  ```
484
785
 
485
786
 
486
787
  ## jbrowse sort-bed
487
788
 
488
789
  ```
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
790
+ Sort a BED file for tabix. It is `sort -k1,1 -k2,2n` with LC_ALL=C and a tab
791
+ separator, plus every line starting with # kept at the top rather than sorted
792
+ into the data. Takes a file, or the same data on stdin
490
793
 
491
794
  Usage: jbrowse sort-bed [file] [options]
492
795
 
493
796
  Options:
494
- -h, --help
797
+ -h, --help Show help
798
+
799
+ Examples:
495
800
 
496
801
  # sort bed and pipe to bgzip
497
802
  $ jbrowse sort-bed input.bed | bgzip > sorted.bed.gz
@@ -509,7 +814,7 @@ Add a connection to a JBrowse 2 configuration
509
814
  Usage: jbrowse add-connection <connectionUrlOrPath> [options]
510
815
 
511
816
  Options:
512
- -h, --help
817
+ -h, --help Show help
513
818
 
514
819
  -t, --type Type of connection (e.g. JBrowse1Connection,
515
820
  UCSCTrackHubConnection, custom)
@@ -532,18 +837,27 @@ Options:
532
837
 
533
838
  --out Synonym for target
534
839
 
535
- --skipCheck Don't check whether the data directory URL exists
840
+ -f, --force Overwrite existing connection if one with the same
841
+ id exists
536
842
 
537
- --overwrite Overwrites any existing connections if same
538
- connection id
843
+ Examples:
539
844
 
540
- -f, --force Equivalent to --skipCheck --overwrite
845
+ # add a JBrowse 1 data directory connection (type inferred from the jbrowse/data path)
846
+ $ jbrowse add-connection https://mysite.com/jbrowse/data/ -a hg19
541
847
 
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
848
+ # force the JBrowse1Connection type for a non-standard data folder path
849
+ $ jbrowse add-connection https://mysite.com/jbrowse/custom_data_folder/ --type JBrowse1Connection -a hg38
850
+
851
+ # add a UCSC track hub (type inferred from the hub.txt filename)
852
+ $ jbrowse add-connection https://mysite.com/path/to/hub.txt
853
+
854
+ # force the UCSCTrackHubConnection type for a hub file not named hub.txt
855
+ $ jbrowse add-connection https://mysite.com/path/to/custom_hub_name.txt --type UCSCTrackHubConnection
856
+
857
+ # add a custom connection type with extra config
858
+ $ jbrowse add-connection https://mysite.com/path/to/custom --type custom --config '{"uri":{"url":"https://mysite.com/path/to/custom"}, "locationType": "UriLocation"}' -a hg19
859
+
860
+ # set an explicit id/name and write to a specific config file
547
861
  $ jbrowse add-connection https://mysite.com/path/to/hub.txt --connectionId newId --name newName --target /path/to/jb2/installation/config.json
548
862
  ```
549
863
 
@@ -551,12 +865,13 @@ $ jbrowse add-connection https://mysite.com/path/to/hub.txt --connectionId newId
551
865
  ## jbrowse add-track-json
552
866
 
553
867
  ```
554
- Add a track configuration directly from a JSON hunk to the JBrowse 2 configuration
868
+ Add a track configuration directly from a JSON hunk to the JBrowse 2
869
+ configuration
555
870
 
556
871
  Usage: jbrowse add-track-json <track> [options]
557
872
 
558
873
  Options:
559
- -h, --help
874
+ -h, --help Show help
560
875
 
561
876
  -u, --update Update the contents of an existing track, matched
562
877
  based on trackId
@@ -566,27 +881,56 @@ Options:
566
881
 
567
882
  --out Synonym for target
568
883
 
884
+ Notes:
885
+
886
+ The track argument is a JSON file, inline JSON, or "-" to read the JSON from
887
+ stdin, so a track config can be generated and piped straight in.
888
+
889
+ Examples:
890
+
891
+ # add a track from a JSON file
569
892
  $ jbrowse add-track-json track.json
893
+
894
+ # update an existing track (matched by trackId) with new JSON contents
570
895
  $ jbrowse add-track-json track.json --update
896
+
897
+ # pass the track config inline instead of via a file
898
+ $ jbrowse add-track-json '{"type":"FeatureTrack","trackId":"genes","assemblyNames":["hg38"],"adapter":{"type":"Gff3TabixAdapter","gffGzLocation":{"uri":"genes.gff.gz"}}}'
899
+
900
+ # pipe the track config in from another program
901
+ $ jq '.tracks[0]' other/config.json | jbrowse add-track-json -
902
+
903
+ # write to a config.json in a specific installation directory
904
+ $ jbrowse add-track-json track.json --out /path/to/jb2/
571
905
  ```
572
906
 
573
907
 
574
908
  ## jbrowse remove-track
575
909
 
576
910
  ```
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!
911
+ Remove a track configuration from a JBrowse 2 configuration. Be aware that this
912
+ can cause crashes in saved sessions that refer to this track!
578
913
 
579
914
  Usage: jbrowse remove-track <trackId> [options]
580
915
 
581
916
  Options:
582
- -h, --help
917
+ -h, --help Show help
583
918
 
584
919
  --target Path to config file in JB2 installation directory
585
920
  to write out to
586
921
 
587
922
  --out Synonym for target
588
923
 
589
- $ jbrowse remove-track trackId
924
+ Examples:
925
+
926
+ # remove a track from the config.json in the current directory
927
+ $ jbrowse remove-track my_track_id
928
+
929
+ # remove a track from a config.json in a specific installation directory
930
+ $ jbrowse remove-track my_track_id --out /path/to/jb2/
931
+
932
+ # remove a track from a specific config file
933
+ $ jbrowse remove-track my_track_id --target /path/to/jb2/config.json
590
934
  ```
591
935
 
592
936
 
@@ -595,15 +939,16 @@ $ jbrowse remove-track trackId
595
939
  ```
596
940
  Set a default session with views and tracks
597
941
 
598
- Usage: jbrowse add-track <track> [options]
942
+ Usage: jbrowse set-default-session [options]
599
943
 
600
944
  Options:
601
945
  -s, --session set path to a file containing session in json
602
- format (required, unless using
603
- delete/currentSession flags)
946
+ format, or "-" to read it from stdin (required,
947
+ unless using delete/currentSession flags)
604
948
 
605
- -n, --name Give a name for the default session [default: New
606
- Default Session]
949
+ -n, --name Give a name for the default session (overrides any
950
+ name in the session file; defaults to "New Default
951
+ Session")
607
952
 
608
953
  -c, --currentSession List out the current default session
609
954
 
@@ -616,14 +961,25 @@ Options:
616
961
 
617
962
  -h, --help Show help
618
963
 
964
+ Examples:
965
+
619
966
  # set default session for the config.json in your current directory
620
967
  $ jbrowse set-default-session --session /path/to/default/session.json
621
968
 
622
969
  # make session.json the defaultSession on the specified target config.json file
623
970
  $ jbrowse set-default-session --target /path/to/jb2/installation/config.json --session session.json
624
971
 
625
- # print current default session
626
- $ jbrowse set-default-session --currentSession # Prints out current default session
972
+ # override the name stored in the session file
973
+ $ jbrowse set-default-session --session session.json --name "My default view"
974
+
975
+ # pipe a session in from another program
976
+ $ jq '.defaultSession' other/config.json | jbrowse set-default-session --session -
977
+
978
+ # print the current default session
979
+ $ jbrowse set-default-session --currentSession
980
+
981
+ # remove the existing default session
982
+ $ jbrowse set-default-session --delete
627
983
  ```
628
984
 
629
985