@jbrowse/cli 4.0.4 → 4.1.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 (47) hide show
  1. package/README.md +0 -344
  2. package/bin/run +2 -1
  3. package/bundle/index.js +278 -179
  4. package/dist/base.js +1 -2
  5. package/dist/bin.js +2 -4
  6. package/dist/commands/add-assembly/index.js +19 -22
  7. package/dist/commands/add-assembly/utils.js +75 -92
  8. package/dist/commands/add-connection.js +16 -22
  9. package/dist/commands/add-track-json.js +13 -16
  10. package/dist/commands/add-track-utils/adapter-utils.js +6 -13
  11. package/dist/commands/add-track-utils/file-operations.js +7 -13
  12. package/dist/commands/add-track-utils/track-config.js +10 -18
  13. package/dist/commands/add-track-utils/validators.js +15 -27
  14. package/dist/commands/add-track.js +27 -33
  15. package/dist/commands/admin-server/index.js +23 -29
  16. package/dist/commands/admin-server/utils.js +27 -38
  17. package/dist/commands/create.js +16 -22
  18. package/dist/commands/make-pif/cigar-utils.js +3 -8
  19. package/dist/commands/make-pif/file-utils.js +10 -18
  20. package/dist/commands/make-pif/index.js +13 -16
  21. package/dist/commands/make-pif/pif-generator.js +14 -23
  22. package/dist/commands/process-utils.js +1 -4
  23. package/dist/commands/remove-track.js +8 -11
  24. package/dist/commands/set-default-session.js +13 -19
  25. package/dist/commands/shared/config-operations.js +7 -11
  26. package/dist/commands/shared/sort-utils.js +7 -14
  27. package/dist/commands/shared/validators.js +4 -8
  28. package/dist/commands/sort-bed.js +14 -17
  29. package/dist/commands/sort-gff.js +14 -17
  30. package/dist/commands/text-index/adapter-utils.js +5 -10
  31. package/dist/commands/text-index/aggregate.js +12 -15
  32. package/dist/commands/text-index/command.js +9 -12
  33. package/dist/commands/text-index/config-utils.js +20 -35
  34. package/dist/commands/text-index/file-list.js +11 -17
  35. package/dist/commands/text-index/index.js +4 -11
  36. package/dist/commands/text-index/indexing-utils.js +59 -43
  37. package/dist/commands/text-index/per-track.js +13 -16
  38. package/dist/commands/text-index/validators.js +3 -8
  39. package/dist/commands/track-utils.js +22 -33
  40. package/dist/commands/upgrade.js +20 -26
  41. package/dist/fetchWithProxy.js +5 -8
  42. package/dist/index.js +31 -39
  43. package/dist/types/common.js +5 -107
  44. package/dist/util.js +13 -20
  45. package/dist/utils.js +77 -53
  46. package/dist/version.js +1 -0
  47. package/package.json +6 -4
package/README.md CHANGED
@@ -44,428 +44,84 @@ 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
  ```
47
-
48
- JBrowse CLI
49
-
50
- USAGE
51
- $ jbrowse <command> [options]
52
-
53
- COMMANDS
54
- create Downloads and installs the latest JBrowse 2 release
55
- add-assembly Add an assembly to a JBrowse 2 configuration
56
- add-track Add a track to a JBrowse 2 configuration
57
- text-index Make a text-indexing file for any given track(s)
58
- admin-server Start up a small admin server for JBrowse configuration
59
- upgrade Upgrades JBrowse 2 to latest version
60
- 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
63
- add-connection Add a connection to a JBrowse 2 configuration
64
- add-track-json Add a track configuration directly from a JSON hunk
65
- remove-track Remove a track configuration from a JBrowse 2 configuration
66
- set-default-session Set a default session with views and tracks
67
-
68
- OPTIONS
69
- -h, --help Show help
70
- -v, --version Show version
71
-
72
- Use "jbrowse <command> --help" for more information about a command.
73
-
74
47
  ```
75
48
 
76
49
 
77
50
  ## jbrowse create
78
51
 
79
52
  ```
80
- Downloads and installs the latest JBrowse 2 release
81
-
82
- Usage: jbrowse create [localPath] [options]
83
-
84
- Options:
85
- -h, --help Show help
86
- -f, --force Overwrites existing JBrowse 2 installation if present in path
87
- -l, --listVersions Lists out all versions of JBrowse 2
88
- , --branch Download a development build from a named git branch
89
- , --nightly Download the latest development build from the main branch
90
- -u, --url A direct URL to a JBrowse 2 release
91
- -t, --tag Version of JBrowse 2 to install. Format is v1.0.0.
92
- Defaults to latest
93
-
94
- # Download latest release from github, and put in specific path
95
- $ jbrowse create /path/to/new/installation
96
-
97
- # Download latest release from github and force overwrite existing contents at path
98
- $ jbrowse create /path/to/new/installation --force
99
-
100
- # Download latest release from a specific URL
101
- $ jbrowse create /path/to/new/installation --url url.com/directjbrowselink.zip
102
-
103
- # Download a specific tag from github
104
- $ jbrowse create /path/to/new/installation --tag v1.0.0
105
-
106
- # List available versions
107
- $ jbrowse create --listVersions
108
53
  ```
109
54
 
110
55
 
111
56
  ## jbrowse add-assembly
112
57
 
113
58
  ```
114
- Add an assembly to a JBrowse 2 configuration
115
-
116
- Usage: jbrowse add-assembly <sequence> [options]
117
-
118
- Options:
119
- -t, --type type of sequence, by default inferred from sequence file
120
-
121
- indexedFasta An index FASTA (e.g. .fa or .fasta) file;
122
- can optionally specify --faiLocation
123
-
124
- bgzipFasta A block-gzipped and indexed FASTA (e.g. .fa.gz or .fasta.gz) file;
125
- can optionally specify --faiLocation and/or --gziLocation
126
-
127
- twoBit A twoBit (e.g. .2bit) file
128
-
129
- chromSizes A chromosome sizes (e.g. .chrom.sizes) file
130
-
131
- custom Either a JSON file location or inline JSON that defines a custom
132
- sequence adapter; must provide --name if using inline JSON
133
- -n, --name Name of the assembly; if not specified, will be guessed using the sequence file name
134
- -a, --alias An alias for the assembly name (e.g. "hg38" if the name of the assembly is "GRCh38");
135
- can be specified multiple times
136
- , --displayName The display name to specify for the assembly, e.g. "Homo sapiens (hg38)" while the name can be a shorter identifier like "hg38"
137
- , --faiLocation [default: <fastaLocation>.fai] FASTA index file or URL
138
- , --gziLocation [default: <fastaLocation>.gzi] FASTA gzip index file or URL
139
- , --refNameAliases Reference sequence name aliases file or URL; assumed to be a tab-separated aliases
140
- file unless --refNameAliasesType is specified
141
- , --refNameAliasesType Type of aliases defined by --refNameAliases; if "custom", --refNameAliases is either
142
- a JSON file location or inline JSON that defines a custom sequence adapter
143
- , --refNameColors A comma-separated list of color strings for the reference sequence names; will cycle
144
- through colors if there are fewer colors than sequences
145
- , --target path to config file in JB2 installation directory to write out to.
146
- Creates ./config.json if nonexistent
147
- , --out synonym for target
148
- -h, --help Display help for command
149
- -l, --load Required flag when using a local file. Choose how to manage the data directory. Copy, symlink, or move the data directory to the JBrowse directory. Or use inPlace to modify the config without doing any file operations
150
- , --skipCheck Don't check whether or not the sequence file or URL exists or if you are in a JBrowse directory
151
- , --overwrite Overwrite existing assembly if one with the same name exists
152
- -f, --force Equivalent to `--skipCheck --overwrite`
153
-
154
- # add assembly to installation in current directory. assumes .fai file also exists, and copies GRCh38.fa and GRCh38.fa.fai to current directory
155
- $ jbrowse add-assembly GRCh38.fa --load copy
156
-
157
- # add assembly to a specific jb2 installation path using --out, and copies the .fa and .fa.fai file to /path/to/jb2
158
- $ jbrowse add-assembly GRCh38.fa --out /path/to/jb2/ --load copy
159
-
160
- # force indexedFasta for add-assembly without relying on file extension
161
- $ jbrowse add-assembly GRCh38.xyz --type indexedFasta --load copy
162
-
163
- # add displayName for an assembly
164
- $ jbrowse add-assembly myFile.fa.gz --name hg38 --displayName "Homo sapiens (hg38)"
165
-
166
- # use chrom.sizes file for assembly instead of a fasta file
167
- $ jbrowse add-assembly GRCh38.chrom.sizes --load inPlace
168
-
169
- # add assembly from preconfigured json file, expert option
170
- $ jbrowse add-assembly GRCh38.config.json --load copy
171
-
172
- # add assembly from a 2bit file, also note pointing direct to a URL so no --load flag needed
173
- $ jbrowse add-assembly https://example.com/data/sample.2bit
174
-
175
- # add a bgzip indexed fasta inferred by fa.gz extension. assumes .fa.gz.gzi and .fa.gz.fai files also exists
176
- $ jbrowse add-assembly myfile.fa.gz --load copy
177
59
  ```
178
60
 
179
61
 
180
62
  ## jbrowse add-track
181
63
 
182
64
  ```
183
- Add a track to a JBrowse 2 configuration
184
-
185
- Usage: jbrowse add-track <track> [options]
186
-
187
- Options:
188
- -h, --help undefined
189
- -t, --trackType Type of track, by default inferred from track file
190
- -n, --name Name of the track. Will be defaulted to the trackId if none specified
191
- , --indexFile Optional index file for the track
192
- -d, --description Optional description of the track
193
- -a, --assemblyNames Assembly name or names for track as comma separated string
194
- , --category Optional comma separated string of categories to group tracks
195
- , --config Any extra config settings to add to a track
196
- , --target Path to config file in JB2 installation to write out to
197
- , --out Synonym for target
198
- , --subDir When using --load a file, output to a subdirectory of the target dir
199
- , --trackId trackId for the track, by default inferred from filename
200
- -l, --load How to manage the track (copy, symlink, move, inPlace)
201
- , --skipCheck Skip check for whether file or URL exists
202
- , --overwrite Overwrites existing track if it shares the same trackId
203
- -f, --force Equivalent to --skipCheck --overwrite
204
- , --protocol Force protocol to a specific value
205
- , --bed1 Used only for mcscan anchors/simpleAnchors types
206
- , --bed2 Used only for mcscan anchors/simpleAnchors types
207
-
208
- # copy /path/to/my.bam and /path/to/my.bam.bai to current directory and adds track to config.json
209
- $ jbrowse add-track /path/to/my.bam --load copy
210
-
211
- # copy my.bam and my.bam.bai to /path/to/jb2/bam and adds track entry to /path/to/jb2/bam/config.json
212
- $ jbrowse add-track my.bam --load copy --out /path/to/jb2 --subDir bam
213
-
214
- # same as above, but specify path to bai file. needed for if the bai file does not have the extension .bam.bai
215
- $ jbrowse add-track my.bam --indexFile my.bai --load copy
216
-
217
- # creates symlink for /path/to/my.bam and adds track to config.json
218
- $ jbrowse add-track /path/to/my.bam --load symlink
219
-
220
- # add track from URL to config.json, no --load flag needed
221
- $ jbrowse add-track https://mywebsite.com/my.bam
222
-
223
- # --load inPlace adds a track without doing file operations
224
- $ jbrowse add-track /url/relative/path.bam --load inPlace
225
65
  ```
226
66
 
227
67
 
228
68
  ## jbrowse text-index
229
69
 
230
70
  ```
231
- Make a text-indexing file for any given track(s).
232
-
233
- Usage: jbrowse text-index [options]
234
-
235
- Options:
236
- -h, --help Show CLI help
237
- , --tracks Specific tracks to index, formatted as comma separated trackIds. If unspecified, indexes all available tracks
238
- , --excludeTracks Specific tracks to exclude from indexing, formatted as comma separated trackIds
239
- , --target Path to config file in JB2 installation directory to read from.
240
- , --out Synonym for target
241
- , --attributes Comma separated list of attributes to index
242
- -a, --assemblies Specify the assembl(ies) to create an index for. If unspecified, creates an index for each assembly in the config
243
- , --force Overwrite previously existing indexes
244
- -q, --quiet Hide the progress bars
245
- , --perTrack If set, creates an index per track
246
- , --exclude Adds gene type to list of excluded types
247
- , --prefixSize Specify the prefix size for the ixx index. We attempt to automatically calculate this, but you can manually specify this too. If many genes have similar gene IDs e.g. Z000000001, Z000000002 the prefix size should be larger so that they get split into different bins
248
- , --file File or files to index (can be used to create trix indexes for embedded component use cases not using a config.json for example)
249
- , --fileId Set the trackId used for the indexes generated with the --file argument
250
- , --dryrun Just print out tracks that will be indexed by the process, without doing any indexing
251
-
252
- # indexes all tracks that it can find in the current directory's config.json
253
- $ jbrowse text-index
254
-
255
- # indexes specific trackIds that it can find in the current directory's config.json
256
- $ jbrowse text-index --tracks=track1,track2,track3
257
-
258
- # indexes all tracks except specific trackIds
259
- $ jbrowse text-index --exclude-tracks=track1,track2,track3
260
-
261
- # indexes all tracks in a directory's config.json or in a specific config file
262
- $ jbrowse text-index --out /path/to/jb2/
263
-
264
- # indexes only a specific assembly, and overwrite what was previously there using force (which is needed if a previous index already existed)
265
- $ jbrowse text-index -a hg19 --force
266
-
267
- # create index for some files for use in @jbrowse/react-linear-genome-view2 or similar
268
- $ jbrowse text-index --file myfile.gff3.gz --file myfile.vcfgz --out indexes
269
71
  ```
270
72
 
271
73
 
272
74
  ## jbrowse admin-server
273
75
 
274
76
  ```
275
- Start up a small admin server for JBrowse configuration
276
-
277
- Usage: jbrowse admin-server [options]
278
-
279
- Options:
280
- -h, --help undefined
281
- -p, --port Specified port to start the server on (default: 9090)
282
- , --root Path to the root of the JB2 installation
283
- , --bodySizeLimit Size limit of the update message (default: 25mb)
284
-
285
- $ jbrowse admin-server
286
- $ jbrowse admin-server -p 8888
287
77
  ```
288
78
 
289
79
 
290
80
  ## jbrowse upgrade
291
81
 
292
82
  ```
293
- Upgrades JBrowse 2 to latest version
294
-
295
- Usage: jbrowse upgrade [localPath] [options]
296
-
297
- Options:
298
- -h, --help Display help for command
299
- -l, --listVersions Lists out all versions of JBrowse 2
300
- -t, --tag Version of JBrowse 2 to install. Format is v1.0.0.
301
- Defaults to latest
302
- , --branch Download a development build from a named git branch
303
- , --nightly Download the latest development build from the main branch
304
- , --clean Removes old js,map,and LICENSE files in the installation
305
- -u, --url A direct URL to a JBrowse 2 release
306
-
307
- # Upgrades current directory to latest jbrowse release
308
- $ jbrowse upgrade
309
-
310
- # Upgrade jbrowse instance at a specific filesystem path
311
- $ jbrowse upgrade /path/to/jbrowse2/installation
312
-
313
- # Upgrade to a specific tag
314
- $ jbrowse upgrade /path/to/jbrowse2/installation --tag v1.0.0
315
-
316
- # List versions available on github
317
- $ jbrowse upgrade --listVersions
318
-
319
- # Upgrade from a specific URL
320
- $ jbrowse upgrade --url https://sample.com/jbrowse2.zip
321
-
322
- # Get nightly release from main branch
323
- $ jbrowse upgrade --nightly
324
83
  ```
325
84
 
326
85
 
327
86
  ## jbrowse make-pif
328
87
 
329
88
  ```
330
- creates pairwise indexed PAF (PIF), with bgzip and tabix
331
-
332
- Usage: jbrowse make-pif <file> [options]
333
-
334
- Options:
335
- -h, --help undefined
336
- , --out Where to write the output file. will write ${file}.pif.gz and ${file}.pif.gz.tbi
337
- , --csi Create a CSI index for the PIF file instead of TBI
338
-
339
- $ jbrowse make-pif input.paf # creates input.pif.gz in same directory
340
-
341
- $ jbrowse make-pif input.paf --out output.pif.gz # specify output file, creates output.pif.gz.tbi also
342
89
  ```
343
90
 
344
91
 
345
92
  ## jbrowse sort-gff
346
93
 
347
94
  ```
348
- 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
349
-
350
- Usage: jbrowse sort-gff [file] [options]
351
-
352
- Options:
353
- -h, --help undefined
354
-
355
- # sort gff and pipe to bgzip
356
- $ jbrowse sort-gff input.gff | bgzip > sorted.gff.gz
357
- $ tabix sorted.gff.gz
358
-
359
- # sort gff from stdin
360
- $ cat input.gff | jbrowse sort-gff | bgzip > sorted.gff.gz
361
95
  ```
362
96
 
363
97
 
364
98
  ## jbrowse sort-bed
365
99
 
366
100
  ```
367
- 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
368
-
369
- Usage: jbrowse sort-bed [file] [options]
370
-
371
- Options:
372
- -h, --help undefined
373
-
374
- # sort bed and pipe to bgzip
375
- $ jbrowse sort-bed input.bed | bgzip > sorted.bed.gz
376
- $ tabix sorted.bed.gz
377
-
378
- # OR pipe data via stdin: cat file.bed | jbrowse sort-bed | bgzip > sorted.bed.gz
379
101
  ```
380
102
 
381
103
 
382
104
  ## jbrowse add-connection
383
105
 
384
106
  ```
385
- Add a connection to a JBrowse 2 configuration
386
-
387
- Usage: jbrowse add-connection <connectionUrlOrPath> [options]
388
-
389
- Options:
390
- -h, --help undefined
391
- -t, --type Type of connection (e.g. JBrowse1Connection, UCSCTrackHubConnection, custom)
392
- -a, --assemblyNames For UCSC: optional comma separated list of assembly names to filter. For JBrowse1: a single assembly name
393
- -c, --config Extra config settings to add to connection in JSON object format
394
- , --connectionId Id for the connection that must be unique to JBrowse
395
- -n, --name Name of the connection. Defaults to connectionId if not provided
396
- , --target Path to config file in JB2 installation directory to write out to
397
- , --out Synonym for target
398
- , --skipCheck Don't check whether the data directory URL exists
399
- , --overwrite Overwrites any existing connections if same connection id
400
- -f, --force Equivalent to --skipCheck --overwrite
401
-
402
- $ jbrowse add-connection http://mysite.com/jbrowse/data/ -a hg19
403
- $ jbrowse add-connection http://mysite.com/jbrowse/custom_data_folder/ --type JBrowse1Connection -a hg38
404
- $ jbrowse add-connection http://mysite.com/path/to/hub.txt
405
- $ jbrowse add-connection http://mysite.com/path/to/custom_hub_name.txt --type UCSCTrackHubConnection
406
- $ jbrowse add-connection http://mysite.com/path/to/custom --type custom --config '{"uri":{"url":"https://mysite.com/path/to/custom"}, "locationType": "UriLocation"}' -a hg19
407
- $ jbrowse add-connection https://mysite.com/path/to/hub.txt --connectionId newId --name newName --target /path/to/jb2/installation/config.json
408
107
  ```
409
108
 
410
109
 
411
110
  ## jbrowse add-track-json
412
111
 
413
112
  ```
414
- Add a track configuration directly from a JSON hunk to the JBrowse 2 configuration
415
-
416
- Usage: jbrowse add-track-json <track> [options]
417
-
418
- Options:
419
- -h, --help undefined
420
- -u, --update Update the contents of an existing track, matched based on trackId
421
- , --target Path to config file in JB2 installation directory to write out to
422
- , --out Synonym for target
423
-
424
- $ jbrowse add-track-json track.json
425
- $ jbrowse add-track-json track.json --update
426
113
  ```
427
114
 
428
115
 
429
116
  ## jbrowse remove-track
430
117
 
431
118
  ```
432
- Remove a track configuration from a JBrowse 2 configuration. Be aware that this can cause crashes in saved sessions that refer to this track!
433
-
434
- Usage: jbrowse remove-track <trackId> [options]
435
-
436
- Options:
437
- -h, --help undefined
438
- , --target Path to config file in JB2 installation directory to write out to
439
- , --out Synonym for target
440
-
441
- $ jbrowse remove-track trackId
442
119
  ```
443
120
 
444
121
 
445
122
  ## jbrowse set-default-session
446
123
 
447
124
  ```
448
- Set a default session with views and tracks
449
-
450
- Usage: jbrowse add-track <track> [options]
451
-
452
- Options:
453
- -s, --session set path to a file containing session in json format (required, unless using delete/currentSession flags)
454
- -n, --name Give a name for the default session
455
- -c, --currentSession List out the current default session
456
- , --target path to config file in JB2 installation directory to write out to
457
- , --out synonym for target
458
- , --delete Delete any existing default session.
459
- -h, --help Show help
460
-
461
- # set default session for the config.json in your current directory
462
- $ jbrowse set-default-session --session /path/to/default/session.json
463
-
464
- # make session.json the defaultSession on the specified target config.json file
465
- $ jbrowse set-default-session --target /path/to/jb2/installation/config.json --session session.json
466
-
467
- # print current default session
468
- $ jbrowse set-default-session --currentSession # Prints out current default session
469
125
  ```
470
126
 
471
127
 
package/bin/run CHANGED
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('../dist/index.js').main(process.argv.slice(2))
3
+ import { main } from '../dist/index.js'
4
+ main(process.argv.slice(2))