@jbrowse/cli 5.0.0-beta.2 → 5.0.0-beta.4

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
@@ -264,9 +264,9 @@ Options:
264
264
  -a, --assemblyNames Assembly name or names for track as comma separated
265
265
  string. For pairwise synteny tracks the order is
266
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
267
+ order); for the multi-genome PAF adapters
268
+ (MultiGenomePAFAdapter/MultiGenomeIndexedPAFAdapter)
269
+ list every assembly the file covers, in any order
270
270
 
271
271
  --category Optional comma separated string of categories to
272
272
  group tracks
@@ -352,10 +352,10 @@ Gff3TabixAdapter, GtfTabixAdapter, BedTabixAdapter, BigBedAdapter,
352
352
  VcfTabixAdapter and SplitVcfTabixAdapter.
353
353
 
354
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.
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, since one multi-genome
358
+ file backs every pair.
359
359
 
360
360
  Examples:
361
361
 
@@ -564,6 +564,9 @@ Options:
564
564
  -p, --port Specified port to start the server on (default:
565
565
  9090)
566
566
 
567
+ --host Interface to bind to (default: 127.0.0.1). Use
568
+ 0.0.0.0 to accept connections from other machines
569
+
567
570
  --root Path to the root of the JB2 installation
568
571
 
569
572
  --bodySizeLimit Size limit of the update message (default: 25mb)
@@ -571,9 +574,10 @@ Options:
571
574
  Notes:
572
575
 
573
576
  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
+ disk, authorized by a one-time key printed in the startup URL. It binds to
578
+ 127.0.0.1 so only this machine can reach it. The key gates the config routes,
579
+ but the rest of the JBrowse directory is served unauthenticated, so widen --host
580
+ only on a trusted network.
577
581
 
578
582
  Examples:
579
583
 
@@ -588,6 +592,9 @@ $ jbrowse admin-server --root /path/to/jb2/
588
592
 
589
593
  # raise the body size limit for very large config updates
590
594
  $ jbrowse admin-server --bodySizeLimit 100mb
595
+
596
+ # accept connections from other machines on the network
597
+ $ jbrowse admin-server --host 0.0.0.0
591
598
  ```
592
599
 
593
600
 
@@ -39,7 +39,7 @@ export async function run(args) {
39
39
  assemblyNames: {
40
40
  type: 'string',
41
41
  short: 'a',
42
- description: 'Assembly name or names for track as comma separated string. For pairwise synteny tracks the order is query,target (reverse of minimap2/nucmer argument order); for all-vs-all adapters (AllVsAllPAFAdapter/AllVsAllIndexedPAFAdapter) list every assembly the file covers, in any order',
42
+ description: 'Assembly name or names for track as comma separated string. For pairwise synteny tracks the order is query,target (reverse of minimap2/nucmer argument order); for the multi-genome PAF adapters (MultiGenomePAFAdapter/MultiGenomeIndexedPAFAdapter) list every assembly the file covers, in any order',
43
43
  },
44
44
  category: {
45
45
  type: 'string',
@@ -147,9 +147,9 @@ export async function run(args) {
147
147
  'BigBedAdapter, VcfTabixAdapter and SplitVcfTabixAdapter.\n\n' +
148
148
  'For pairwise synteny adapters (PAF/Delta/Chain) --assemblyNames is ' +
149
149
  'query,target — the reverse of the minimap2/nucmer input order. For the ' +
150
- 'all-vs-all adapters (AllVsAllPAFAdapter, AllVsAllIndexedPAFAdapter) it is ' +
150
+ 'multi-genome PAF adapters (MultiGenomePAFAdapter, MultiGenomeIndexedPAFAdapter) it is ' +
151
151
  'instead the full list of assemblies the file covers, in any order, since ' +
152
- 'one all-vs-all file backs every pair.';
152
+ 'one multi-genome file backs every pair.';
153
153
  const examples = [
154
154
  '# copy /path/to/my.bam and /path/to/my.bam.bai to current directory and adds track to config.json',
155
155
  '$ jbrowse add-track /path/to/my.bam --load copy',
@@ -13,6 +13,11 @@ export async function run(args) {
13
13
  short: 'p',
14
14
  description: 'Specified port to start the server on (default: 9090)',
15
15
  },
16
+ host: {
17
+ type: 'string',
18
+ description: 'Interface to bind to (default: 127.0.0.1). Use 0.0.0.0 to accept ' +
19
+ 'connections from other machines',
20
+ },
16
21
  root: {
17
22
  type: 'string',
18
23
  description: 'Path to the root of the JB2 installation',
@@ -40,12 +45,15 @@ export async function run(args) {
40
45
  '',
41
46
  '# raise the body size limit for very large config updates',
42
47
  '$ jbrowse admin-server --bodySizeLimit 100mb',
48
+ '',
49
+ '# accept connections from other machines on the network',
50
+ '$ jbrowse admin-server --host 0.0.0.0',
43
51
  ];
44
52
  const notes = 'The admin-server lets a browser session write changes back to ' +
45
53
  'config.json on disk, authorized by a one-time key printed in the ' +
46
- 'startup URL. It is meant for local configuration only: run it on a ' +
47
- 'trusted machine and do not expose the port to untrusted networks or the ' +
48
- 'public internet.';
54
+ 'startup URL. It binds to 127.0.0.1 so only this machine can reach it. ' +
55
+ 'The key gates the config routes, but the rest of the JBrowse directory ' +
56
+ 'is served unauthenticated, so widen --host only on a trusted network.';
49
57
  if (flags.help) {
50
58
  printHelp({
51
59
  description,
@@ -56,7 +64,7 @@ export async function run(args) {
56
64
  });
57
65
  return;
58
66
  }
59
- const { root, bodySizeLimit = '25mb' } = flags;
67
+ const { root, host, bodySizeLimit = '25mb' } = flags;
60
68
  const { outFile, baseDir } = await setupConfigFile({ root });
61
69
  const port = parsePort({ portStr: flags.port });
62
70
  // the key lives only in this process and in the startup URL printed below. It
@@ -71,5 +79,5 @@ export async function run(args) {
71
79
  serverRef,
72
80
  bodySizeLimit: parseByteLimit(bodySizeLimit),
73
81
  }));
74
- startServer({ server, port, key, outFile, serverRef });
82
+ startServer({ server, port, host, key, outFile, serverRef });
75
83
  }
@@ -4,6 +4,9 @@ import path from 'node:path';
4
4
  import handler from 'serve-handler';
5
5
  import { debug, isRecord, resolveConfigPath, writeJsonFile, } from '../../utils.js';
6
6
  import { createDefaultConfig } from '../add-assembly/utils.js';
7
+ // Loopback, so the unauthenticated static handler below does not serve the
8
+ // data directory to every host on the network. `--host` opts out.
9
+ export const DEFAULT_HOST = '127.0.0.1';
7
10
  export function parsePort({ portStr, defaultPort = 9090, }) {
8
11
  if (!portStr) {
9
12
  return defaultPort;
@@ -122,9 +125,8 @@ function sendText(res, status, body) {
122
125
  res.writeHead(status, { 'Content-Type': 'text/plain; charset=utf-8' });
123
126
  res.end(body);
124
127
  }
125
- // What `cors()` sent. The server binds to localhost for a browser tab on the
126
- // same machine to talk to, and the admin key is what authorizes a write — the
127
- // origin never was.
128
+ // What `cors()` sent. The admin key is what authorizes a write; the origin
129
+ // never was.
128
130
  function applyCorsHeaders(res) {
129
131
  res.setHeader('Access-Control-Allow-Origin', '*');
130
132
  res.setHeader('Access-Control-Allow-Methods', 'GET, HEAD, POST, OPTIONS');
@@ -278,9 +280,9 @@ export function createRequestHandler({ baseDir, outFile, key, serverRef, bodySiz
278
280
  }
279
281
  };
280
282
  }
281
- export function startServer({ server, port, key, outFile, serverRef, }) {
282
- server.listen(port, () => {
283
- console.log(`Admin server started on port ${port}\n\n` +
283
+ export function startServer({ server, port, host = DEFAULT_HOST, key, outFile, serverRef, }) {
284
+ server.listen(port, host, () => {
285
+ console.log(`Admin server started on ${host}:${port}\n\n` +
284
286
  `To access the admin interface, open your browser to:\n` +
285
287
  `http://localhost:${port}?adminKey=${key}\n\n` +
286
288
  `Admin key: ${key}\n` +
@@ -159,7 +159,7 @@ export async function run(args) {
159
159
  }
160
160
  const nextCommand = samples.size > 0
161
161
  ? 'Next, add it as an all-vs-all synteny track (PanSN names detected):\n' +
162
- ` jbrowse add-track ${outputFile} --adapterType AllVsAllIndexedPAFAdapter -a ${[...samples].sort().join(',')} --load copy`
162
+ ` jbrowse add-track ${outputFile} --adapterType MultiGenomeIndexedPAFAdapter -a ${[...samples].sort().join(',')} --load copy`
163
163
  : 'Next, add it as a synteny track (set -a to your query,target assembly names):\n' +
164
164
  ` jbrowse add-track ${outputFile} -a query,target --load copy`;
165
165
  console.log(`Created ${outputFile} and ${indexFile}\n\n${nextCommand}`);
@@ -12,10 +12,6 @@ export function createTrixAdapter(name, assemblyNames, idSuffix = 'index') {
12
12
  uri: uris.ixx,
13
13
  locationType: 'UriLocation',
14
14
  },
15
- metaFilePath: {
16
- uri: uris.meta,
17
- locationType: 'UriLocation',
18
- },
19
15
  assemblyNames,
20
16
  };
21
17
  }