@jbrowse/cli 4.3.0 → 5.0.0-beta.10

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 (71) hide show
  1. package/README.md +451 -72
  2. package/dist/base.js +0 -3
  3. package/dist/bin.js +2 -1
  4. package/dist/cliFetch.js +3 -0
  5. package/dist/commands/add-assembly/index.js +46 -19
  6. package/dist/commands/add-assembly/utils.js +204 -290
  7. package/dist/commands/add-connection.js +73 -79
  8. package/dist/commands/add-track-json.js +24 -12
  9. package/dist/commands/add-track-utils/adapter-utils.js +189 -288
  10. package/dist/commands/add-track-utils/file-operations.js +27 -11
  11. package/dist/commands/add-track-utils/multiwig.js +47 -0
  12. package/dist/commands/add-track-utils/track-config.js +66 -25
  13. package/dist/commands/add-track-utils/validators.js +36 -20
  14. package/dist/commands/add-track.js +200 -62
  15. package/dist/commands/admin-server/index.js +39 -50
  16. package/dist/commands/admin-server/utils.js +238 -126
  17. package/dist/commands/create.js +18 -34
  18. package/dist/commands/make-density/density-generator.js +180 -0
  19. package/dist/commands/make-density/index.js +139 -0
  20. package/dist/commands/make-pif/index.js +133 -11
  21. package/dist/commands/make-pif/pif-generator.js +243 -43
  22. package/dist/commands/process-utils.js +13 -2
  23. package/dist/commands/remove-track.js +20 -13
  24. package/dist/commands/set-default-session.js +35 -31
  25. package/dist/commands/shared/config-operations.js +3 -10
  26. package/dist/commands/shared/density.js +12 -0
  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 +19 -26
  32. package/dist/commands/text-index/aggregate.js +40 -34
  33. package/dist/commands/text-index/command.js +37 -7
  34. package/dist/commands/text-index/config-utils.js +62 -85
  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 +44 -96
  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 +7613 -0
  42. package/dist/commands/validate/configSchema.generated.js +20400 -0
  43. package/dist/commands/validate/displayDefaultKeys.js +28 -0
  44. package/dist/commands/validate/index.js +113 -0
  45. package/dist/commands/validate/liftConfig.js +34 -0
  46. package/dist/commands/validate/markRules/aggregateFieldName.js +9 -0
  47. package/dist/commands/validate/markRules/autoBin.js +27 -0
  48. package/dist/commands/validate/markRules/colorScale.js +244 -0
  49. package/dist/commands/validate/markRules/cssColorsLevel4.js +162 -0
  50. package/dist/commands/validate/markRules/jexlStrings.js +23 -0
  51. package/dist/commands/validate/markRules/markProblems.js +532 -0
  52. package/dist/commands/validate/markRules/markRuleFacts.js +6 -0
  53. package/dist/commands/validate/markRules/markSpecs.js +96 -0
  54. package/dist/commands/validate/markRules/markVocabulary.js +57 -0
  55. package/dist/commands/validate/markRules/shapeNameList.js +7 -0
  56. package/dist/commands/validate/markRules/stepChannels.js +55 -0
  57. package/dist/commands/validate/schemaValidate.js +425 -0
  58. package/dist/commands/validate/suggest.js +35 -0
  59. package/dist/commands/validate/types.js +6 -0
  60. package/dist/commands/validate/validateConfig.js +502 -0
  61. package/dist/index.js +104 -50
  62. package/dist/types/common.js +3 -27
  63. package/dist/utils.js +309 -128
  64. package/dist/version.js +1 -1
  65. package/package.json +8 -14
  66. package/bin/run +0 -4
  67. package/bundle/index.js +0 -3686
  68. package/dist/commands/make-pif/cigar-utils.js +0 -24
  69. package/dist/commands/make-pif/file-utils.js +0 -30
  70. package/dist/commands/track-utils.js +0 -74
  71. package/dist/util.js +0 -35
package/README.md CHANGED
@@ -13,7 +13,7 @@ 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
 
16
- ```
16
+ ```js
17
17
  const config = JSON.parse(fs.readFileSync('config.json', 'utf8'))
18
18
  // do something with config.tracks, config.assemblies, etc.
19
19
  fs.writeFileSync('config.json', JSON.stringify(config, null, 2))
@@ -43,7 +43,7 @@ npx @jbrowse/cli create myfolder
43
43
  It is likely preferable in most cases to install the tools globally with
44
44
  `npm install @jbrowse/cli -g` however
45
45
 
46
- ```
46
+ ```text
47
47
 
48
48
  JBrowse CLI
49
49
 
@@ -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
@@ -76,7 +78,7 @@ Use "jbrowse <command> --help" for more information about a command.
76
78
 
77
79
  ## jbrowse create
78
80
 
79
- ```
81
+ ```text
80
82
  Downloads and installs the latest JBrowse 2 release
81
83
 
82
84
  Usage: jbrowse create [localPath] [options]
@@ -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
 
@@ -119,7 +123,7 @@ $ jbrowse create --listVersions
119
123
 
120
124
  ## jbrowse add-assembly
121
125
 
122
- ```
126
+ ```text
123
127
  Add an assembly to a JBrowse 2 configuration
124
128
 
125
129
  Usage: jbrowse add-assembly <sequence> [options]
@@ -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
196
202
 
197
- --overwrite Overwrite existing assembly if one with the same
198
- name exists
203
+ Notes:
199
204
 
200
- -f, --force Equivalent to `--skipCheck --overwrite`
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.
211
+
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,21 +234,26 @@ $ 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
 
228
243
  ## jbrowse add-track
229
244
 
230
- ```
245
+ ```text
231
246
  Add a track to a JBrowse 2 configuration
232
247
 
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 the multi-genome PAF adapters
268
+ (MultiGenomePAFAdapter/MultiGenomeIndexedPAFAdapter)
269
+ list 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, filter, 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)
268
-
269
- --skipCheck Skip check for whether file or URL exists
270
-
271
- --overwrite Overwrites existing track if it shares the same
272
- trackId
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]
273
305
 
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,53 @@ 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, filter).
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 multi-genome PAF
356
+ adapters (MultiGenomePAFAdapter, MultiGenomeIndexedPAFAdapter) it is instead the
357
+ full list of assemblies the file covers, in any order.
358
+
359
+ Examples:
360
+
282
361
  # copy /path/to/my.bam and /path/to/my.bam.bai to current directory and adds track to config.json
283
362
  $ jbrowse add-track /path/to/my.bam --load copy
284
363
 
@@ -296,12 +375,90 @@ $ jbrowse add-track https://mywebsite.com/my.bam
296
375
 
297
376
  # --load inPlace adds a track without doing file operations
298
377
  $ jbrowse add-track /url/relative/path.bam --load inPlace
378
+
379
+ # color a track by strand and set its height (no escaping: single-quote the value, double-quote inside the jexl)
380
+ $ jbrowse add-track genes.gff3.gz --load copy --color 'jexl:feature.strand==1?"blue":"red"' --height 200
381
+
382
+ # bundle several BigWigs into one MultiQuantitativeTrack (no positional track arg)
383
+ $ jbrowse add-track --multiwig a.bw,b.bw,c.bw --load copy --name "Coverage"
384
+
385
+ # ...or from a sources.json carrying per-row name/color for each BigWig
386
+ $ jbrowse add-track --multiwig sources.json --name "CATlas ATAC"
387
+
388
+ # attach a remote density sidecar (a local genes.gff3.density.bw needs no flag)
389
+ $ jbrowse add-track https://mywebsite.com/genes.gff3.gz --density https://mywebsite.com/genes.gff3.density.bw
299
390
  ```
300
391
 
301
392
 
302
- ## jbrowse text-index
393
+ ## jbrowse validate
394
+
395
+ ```text
396
+ Check a JBrowse configuration for errors, including the ones JBrowse itself
397
+ accepts silently
398
+
399
+ Usage: jbrowse validate [config.json] [options]
400
+
401
+ Options:
402
+ --json Output the findings as JSON instead of text
403
+
404
+ -q, --quiet Only print errors, suppressing warnings and notes
405
+
406
+ -h, --help Show help
407
+
408
+ Notes:
409
+
410
+ A config key JBrowse does not recognize is ignored rather than reported, so a
411
+ misspelled slot leaves the track loading normally with the setting doing
412
+ nothing. That is what this command is mainly for.
413
+
414
+ Two levels are reported:
415
+
416
+ error JBrowse silently does the wrong thing, or refuses to load it — an
417
+ unknown slot, a key a defaultSession view or display does not
418
+ declare, a track naming an assembly the config never defines, a
419
+ defaultSession naming a trackId that does not exist, a duplicate
420
+ 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
+ A LinearMarkDisplay loads whenever its keys and value types are right and says
428
+ what it cannot draw in a corner notice rather than refusing the track. This
429
+ command runs the display's own rule list over every "marks" list in the file: an
430
+ error where a mark draws nothing, never draws or a step cannot run, and a
431
+ warning where a slot waits unread or the marks draw in an arrangement the author
432
+ may not have meant. With --json each finding carries the stable "rule" id of the
433
+ rule that made it.
434
+
435
+ Types registered by plugins are not known to this command, so they come through
436
+ as warnings rather than errors.
437
+
438
+ The same checks are published as a JSON Schema at
439
+ https://jbrowse.org/jb2/schema/v5/config.json: a "$schema" line naming it at the
440
+ top of a config.json gives an editor completion and validation for every slot.
441
+ This command runs that schema first, then the cross-references a schema cannot
442
+ express — a trackId a session names that no track defines, an assembly a track
443
+ names that none defines.
303
444
 
445
+ Examples:
446
+
447
+ # check the config.json in the current directory
448
+ $ jbrowse validate
449
+
450
+ # check a specific config or saved session
451
+ $ jbrowse validate /path/to/config.json
452
+ $ jbrowse validate mysession.jbrowse
453
+
454
+ # machine-readable output
455
+ $ jbrowse validate config.json --json
304
456
  ```
457
+
458
+
459
+ ## jbrowse text-index
460
+
461
+ ```text
305
462
  Make a text-indexing file for any given track(s).
306
463
 
307
464
  Usage: jbrowse text-index [options]
@@ -314,7 +471,9 @@ Options:
314
471
  available tracks
315
472
 
316
473
  --excludeTracks Specific tracks to exclude from indexing, formatted
317
- as comma separated trackIds
474
+ as comma separated trackIds. To exclude a track
475
+ permanently, set metadata.skipTextIndex on it in
476
+ config.json instead (see Notes)
318
477
 
319
478
  --target Path to config file in JB2 installation directory
320
479
  to read from.
@@ -322,7 +481,7 @@ Options:
322
481
  --out Synonym for target
323
482
 
324
483
  --attributes Comma separated list of attributes to index
325
- [default: Name,ID]
484
+ [default: Name,ID,symbol]
326
485
 
327
486
  -a, --assemblies Specify the assembl(ies) to create an index for. If
328
487
  unspecified, creates an index for each assembly in
@@ -335,8 +494,13 @@ Options:
335
494
 
336
495
  --perTrack If set, creates an index per track [default: false]
337
496
 
338
- --exclude Adds gene type to list of excluded types [default:
339
- CDS,exon]
497
+ --exclude Comma separated list of feature types to exclude
498
+ from indexing [default: CDS,exon]
499
+
500
+ --include Comma separated list of feature types to index,
501
+ dropping every other type. Unset by default, which
502
+ indexes every type --exclude does not name. GFF3
503
+ only
340
504
 
341
505
  --prefixSize Specify the prefix size for the ixx index. We
342
506
  attempt to automatically calculate this, but you
@@ -355,6 +519,34 @@ Options:
355
519
  --dryrun Just print out tracks that will be indexed by the
356
520
  process, without doing any indexing
357
521
 
522
+ Notes:
523
+
524
+ Individual tracks in config.json can be permanently excluded from indexing by
525
+ setting "metadata": { "skipTextIndex": true } on the track. Such tracks are
526
+ skipped even when indexing all tracks or a whole assembly, so you do not have to
527
+ pass --excludeTracks on every run.
528
+
529
+ Only tracks with an indexable adapter type (Gff3Adapter, Gff3TabixAdapter,
530
+ GtfAdapter, GtfTabixAdapter, VcfAdapter, VcfTabixAdapter) are indexed; tracks
531
+ with other adapter types are skipped automatically.
532
+
533
+ GTF has no Name/ID attributes, so the default --attributes also match their GTF
534
+ spellings (gene_name, transcript_name, gene_id, transcript_id). A GFF3 row with
535
+ no Name, as in GENCODE, is named by its own gene_name or transcript_name.
536
+
537
+ --exclude names types not to index; --include names the only types to index.
538
+ Reach for --include when the file draws from a vocabulary you do not control: an
539
+ NCBI RefSeq GFF3 uses 115 feature types, 80 of them leaf records with no name to
540
+ search (a match is labelled with a bare UUID, a cDNA_match with an MD5, every
541
+ biological_region with the string "biological region"), so a deny list leaks
542
+ whichever type is added next while the allow list — gene, pseudogene and the
543
+ transcript types — does not grow. Both may be given: --include admits, --exclude
544
+ then narrows. Either can also be set per track in config.json as
545
+ textSearching.indexingFeatureTypesToInclude / indexingFeatureTypesToExclude,
546
+ which takes precedence over the flag.
547
+
548
+ Examples:
549
+
358
550
  # indexes all tracks that it can find in the current directory's config.json
359
551
  $ jbrowse text-index
360
552
 
@@ -362,7 +554,7 @@ $ jbrowse text-index
362
554
  $ jbrowse text-index --tracks=track1,track2,track3
363
555
 
364
556
  # indexes all tracks except specific trackIds
365
- $ jbrowse text-index --exclude-tracks=track1,track2,track3
557
+ $ jbrowse text-index --excludeTracks=track1,track2,track3
366
558
 
367
559
  # indexes all tracks in a directory's config.json or in a specific config file
368
560
  $ jbrowse text-index --out /path/to/jb2/
@@ -377,29 +569,54 @@ $ jbrowse text-index --file myfile.gff3.gz --file myfile.vcfgz --out indexes
377
569
 
378
570
  ## jbrowse admin-server
379
571
 
380
- ```
572
+ ```text
381
573
  Start up a small admin server for JBrowse configuration
382
574
 
383
575
  Usage: jbrowse admin-server [options]
384
576
 
385
577
  Options:
386
- -h, --help
578
+ -h, --help Show help
387
579
 
388
580
  -p, --port Specified port to start the server on (default:
389
581
  9090)
390
582
 
583
+ --host Interface to bind to (default: 127.0.0.1). Use
584
+ 0.0.0.0 to accept connections from other machines
585
+
391
586
  --root Path to the root of the JB2 installation
392
587
 
393
588
  --bodySizeLimit Size limit of the update message (default: 25mb)
394
589
 
590
+ Notes:
591
+
592
+ The admin-server lets a browser session write changes back to config.json on
593
+ disk, authorized by a one-time key printed in the startup URL. It binds to
594
+ 127.0.0.1 so only this machine can reach it. The key gates the config routes,
595
+ but the rest of the JBrowse directory is served unauthenticated, so widen --host
596
+ only on a trusted network.
597
+
598
+ Examples:
599
+
600
+ # start the admin server for the JBrowse install in the current directory
395
601
  $ jbrowse admin-server
602
+
603
+ # start on a specific port
396
604
  $ jbrowse admin-server -p 8888
605
+
606
+ # point at a specific JBrowse installation directory
607
+ $ jbrowse admin-server --root /path/to/jb2/
608
+
609
+ # raise the body size limit for very large config updates
610
+ $ jbrowse admin-server --bodySizeLimit 100mb
611
+
612
+ # accept connections from other machines on the network
613
+ $ jbrowse admin-server --host 0.0.0.0
397
614
  ```
398
615
 
399
616
 
400
617
  ## jbrowse upgrade
401
618
 
402
- ```
619
+ ```text
403
620
  Upgrades JBrowse 2 to latest version
404
621
 
405
622
  Usage: jbrowse upgrade [localPath] [options]
@@ -423,6 +640,8 @@ Options:
423
640
 
424
641
  -u, --url A direct URL to a JBrowse 2 release
425
642
 
643
+ Examples:
644
+
426
645
  # Upgrades current directory to latest jbrowse release
427
646
  $ jbrowse upgrade
428
647
 
@@ -445,34 +664,135 @@ $ jbrowse upgrade --nightly
445
664
 
446
665
  ## jbrowse make-pif
447
666
 
448
- ```
667
+ ```text
449
668
  creates pairwise indexed PAF (PIF), with bgzip and tabix
450
669
 
451
670
  Usage: jbrowse make-pif <file> [options]
452
671
 
453
672
  Options:
454
- -h, --help
673
+ -h, --help Show help
455
674
 
456
675
  --out Where to write the output file. will write
457
676
  ${file}.pif.gz and ${file}.pif.gz.tbi
458
677
 
459
678
  --csi Create a CSI index for the PIF file instead of TBI
460
679
 
461
- $ jbrowse make-pif input.paf # creates input.pif.gz in same directory
680
+ --coarse Accuracy bound (bp) of the coarse tier. A coarse
681
+ row replaces its CIGAR with a coarse CIGAR (cr:Z:)
682
+ that keeps every indel longer than half this length
683
+ and folds the rest into runs, each run staying
684
+ within this many bp of the real alignment. Defaults
685
+ to 10000. The coarse tier (prefix T/Q) is emitted
686
+ alongside the per-row CIGAR fine tier by default so
687
+ whole-genome synteny views can auto-switch to it;
688
+ pass --no-coarse to omit it.
689
+
690
+ --no-coarse Do not emit the coarse tier; write only the per-row
691
+ CIGAR fine tier.
692
+
693
+ --threads Compression threads for bgzip. Defaults to 4. Raise
694
+ it on a machine with cores to spare, or set 1 to
695
+ leave the rest of the machine alone.
696
+
697
+ Notes:
698
+
699
+ Use --csi for assemblies containing sequences longer than ~512 Mb. The default
700
+ TBI index cannot address coordinates beyond 2^29 (~536 Mb), so a CSI index is
701
+ required for large chromosomes (e.g. some plant and amphibian genomes). Requires
702
+ sh, sort, bgzip, and tabix on the PATH.
703
+
704
+ Examples:
705
+
706
+ # creates input.pif.gz and input.pif.gz.tbi in the same directory
707
+ $ jbrowse make-pif input.paf
462
708
 
463
- $ jbrowse make-pif input.paf --out output.pif.gz # specify output file, creates output.pif.gz.tbi also
709
+ # specify the output file, also creates output.pif.gz.tbi
710
+ $ jbrowse make-pif input.paf --out output.pif.gz
711
+
712
+ # use a CSI index for assemblies with chromosomes longer than ~512 Mb
713
+ $ jbrowse make-pif input.paf --csi
714
+
715
+ # a looser coarse tier: runs within 50kb of the alignment, indels over 25kb kept
716
+ $ jbrowse make-pif input.paf --coarse 50000
717
+
718
+ # emit only the per-row CIGAR fine tier, skipping the coarse tier
719
+ $ jbrowse make-pif input.paf --no-coarse
720
+
721
+ # give bgzip more (or fewer) compression threads than the default 4
722
+ $ jbrowse make-pif input.paf --threads 8
464
723
  ```
465
724
 
466
725
 
467
- ## jbrowse sort-gff
726
+ ## jbrowse make-density
727
+
728
+ ```text
729
+ Counts feature starts per bin into a bigWig, the density sidecar a track draws
730
+ where the region is too large to fetch its features
731
+
732
+ Usage: jbrowse make-density <file> [options]
733
+
734
+ Options:
735
+ -h, --help Show help
736
+
737
+ --bin Width of each bin, in bp [default: 1000]
738
+
739
+ --chrom-sizes Two-column reference name and length table for the
740
+ assembly the file is on
741
+
742
+ --assembly FASTA of the assembly the file is on; its .fai
743
+ supplies the reference lengths, in place of
744
+ --chrom-sizes
745
+
746
+ --out Where to write the bigWig. Defaults to
747
+ <file>.density.bw beside the input, which is where
748
+ add-track looks for it
749
+
750
+ Notes:
751
+
752
+ The sidecar is attached to a track through its adapter's densityAdapter slot,
753
+ which BamAdapter, CramAdapter, HtsgetBamAdapter, Gff3TabixAdapter,
754
+ GtfTabixAdapter, BedTabixAdapter, BigBedAdapter, VcfTabixAdapter and
755
+ SplitVcfTabixAdapter declare. add-track attaches it on its own when the default
756
+ <file>.density.bw sits beside the track file, so building it before adding the
757
+ track is all it takes; --density attaches one by path or URL.
758
+
759
+ GFF3 counts only top-level features — a line whose attributes carry no Parent= —
760
+ so a gene is one count rather than one per exon. GTF, BED and VCF have no parent
761
+ link to follow, so every record counts.
468
762
 
763
+ BAM and CRAM are out of scope: read depth is not feature density, and the tools
764
+ that compute it already write bigWig. Point add-track --density at what they
765
+ produce.
766
+
767
+ Requires bedGraphToBigWig (UCSC) on the PATH.
768
+
769
+ Examples:
770
+
771
+ # writes genes.gff3.density.bw beside the input, in 1kb bins
772
+ $ jbrowse make-density genes.gff3.gz --chrom-sizes hg38.chrom.sizes
773
+
774
+ # take the reference lengths from the assembly FASTA index instead
775
+ $ jbrowse make-density variants.vcf.gz --assembly hg38.fa
776
+
777
+ # coarser bins, and a name of your own
778
+ $ jbrowse make-density genes.gff3.gz --assembly hg38.fa --bin 10000 --out genes.10kb.bw
469
779
  ```
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
780
+
781
+
782
+ ## jbrowse sort-gff
783
+
784
+ ```text
785
+ Sort a GFF or GTF for tabix — the two share a refname/start column layout. It is
786
+ `sort -k1,1 -k4,4n` with LC_ALL=C and a tab separator, plus every line starting
787
+ with # kept at the top rather than sorted into the data. Takes a file, or the
788
+ same data on stdin
471
789
 
472
790
  Usage: jbrowse sort-gff [file] [options]
473
791
 
474
792
  Options:
475
- -h, --help
793
+ -h, --help Show help
794
+
795
+ Examples:
476
796
 
477
797
  # sort gff and pipe to bgzip
478
798
  $ jbrowse sort-gff input.gff | bgzip > sorted.gff.gz
@@ -480,18 +800,26 @@ $ tabix sorted.gff.gz
480
800
 
481
801
  # sort gff from stdin
482
802
  $ cat input.gff | jbrowse sort-gff | bgzip > sorted.gff.gz
803
+
804
+ # also works on GTF
805
+ $ jbrowse sort-gff input.gtf | bgzip > sorted.gtf.gz
806
+ $ tabix -p gff sorted.gtf.gz
483
807
  ```
484
808
 
485
809
 
486
810
  ## jbrowse sort-bed
487
811
 
488
- ```
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
812
+ ```text
813
+ Sort a BED file for tabix. It is `sort -k1,1 -k2,2n` with LC_ALL=C and a tab
814
+ separator, plus every line starting with # kept at the top rather than sorted
815
+ into the data. Takes a file, or the same data on stdin
490
816
 
491
817
  Usage: jbrowse sort-bed [file] [options]
492
818
 
493
819
  Options:
494
- -h, --help
820
+ -h, --help Show help
821
+
822
+ Examples:
495
823
 
496
824
  # sort bed and pipe to bgzip
497
825
  $ jbrowse sort-bed input.bed | bgzip > sorted.bed.gz
@@ -503,13 +831,13 @@ $ tabix sorted.bed.gz
503
831
 
504
832
  ## jbrowse add-connection
505
833
 
506
- ```
834
+ ```text
507
835
  Add a connection to a JBrowse 2 configuration
508
836
 
509
837
  Usage: jbrowse add-connection <connectionUrlOrPath> [options]
510
838
 
511
839
  Options:
512
- -h, --help
840
+ -h, --help Show help
513
841
 
514
842
  -t, --type Type of connection (e.g. JBrowse1Connection,
515
843
  UCSCTrackHubConnection, custom)
@@ -532,31 +860,41 @@ Options:
532
860
 
533
861
  --out Synonym for target
534
862
 
535
- --skipCheck Don't check whether the data directory URL exists
863
+ -f, --force Overwrite existing connection if one with the same
864
+ id exists
536
865
 
537
- --overwrite Overwrites any existing connections if same
538
- connection id
866
+ Examples:
539
867
 
540
- -f, --force Equivalent to --skipCheck --overwrite
868
+ # add a JBrowse 1 data directory connection (type inferred from the jbrowse/data path)
869
+ $ jbrowse add-connection https://mysite.com/jbrowse/data/ -a hg19
541
870
 
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
871
+ # force the JBrowse1Connection type for a non-standard data folder path
872
+ $ jbrowse add-connection https://mysite.com/jbrowse/custom_data_folder/ --type JBrowse1Connection -a hg38
873
+
874
+ # add a UCSC track hub (type inferred from the hub.txt filename)
875
+ $ jbrowse add-connection https://mysite.com/path/to/hub.txt
876
+
877
+ # force the UCSCTrackHubConnection type for a hub file not named hub.txt
878
+ $ jbrowse add-connection https://mysite.com/path/to/custom_hub_name.txt --type UCSCTrackHubConnection
879
+
880
+ # add a custom connection type with extra config
881
+ $ jbrowse add-connection https://mysite.com/path/to/custom --type custom --config '{"uri":{"url":"https://mysite.com/path/to/custom"}, "locationType": "UriLocation"}' -a hg19
882
+
883
+ # set an explicit id/name and write to a specific config file
547
884
  $ jbrowse add-connection https://mysite.com/path/to/hub.txt --connectionId newId --name newName --target /path/to/jb2/installation/config.json
548
885
  ```
549
886
 
550
887
 
551
888
  ## jbrowse add-track-json
552
889
 
553
- ```
554
- Add a track configuration directly from a JSON hunk to the JBrowse 2 configuration
890
+ ```text
891
+ Add a track configuration directly from a JSON hunk to the JBrowse 2
892
+ configuration
555
893
 
556
894
  Usage: jbrowse add-track-json <track> [options]
557
895
 
558
896
  Options:
559
- -h, --help
897
+ -h, --help Show help
560
898
 
561
899
  -u, --update Update the contents of an existing track, matched
562
900
  based on trackId
@@ -566,44 +904,74 @@ Options:
566
904
 
567
905
  --out Synonym for target
568
906
 
907
+ Notes:
908
+
909
+ The track argument is a JSON file, inline JSON, or "-" to read the JSON from
910
+ stdin, so a track config can be generated and piped straight in.
911
+
912
+ Examples:
913
+
914
+ # add a track from a JSON file
569
915
  $ jbrowse add-track-json track.json
916
+
917
+ # update an existing track (matched by trackId) with new JSON contents
570
918
  $ jbrowse add-track-json track.json --update
919
+
920
+ # pass the track config inline instead of via a file
921
+ $ jbrowse add-track-json '{"type":"FeatureTrack","trackId":"genes","assemblyNames":["hg38"],"adapter":{"type":"Gff3TabixAdapter","gffGzLocation":{"uri":"genes.gff.gz"}}}'
922
+
923
+ # pipe the track config in from another program
924
+ $ jq '.tracks[0]' other/config.json | jbrowse add-track-json -
925
+
926
+ # write to a config.json in a specific installation directory
927
+ $ jbrowse add-track-json track.json --out /path/to/jb2/
571
928
  ```
572
929
 
573
930
 
574
931
  ## jbrowse remove-track
575
932
 
576
- ```
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!
933
+ ```text
934
+ Remove a track configuration from a JBrowse 2 configuration. Be aware that this
935
+ can cause crashes in saved sessions that refer to this track!
578
936
 
579
937
  Usage: jbrowse remove-track <trackId> [options]
580
938
 
581
939
  Options:
582
- -h, --help
940
+ -h, --help Show help
583
941
 
584
942
  --target Path to config file in JB2 installation directory
585
943
  to write out to
586
944
 
587
945
  --out Synonym for target
588
946
 
589
- $ jbrowse remove-track trackId
947
+ Examples:
948
+
949
+ # remove a track from the config.json in the current directory
950
+ $ jbrowse remove-track my_track_id
951
+
952
+ # remove a track from a config.json in a specific installation directory
953
+ $ jbrowse remove-track my_track_id --out /path/to/jb2/
954
+
955
+ # remove a track from a specific config file
956
+ $ jbrowse remove-track my_track_id --target /path/to/jb2/config.json
590
957
  ```
591
958
 
592
959
 
593
960
  ## jbrowse set-default-session
594
961
 
595
- ```
962
+ ```text
596
963
  Set a default session with views and tracks
597
964
 
598
- Usage: jbrowse add-track <track> [options]
965
+ Usage: jbrowse set-default-session [options]
599
966
 
600
967
  Options:
601
968
  -s, --session set path to a file containing session in json
602
- format (required, unless using
603
- delete/currentSession flags)
969
+ format, or "-" to read it from stdin (required,
970
+ unless using delete/currentSession flags)
604
971
 
605
- -n, --name Give a name for the default session [default: New
606
- Default Session]
972
+ -n, --name Give a name for the default session (overrides any
973
+ name in the session file; defaults to "New Default
974
+ Session")
607
975
 
608
976
  -c, --currentSession List out the current default session
609
977
 
@@ -616,14 +984,25 @@ Options:
616
984
 
617
985
  -h, --help Show help
618
986
 
987
+ Examples:
988
+
619
989
  # set default session for the config.json in your current directory
620
990
  $ jbrowse set-default-session --session /path/to/default/session.json
621
991
 
622
992
  # make session.json the defaultSession on the specified target config.json file
623
993
  $ jbrowse set-default-session --target /path/to/jb2/installation/config.json --session session.json
624
994
 
625
- # print current default session
626
- $ jbrowse set-default-session --currentSession # Prints out current default session
995
+ # override the name stored in the session file
996
+ $ jbrowse set-default-session --session session.json --name "My default view"
997
+
998
+ # pipe a session in from another program
999
+ $ jq '.defaultSession' other/config.json | jbrowse set-default-session --session -
1000
+
1001
+ # print the current default session
1002
+ $ jbrowse set-default-session --currentSession
1003
+
1004
+ # remove the existing default session
1005
+ $ jbrowse set-default-session --delete
627
1006
  ```
628
1007
 
629
1008