@jbrowse/cli 2.7.2 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -56,6 +56,7 @@ It is likely preferable in most cases to install the tools globally with
56
56
  - [`jbrowse help [COMMANDS]`](#jbrowse-help-commands)
57
57
  - [`jbrowse remove-track TRACK`](#jbrowse-remove-track-track)
58
58
  - [`jbrowse set-default-session`](#jbrowse-set-default-session)
59
+ - [`jbrowse sort-gff FILE`](#jbrowse-sort-gff-file)
59
60
  - [`jbrowse text-index`](#jbrowse-text-index)
60
61
  - [`jbrowse upgrade [LOCALPATH]`](#jbrowse-upgrade-localpath)
61
62
 
@@ -203,7 +204,7 @@ EXAMPLES
203
204
  ```
204
205
 
205
206
  _See code:
206
- [src/commands/add-assembly.ts](https://github.com/GMOD/jbrowse-components/blob/v2.7.2/products/jbrowse-cli/src/commands/add-assembly.ts)_
207
+ [src/commands/add-assembly.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/add-assembly.ts)_
207
208
 
208
209
  ## `jbrowse add-connection CONNECTIONURLORPATH`
209
210
 
@@ -228,13 +229,13 @@ FLAGS
228
229
  -h, --help Show CLI help.
229
230
  -n, --name=<value> Name of the connection. Defaults to connectionId if not provided
230
231
  -t, --type=<value> type of connection, ex. JBrowse1Connection, UCSCTrackHubConnection, custom
231
- --connectionId=<value> Id for the connection that must be unique to JBrowse. Defaults to
232
+ --connectionId=<value> Id for the connection that must be unique to JBrowse. Defaults to
232
233
  'connectionType-assemblyName-currentTime'
233
- --out=<value> synonym for target
234
- --overwrite Overwrites any existing connections if same connection id
235
- --skipCheck Don't check whether or not the data directory URL exists or if you are in a JBrowse
234
+ --out=<value> synonym for target
235
+ --overwrite Overwrites any existing connections if same connection id
236
+ --skipCheck Don't check whether or not the data directory URL exists or if you are in a JBrowse
236
237
  directory
237
- --target=<value> path to config file in JB2 installation directory to write out to.
238
+ --target=<value> path to config file in JB2 installation directory to write out to.
238
239
 
239
240
  DESCRIPTION
240
241
  Add a connection to a JBrowse 2 configuration
@@ -254,7 +255,7 @@ EXAMPLES
254
255
  ```
255
256
 
256
257
  _See code:
257
- [src/commands/add-connection.ts](https://github.com/GMOD/jbrowse-components/blob/v2.7.2/products/jbrowse-cli/src/commands/add-connection.ts)_
258
+ [src/commands/add-connection.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/add-connection.ts)_
258
259
 
259
260
  ## `jbrowse add-track TRACK`
260
261
 
@@ -281,18 +282,18 @@ FLAGS
281
282
  <options: copy|symlink|move|inPlace>
282
283
  -n, --name=<value> Name of the track. Will be defaulted to the trackId if none specified
283
284
  -t, --trackType=<value> Type of track, by default inferred from track file
284
- --bed1=<value> Used only for mcscan anchors/simpleAnchors types
285
- --bed2=<value> Used only for mcscan anchors/simpleAnchors types
286
- --category=<value> Optional Comma separated string of categories to group tracks
287
- --config=<value> Any extra config settings to add to a track. i.e '{"defaultRendering": "density"}'
288
- --indexFile=<value> Optional index file for the track
289
- --out=<value> synonym for target
290
- --overwrite Overwrites existing track if it shares the same trackId
291
- --protocol=<value> [default: uri] Force protocol to a specific value
292
- --skipCheck Skip check for whether or not the file or URL exists or if you are in a JBrowse directory
293
- --subDir=<value> when using --load a file, output to a subdirectory of the target dir
294
- --target=<value> path to config file in JB2 installation to write out to.
295
- --trackId=<value> trackId for the track, by default inferred from filename, must be unique throughout
285
+ --bed1=<value> Used only for mcscan anchors/simpleAnchors types
286
+ --bed2=<value> Used only for mcscan anchors/simpleAnchors types
287
+ --category=<value> Optional Comma separated string of categories to group tracks
288
+ --config=<value> Any extra config settings to add to a track. i.e '{"defaultRendering": "density"}'
289
+ --indexFile=<value> Optional index file for the track
290
+ --out=<value> synonym for target
291
+ --overwrite Overwrites existing track if it shares the same trackId
292
+ --protocol=<value> [default: uri] Force protocol to a specific value
293
+ --skipCheck Skip check for whether or not the file or URL exists or if you are in a JBrowse directory
294
+ --subDir=<value> when using --load a file, output to a subdirectory of the target dir
295
+ --target=<value> path to config file in JB2 installation to write out to.
296
+ --trackId=<value> trackId for the track, by default inferred from filename, must be unique throughout
296
297
  config
297
298
 
298
299
  DESCRIPTION
@@ -335,7 +336,7 @@ EXAMPLES
335
336
  ```
336
337
 
337
338
  _See code:
338
- [src/commands/add-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.7.2/products/jbrowse-cli/src/commands/add-track.ts)_
339
+ [src/commands/add-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/add-track.ts)_
339
340
 
340
341
  ## `jbrowse add-track-json TRACK`
341
342
 
@@ -350,10 +351,10 @@ ARGUMENTS
350
351
  TRACK track JSON file or command line arg blob
351
352
 
352
353
  FLAGS
353
- -u, --update update the contents of an existing track, matched based on trackId
354
- --out=<value> synonym for target
355
- --target=<value> path to config file in JB2 installation directory to write out to.
356
- Creates ./config.json if nonexistent
354
+ -u, --update update the contents of an existing track, matched based on trackId
355
+ --out=<value> synonym for target
356
+ --target=<value> path to config file in JB2 installation directory to write out to.
357
+ Creates ./config.json if nonexistent
357
358
 
358
359
  DESCRIPTION
359
360
  Add a track configuration directly from a JSON hunk to the JBrowse 2 configuration
@@ -365,7 +366,7 @@ EXAMPLES
365
366
  ```
366
367
 
367
368
  _See code:
368
- [src/commands/add-track-json.ts](https://github.com/GMOD/jbrowse-components/blob/v2.7.2/products/jbrowse-cli/src/commands/add-track-json.ts)_
369
+ [src/commands/add-track-json.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/add-track-json.ts)_
369
370
 
370
371
  ## `jbrowse admin-server`
371
372
 
@@ -376,15 +377,16 @@ USAGE
376
377
  $ jbrowse admin-server [-p <value>] [--root <value>] [--bodySizeLimit <value>] [-h]
377
378
 
378
379
  FLAGS
379
- -h, --help Show CLI help.
380
- -p, --port=<value> Specifified port to start the server on;
381
- Default is 9090.
382
- --bodySizeLimit=<value> [default: 25mb] Size limit of the update message; may need to increase if config is large.
383
- Argument is passed to bytes library for parsing: https://www.npmjs.com/package/bytes.
384
- --root=<value> path to the root of the JB2 installation.
385
- Creates ./config.json if nonexistent. note that you can navigate to
386
- ?config=path/to/subconfig.json in the web browser and it will write to
387
- rootDir/path/to/subconfig.json
380
+ -h, --help Show CLI help.
381
+ -p, --port=<value> Specifified port to start the server on;
382
+ Default is 9090.
383
+ --bodySizeLimit=<value> [default: 25mb] Size limit of the update message; may need to increase if config is
384
+ large.
385
+ Argument is passed to bytes library for parsing: https://www.npmjs.com/package/bytes.
386
+ --root=<value> path to the root of the JB2 installation.
387
+ Creates ./config.json if nonexistent. note that you can navigate to
388
+ ?config=path/to/subconfig.json in the web browser and it will write to
389
+ rootDir/path/to/subconfig.json
388
390
 
389
391
  DESCRIPTION
390
392
  Start up a small admin server for JBrowse configuration
@@ -396,7 +398,7 @@ EXAMPLES
396
398
  ```
397
399
 
398
400
  _See code:
399
- [src/commands/admin-server.ts](https://github.com/GMOD/jbrowse-components/blob/v2.7.2/products/jbrowse-cli/src/commands/admin-server.ts)_
401
+ [src/commands/admin-server.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/admin-server.ts)_
400
402
 
401
403
  ## `jbrowse create LOCALPATH`
402
404
 
@@ -410,14 +412,14 @@ ARGUMENTS
410
412
  LOCALPATH Location where JBrowse 2 will be installed
411
413
 
412
414
  FLAGS
413
- -f, --force Overwrites existing JBrowse 2 installation if present in path
414
- -h, --help Show CLI help.
415
- -l, --listVersions Lists out all versions of JBrowse 2
416
- -t, --tag=<value> Version of JBrowse 2 to install. Format is v1.0.0.
417
- Defaults to latest
418
- -u, --url=<value> A direct URL to a JBrowse 2 release
419
- --branch=<value> Download a development build from a named git branch
420
- --nightly Download the latest development build from the main branch
415
+ -f, --force Overwrites existing JBrowse 2 installation if present in path
416
+ -h, --help Show CLI help.
417
+ -l, --listVersions Lists out all versions of JBrowse 2
418
+ -t, --tag=<value> Version of JBrowse 2 to install. Format is v1.0.0.
419
+ Defaults to latest
420
+ -u, --url=<value> A direct URL to a JBrowse 2 release
421
+ --branch=<value> Download a development build from a named git branch
422
+ --nightly Download the latest development build from the main branch
421
423
 
422
424
  DESCRIPTION
423
425
  Downloads and installs the latest JBrowse 2 release
@@ -453,7 +455,7 @@ EXAMPLES
453
455
  ```
454
456
 
455
457
  _See code:
456
- [src/commands/create.ts](https://github.com/GMOD/jbrowse-components/blob/v2.7.2/products/jbrowse-cli/src/commands/create.ts)_
458
+ [src/commands/create.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/create.ts)_
457
459
 
458
460
  ## `jbrowse help [COMMANDS]`
459
461
 
@@ -502,7 +504,7 @@ EXAMPLES
502
504
  ```
503
505
 
504
506
  _See code:
505
- [src/commands/remove-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.7.2/products/jbrowse-cli/src/commands/remove-track.ts)_
507
+ [src/commands/remove-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/remove-track.ts)_
506
508
 
507
509
  ## `jbrowse set-default-session`
508
510
 
@@ -522,10 +524,10 @@ FLAGS
522
524
  -v, --view=<value> View type in config to be added as default session, i.e LinearGenomeView, CircularView,
523
525
  DotplotView.
524
526
  Must be provided if no default session file provided
525
- --delete Delete any existing default session.
526
- --out=<value> synonym for target
527
- --target=<value> path to config file in JB2 installation directory to write out to
528
- --viewId=<value> Identifier for the view. Will be generated on default
527
+ --delete Delete any existing default session.
528
+ --out=<value> synonym for target
529
+ --target=<value> path to config file in JB2 installation directory to write out to
530
+ --viewId=<value> Identifier for the view. Will be generated on default
529
531
 
530
532
  DESCRIPTION
531
533
  Set a default session with views and tracks
@@ -541,7 +543,35 @@ EXAMPLES
541
543
  ```
542
544
 
543
545
  _See code:
544
- [src/commands/set-default-session.ts](https://github.com/GMOD/jbrowse-components/blob/v2.7.2/products/jbrowse-cli/src/commands/set-default-session.ts)_
546
+ [src/commands/set-default-session.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/set-default-session.ts)_
547
+
548
+ ## `jbrowse sort-gff FILE`
549
+
550
+ Helper utility to sort GFF files for tabix. Moves all lines starting with # to
551
+ the top of the file, and sort by refname and start position using unix utilities
552
+ sort and grep
553
+
554
+ ```
555
+ USAGE
556
+ $ jbrowse sort-gff FILE
557
+
558
+ ARGUMENTS
559
+ FILE GFF file
560
+
561
+ DESCRIPTION
562
+ Helper utility to sort GFF files for tabix. Moves all lines starting with # to the top of the file, and sort by
563
+ refname and start position using unix utilities sort and grep
564
+
565
+ EXAMPLES
566
+ # sort gff and pipe to bgzip
567
+
568
+ $ jbrowse sort-gff input.gff | bgzip > sorted.gff.gz
569
+
570
+ $ tabix sorted.gff.gz
571
+ ```
572
+
573
+ _See code:
574
+ [src/commands/sort-gff.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/sort-gff.ts)_
545
575
 
546
576
  ## `jbrowse text-index`
547
577
 
@@ -558,20 +588,20 @@ FLAGS
558
588
  assembly in the config
559
589
  -h, --help Show CLI help.
560
590
  -q, --quiet Hide the progress bars
561
- --attributes=<value> [default: Name,ID] Comma separated list of attributes to index
562
- --dryrun Just print out tracks that will be indexed by the process, without doing any indexing
563
- --exclude=<value> [default: CDS,exon] Adds gene type to list of excluded types
564
- --file=<value>... File or files to index (can be used to create trix indexes for embedded component use cases
591
+ --attributes=<value> [default: Name,ID] Comma separated list of attributes to index
592
+ --dryrun Just print out tracks that will be indexed by the process, without doing any indexing
593
+ --exclude=<value> [default: CDS,exon] Adds gene type to list of excluded types
594
+ --file=<value>... File or files to index (can be used to create trix indexes for embedded component use cases
565
595
  not using a config.json for example)
566
- --fileId=<value>... Set the trackId used for the indexes generated with the --file argument
567
- --force Overwrite previously existing indexes
568
- --out=<value> Synonym for target
569
- --perTrack If set, creates an index per track
570
- --prefixSize=<value> Specify the prefix size for the ixx index. We attempt to automatically calculate this, but
596
+ --fileId=<value>... Set the trackId used for the indexes generated with the --file argument
597
+ --force Overwrite previously existing indexes
598
+ --out=<value> Synonym for target
599
+ --perTrack If set, creates an index per track
600
+ --prefixSize=<value> Specify the prefix size for the ixx index. We attempt to automatically calculate this, but
571
601
  you can manually specify this too. If many genes have similar gene IDs e.g. Z000000001,
572
602
  Z000000002 the prefix size should be larger so that they get split into different bins
573
- --target=<value> Path to config file in JB2 installation directory to read from.
574
- --tracks=<value> Specific tracks to index, formatted as comma separated trackIds. If unspecified, indexes all
603
+ --target=<value> Path to config file in JB2 installation directory to read from.
604
+ --tracks=<value> Specific tracks to index, formatted as comma separated trackIds. If unspecified, indexes all
575
605
  available tracks
576
606
 
577
607
  DESCRIPTION
@@ -608,7 +638,7 @@ EXAMPLES
608
638
  ```
609
639
 
610
640
  _See code:
611
- [src/commands/text-index.ts](https://github.com/GMOD/jbrowse-components/blob/v2.7.2/products/jbrowse-cli/src/commands/text-index.ts)_
641
+ [src/commands/text-index.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/text-index.ts)_
612
642
 
613
643
  ## `jbrowse upgrade [LOCALPATH]`
614
644
 
@@ -622,14 +652,14 @@ ARGUMENTS
622
652
  LOCALPATH [default: .] Location where JBrowse 2 is installed
623
653
 
624
654
  FLAGS
625
- -h, --help Show CLI help.
626
- -l, --listVersions Lists out all versions of JBrowse 2
627
- -t, --tag=<value> Version of JBrowse 2 to install. Format is v1.0.0.
628
- Defaults to latest
629
- -u, --url=<value> A direct URL to a JBrowse 2 release
630
- --branch=<value> Download a development build from a named git branch
631
- --clean Removes old js,map,and LICENSE files in the installation
632
- --nightly Download the latest development build from the main branch
655
+ -h, --help Show CLI help.
656
+ -l, --listVersions Lists out all versions of JBrowse 2
657
+ -t, --tag=<value> Version of JBrowse 2 to install. Format is v1.0.0.
658
+ Defaults to latest
659
+ -u, --url=<value> A direct URL to a JBrowse 2 release
660
+ --branch=<value> Download a development build from a named git branch
661
+ --clean Removes old js,map,and LICENSE files in the installation
662
+ --nightly Download the latest development build from the main branch
633
663
 
634
664
  DESCRIPTION
635
665
  Upgrades JBrowse 2 to latest version
@@ -671,7 +701,7 @@ EXAMPLES
671
701
  ```
672
702
 
673
703
  _See code:
674
- [src/commands/upgrade.ts](https://github.com/GMOD/jbrowse-components/blob/v2.7.2/products/jbrowse-cli/src/commands/upgrade.ts)_
704
+ [src/commands/upgrade.ts](https://github.com/GMOD/jbrowse-components/blob/v2.9.0/products/jbrowse-cli/src/commands/upgrade.ts)_
675
705
 
676
706
  <!-- commandsstop -->
677
707
 
@@ -27,6 +27,34 @@ function makeLocationProtocol(protocol) {
27
27
  throw new Error(`invalid protocol ${protocol}`);
28
28
  };
29
29
  }
30
+ function fileOperation({ srcFilename, destFilename, mode, }) {
31
+ if (mode === 'copy') {
32
+ return copyFile(srcFilename, destFilename, COPYFILE_EXCL);
33
+ }
34
+ else if (mode === 'move') {
35
+ return rename(srcFilename, destFilename);
36
+ }
37
+ else if (mode === 'symlink') {
38
+ return symlink(path_1.default.resolve(srcFilename), destFilename);
39
+ }
40
+ return undefined;
41
+ }
42
+ // get path of destination, and remove file at that path if it exists and force
43
+ // is set
44
+ function destinationFn({ destinationDir, srcFilename, subDir, force, }) {
45
+ const dest = path_1.default.resolve(path_1.default.join(destinationDir, subDir, path_1.default.basename(srcFilename)));
46
+ if (force) {
47
+ try {
48
+ fs_1.default.unlinkSync(dest);
49
+ }
50
+ catch (e) {
51
+ /* unconditionally unlinkSync, due to
52
+ * https://github.com/nodejs/node/issues/14025#issuecomment-754021370
53
+ * and https://github.com/GMOD/jbrowse-components/issues/2768 */
54
+ }
55
+ }
56
+ return dest;
57
+ }
30
58
  const isUrl = (loc) => loc?.match(/^https?:\/\//);
31
59
  class AddTrack extends base_1.default {
32
60
  async run() {
@@ -37,12 +65,12 @@ class AddTrack extends base_1.default {
37
65
  const isDir = fs_1.default.lstatSync(output).isDirectory();
38
66
  this.target = isDir ? `${output}/config.json` : output;
39
67
  let { trackType, trackId, name, assemblyNames } = runFlags;
40
- const configDirectory = path_1.default.dirname(this.target);
68
+ const configDir = path_1.default.dirname(this.target);
41
69
  if (!argsTrack) {
42
70
  this.error('No track provided. Example usage: jbrowse add-track yourfile.bam', { exit: 120 });
43
71
  }
44
72
  if (subDir) {
45
- const dir = path_1.default.join(configDirectory, subDir);
73
+ const dir = path_1.default.join(configDir, subDir);
46
74
  if (!fs_1.default.existsSync(dir)) {
47
75
  fs_1.default.mkdirSync(dir);
48
76
  }
@@ -124,7 +152,7 @@ class AddTrack extends base_1.default {
124
152
  if (!configContents.tracks) {
125
153
  configContents.tracks = [];
126
154
  }
127
- const idx = configContents.tracks.findIndex(configTrack => configTrack.trackId === trackId);
155
+ const idx = configContents.tracks.findIndex(c => c.trackId === trackId);
128
156
  if (idx !== -1) {
129
157
  this.debug(`Found existing trackId ${trackId} in configuration`);
130
158
  if (force || overwrite) {
@@ -138,34 +166,20 @@ class AddTrack extends base_1.default {
138
166
  else {
139
167
  configContents.tracks.push(trackConfig);
140
168
  }
141
- // get path of destination, and remove file at that path if it exists and
142
- // force is set
143
- const destinationFn = (dir, file) => {
144
- const dest = path_1.default.resolve(path_1.default.join(dir, subDir, path_1.default.basename(file)));
145
- if (force) {
146
- try {
147
- fs_1.default.unlinkSync(dest);
148
- }
149
- catch (e) {
150
- /* unconditionally unlinkSync, due to
151
- * https://github.com/nodejs/node/issues/14025#issuecomment-754021370
152
- * and https://github.com/GMOD/jbrowse-components/issues/2768 */
153
- }
154
- }
155
- return dest;
156
- };
157
- const loadType = load || 'inPlace';
158
- const callbacks = {
159
- copy: (src, dest) => copyFile(src, dest, COPYFILE_EXCL),
160
- move: (src, dest) => rename(src, dest),
161
- symlink: (src, dest) => symlink(path_1.default.resolve(src), dest),
162
- inPlace: () => {
163
- /* do nothing */
164
- },
165
- };
166
- await Promise.all(Object.values(this.guessFileNames({ location, index, bed1, bed2 }))
167
- .filter(f => !!f)
168
- .map(src => callbacks[loadType](src, destinationFn(configDirectory, src))));
169
+ if (load && load !== 'inPlace') {
170
+ await Promise.all(Object.values(this.guessFileNames({ location, index, bed1, bed2 }))
171
+ .filter(f => !!f)
172
+ .map(srcFilename => fileOperation({
173
+ mode: load,
174
+ srcFilename,
175
+ destFilename: destinationFn({
176
+ destinationDir: configDir,
177
+ srcFilename,
178
+ force,
179
+ subDir,
180
+ }),
181
+ })));
182
+ }
169
183
  this.debug(`Writing configuration to file ${this.target}`);
170
184
  await this.writeJsonFile(this.target, configContents);
171
185
  this.log(`${idx !== -1 ? 'Overwrote' : 'Added'} track with name "${name}" and trackId "${trackId}" ${idx !== -1 ? 'in' : 'to'} ${this.target}`);
@@ -212,18 +226,19 @@ class AddTrack extends base_1.default {
212
226
  };
213
227
  }
214
228
  else if (/\.2bit$/i.test(location) ||
229
+ /\.bedpe(\.gz)?$/i.test(location) ||
215
230
  /\/trackData.jsonz?$/i.test(location) ||
216
231
  /\/sparql$/i.test(location) ||
217
- /\.out(.gz)?$/i.test(location) ||
218
- /\.paf(.gz)?$/i.test(location) ||
219
- /\.delta(.gz)?$/i.test(location) ||
232
+ /\.out(\.gz)?$/i.test(location) ||
233
+ /\.paf(\.gz)?$/i.test(location) ||
234
+ /\.delta(\.gz)?$/i.test(location) ||
220
235
  /\.bed?$/i.test(location) ||
221
236
  /\.(bw|bigwig)$/i.test(location) ||
222
237
  /\.(bb|bigbed)$/i.test(location) ||
223
238
  /\.vcf$/i.test(location) ||
224
239
  /\.gtf?$/i.test(location) ||
225
240
  /\.gff3?$/i.test(location) ||
226
- /\.chain(.gz)?$/i.test(location)) {
241
+ /\.chain(\.gz)?$/i.test(location)) {
227
242
  return {
228
243
  file: location,
229
244
  };
@@ -293,6 +308,12 @@ class AddTrack extends base_1.default {
293
308
  type: 'UNSUPPORTED',
294
309
  };
295
310
  }
311
+ else if (/\.bedpe(.gz)?$/i.test(location)) {
312
+ return {
313
+ type: 'BedpeAdapter',
314
+ bedpeLocation: makeLocation(location),
315
+ };
316
+ }
296
317
  else if (/\.bed$/i.test(location)) {
297
318
  return {
298
319
  type: 'BedAdapter',
@@ -419,6 +440,7 @@ class AddTrack extends base_1.default {
419
440
  TwoBitAdapter: 'ReferenceSequenceTrack',
420
441
  VcfTabixAdapter: 'VariantTrack',
421
442
  VcfAdapter: 'VariantTrack',
443
+ BedpeAdapter: 'VariantTrack',
422
444
  BedAdapter: 'FeatureTrack',
423
445
  HicAdapter: 'HicTrack',
424
446
  PAFAdapter: 'SyntenyTrack',
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const core_1 = require("@oclif/core");
7
+ const command_exists_1 = require("command-exists");
8
+ const child_process_1 = require("child_process");
9
+ const base_1 = __importDefault(require("../base"));
10
+ class SortGff extends base_1.default {
11
+ async run() {
12
+ const { args: { file }, } = await this.parse(SortGff);
13
+ if ((0, command_exists_1.sync)('sh') &&
14
+ (0, command_exists_1.sync)('sort') &&
15
+ (0, command_exists_1.sync)('grep')) {
16
+ // this command comes from the tabix docs http://www.htslib.org/doc/tabix.html
17
+ (0, child_process_1.spawn)('sh', [
18
+ '-c',
19
+ `(grep "^#" "${file}"; grep -v "^#" "${file}" | sort -t"\`printf '\t'\`" -k1,1 -k4,4n)`,
20
+ ], {
21
+ env: { ...process.env, LC_ALL: 'C' },
22
+ stdio: 'inherit',
23
+ });
24
+ }
25
+ else {
26
+ throw new Error('Unable to sort, requires unix type environment with sort, grep');
27
+ }
28
+ }
29
+ }
30
+ SortGff.description = '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';
31
+ SortGff.examples = [
32
+ '# sort gff and pipe to bgzip',
33
+ '$ jbrowse sort-gff input.gff | bgzip > sorted.gff.gz',
34
+ '$ tabix sorted.gff.gz',
35
+ ];
36
+ SortGff.args = {
37
+ file: core_1.Args.string({
38
+ required: true,
39
+ description: `GFF file`,
40
+ }),
41
+ };
42
+ exports.default = SortGff;
@@ -827,6 +827,36 @@
827
827
  "set-default-session.js"
828
828
  ]
829
829
  },
830
+ "sort-gff": {
831
+ "aliases": [],
832
+ "args": {
833
+ "file": {
834
+ "description": "GFF file",
835
+ "name": "file",
836
+ "required": true
837
+ }
838
+ },
839
+ "description": "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",
840
+ "examples": [
841
+ "# sort gff and pipe to bgzip",
842
+ "$ jbrowse sort-gff input.gff | bgzip > sorted.gff.gz",
843
+ "$ tabix sorted.gff.gz"
844
+ ],
845
+ "flags": {},
846
+ "hasDynamicHelp": false,
847
+ "hiddenAliases": [],
848
+ "id": "sort-gff",
849
+ "pluginAlias": "@jbrowse/cli",
850
+ "pluginName": "@jbrowse/cli",
851
+ "pluginType": "core",
852
+ "strict": true,
853
+ "isESM": false,
854
+ "relativePath": [
855
+ "lib",
856
+ "commands",
857
+ "sort-gff.js"
858
+ ]
859
+ },
830
860
  "text-index": {
831
861
  "aliases": [],
832
862
  "args": {},
@@ -1057,5 +1087,5 @@
1057
1087
  ]
1058
1088
  }
1059
1089
  },
1060
- "version": "2.7.2"
1090
+ "version": "2.9.0"
1061
1091
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/cli",
3
- "version": "2.7.2",
3
+ "version": "2.9.0",
4
4
  "description": "A command line tool for working with JBrowse 2",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -50,6 +50,7 @@
50
50
  "boxen": "^4.2.0",
51
51
  "chalk": "^4.1.0",
52
52
  "cli-progress": "^3.9.0",
53
+ "command-exists": "^1.2.9",
53
54
  "cors": "^2.8.5",
54
55
  "decompress": "^4.0.0",
55
56
  "express": "^4.17.1",
@@ -74,5 +75,5 @@
74
75
  "publishConfig": {
75
76
  "access": "public"
76
77
  },
77
- "gitHead": "9052b295f2d322e729254457ed9fe2231fb22cce"
78
+ "gitHead": "a50b6f67cf8c8f3c65a7b8cd858de2fcca1f2909"
78
79
  }