@jbrowse/cli 2.6.2 → 2.7.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 +274 -206
- package/bin/dev +17 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +6 -3
- package/lib/base.js +32 -80
- package/lib/commands/add-assembly.js +29 -27
- package/lib/commands/add-connection.js +43 -37
- package/lib/commands/add-track-json.js +9 -10
- package/lib/commands/add-track.js +74 -73
- package/lib/commands/admin-server.js +7 -7
- package/lib/commands/create.js +14 -16
- package/lib/commands/remove-track.js +9 -11
- package/lib/commands/set-default-session.js +14 -17
- package/lib/commands/text-index.js +86 -101
- package/lib/commands/upgrade.js +13 -14
- package/lib/fetchWithProxy.js +1 -1
- package/lib/index.js +2 -2
- package/lib/types/common.js +2 -2
- package/lib/types/gff3Adapter.js +54 -88
- package/lib/types/vcfAdapter.js +58 -93
- package/oclif.manifest.json +918 -1
- package/package.json +10 -12
package/bin/dev
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const oclif = require('@oclif/core')
|
|
4
|
+
|
|
5
|
+
const path = require('path')
|
|
6
|
+
const project = path.join(__dirname, '..', 'tsconfig.json')
|
|
7
|
+
|
|
8
|
+
// In dev mode -> use ts-node and dev plugins
|
|
9
|
+
process.env.NODE_ENV = 'development'
|
|
10
|
+
|
|
11
|
+
require('ts-node').register({ project })
|
|
12
|
+
|
|
13
|
+
// In dev mode, always show stack traces
|
|
14
|
+
oclif.settings.debug = true
|
|
15
|
+
|
|
16
|
+
// Start the CLI
|
|
17
|
+
oclif.run().then(oclif.flush).catch(oclif.Errors.handle)
|
package/bin/dev.cmd
ADDED
package/bin/run
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
require('@oclif/
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const oclif = require('@oclif/core')
|
|
4
|
+
|
|
5
|
+
oclif
|
|
6
|
+
.run()
|
|
7
|
+
.then(require('@oclif/core/flush'))
|
|
8
|
+
.catch(require('@oclif/core/handle'))
|
package/lib/base.js
CHANGED
|
@@ -2,35 +2,16 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* By convention, exit codes in this base class are below 100
|
|
4
4
|
*/
|
|
5
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
6
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
7
|
-
var m = o[Symbol.asyncIterator], i;
|
|
8
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
9
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
10
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
11
|
-
};
|
|
12
|
-
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
13
|
-
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
14
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
15
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
16
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
17
|
-
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
18
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
19
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
20
|
-
function fulfill(value) { resume("next", value); }
|
|
21
|
-
function reject(value) { resume("throw", value); }
|
|
22
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
23
|
-
};
|
|
24
5
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
6
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
7
|
};
|
|
27
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
const
|
|
9
|
+
const core_1 = require("@oclif/core");
|
|
29
10
|
const fs_1 = require("fs");
|
|
30
11
|
const path_1 = __importDefault(require("path"));
|
|
31
12
|
const json_parse_better_errors_1 = __importDefault(require("json-parse-better-errors"));
|
|
32
13
|
const fetchWithProxy_1 = __importDefault(require("./fetchWithProxy"));
|
|
33
|
-
class JBrowseCommand extends
|
|
14
|
+
class JBrowseCommand extends core_1.Command {
|
|
34
15
|
async init() { }
|
|
35
16
|
async readFile(location) {
|
|
36
17
|
return fs_1.promises.readFile(location, { encoding: 'utf8' });
|
|
@@ -115,80 +96,51 @@ class JBrowseCommand extends command_1.default {
|
|
|
115
96
|
return result;
|
|
116
97
|
}
|
|
117
98
|
async fetchGithubVersions() {
|
|
118
|
-
var _a, e_1, _b, _c;
|
|
119
99
|
let versions = [];
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
_c = _f.value;
|
|
123
|
-
_d = false;
|
|
124
|
-
const iter = _c;
|
|
125
|
-
versions = [...versions, ...iter];
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
129
|
-
finally {
|
|
130
|
-
try {
|
|
131
|
-
if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
|
|
132
|
-
}
|
|
133
|
-
finally { if (e_1) throw e_1.error; }
|
|
100
|
+
for await (const iter of this.fetchVersions()) {
|
|
101
|
+
versions = [...versions, ...iter];
|
|
134
102
|
}
|
|
135
103
|
return versions;
|
|
136
104
|
}
|
|
137
105
|
async getLatest() {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
.filter(release => release.assets && release.assets.length > 0);
|
|
150
|
-
if (nonprereleases.length > 0) {
|
|
151
|
-
// @ts-expect-error
|
|
152
|
-
const file = (_d = nonprereleases[0].assets.find(f => f.name.includes('jbrowse-web'))) === null || _d === void 0 ? void 0 : _d.browser_download_url;
|
|
153
|
-
if (!file) {
|
|
154
|
-
throw new Error('no jbrowse-web download found');
|
|
155
|
-
}
|
|
156
|
-
return file;
|
|
106
|
+
for await (const versions of this.fetchVersions()) {
|
|
107
|
+
// if a release was just uploaded, or an erroneous build was made
|
|
108
|
+
// then it might have no build asset
|
|
109
|
+
const nonprereleases = versions
|
|
110
|
+
.filter(release => release.prerelease === false)
|
|
111
|
+
.filter(release => release.assets && release.assets.length > 0);
|
|
112
|
+
if (nonprereleases.length > 0) {
|
|
113
|
+
// @ts-expect-error
|
|
114
|
+
const file = nonprereleases[0].assets.find(f => f.name.includes('jbrowse-web'))?.browser_download_url;
|
|
115
|
+
if (!file) {
|
|
116
|
+
throw new Error('no jbrowse-web download found');
|
|
157
117
|
}
|
|
118
|
+
return file;
|
|
158
119
|
}
|
|
159
120
|
}
|
|
160
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
161
|
-
finally {
|
|
162
|
-
try {
|
|
163
|
-
if (!_e && !_a && (_b = _f.return)) await _b.call(_f);
|
|
164
|
-
}
|
|
165
|
-
finally { if (e_2) throw e_2.error; }
|
|
166
|
-
}
|
|
167
121
|
throw new Error('no version tags found');
|
|
168
122
|
}
|
|
169
|
-
fetchVersions() {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
} while (result && result.length > 0);
|
|
184
|
-
});
|
|
123
|
+
async *fetchVersions() {
|
|
124
|
+
let page = 1;
|
|
125
|
+
let result;
|
|
126
|
+
do {
|
|
127
|
+
const response = await (0, fetchWithProxy_1.default)(`https://api.github.com/repos/GMOD/jbrowse-components/releases?page=${page}`);
|
|
128
|
+
if (response.ok) {
|
|
129
|
+
result = (await response.json());
|
|
130
|
+
yield result.filter(release => release.tag_name.startsWith('v'));
|
|
131
|
+
page++;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
throw new Error(`${response.statusText}`);
|
|
135
|
+
}
|
|
136
|
+
} while (result && result.length > 0);
|
|
185
137
|
}
|
|
186
138
|
async getTag(tag) {
|
|
187
|
-
var _a, _b;
|
|
188
139
|
const response = await (0, fetchWithProxy_1.default)(`https://api.github.com/repos/GMOD/jbrowse-components/releases/tags/${tag}`);
|
|
189
140
|
if (response.ok) {
|
|
190
141
|
const result = (await response.json());
|
|
191
|
-
const file =
|
|
142
|
+
const file = result?.assets?.find(f => f.name.includes('jbrowse-web'))
|
|
143
|
+
?.browser_download_url;
|
|
192
144
|
if (!file) {
|
|
193
145
|
this.error('Could not find version specified. Use --listVersions to see all available versions', { exit: 90 });
|
|
194
146
|
}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const base_1 = __importDefault(require("../base"));
|
|
@@ -20,7 +20,7 @@ function isValidJSON(string) {
|
|
|
20
20
|
class AddAssembly extends base_1.default {
|
|
21
21
|
async getAssembly() {
|
|
22
22
|
let sequence;
|
|
23
|
-
const { args: runArgs, flags: runFlags } = this.parse(AddAssembly);
|
|
23
|
+
const { args: runArgs, flags: runFlags } = await this.parse(AddAssembly);
|
|
24
24
|
const { sequence: argsSequence } = runArgs;
|
|
25
25
|
if (this.needLoadData(argsSequence) && !runFlags.load) {
|
|
26
26
|
this.error(`Please specify the loading operation for this file with --load copy|symlink|move|inPlace`, { exit: 110 });
|
|
@@ -193,7 +193,7 @@ class AddAssembly extends base_1.default {
|
|
|
193
193
|
async run() {
|
|
194
194
|
// https://stackoverflow.com/a/35008327/2129219
|
|
195
195
|
const exists = (s) => new Promise(r => fs_1.default.access(s, fs_1.default.constants.F_OK, e => r(!e)));
|
|
196
|
-
const { args: runArgs, flags: runFlags } = this.parse(AddAssembly);
|
|
196
|
+
const { args: runArgs, flags: runFlags } = await this.parse(AddAssembly);
|
|
197
197
|
const output = runFlags.target || runFlags.out || '.';
|
|
198
198
|
if (!(await exists(output))) {
|
|
199
199
|
const dir = output.endsWith('.json') ? path_1.default.dirname(output) : output;
|
|
@@ -209,7 +209,7 @@ class AddAssembly extends base_1.default {
|
|
|
209
209
|
this.debug(`Sequence location is: ${argsSequence}`);
|
|
210
210
|
const { name } = runFlags;
|
|
211
211
|
const assembly = await this.getAssembly();
|
|
212
|
-
if (runFlags.alias
|
|
212
|
+
if (runFlags.alias?.length) {
|
|
213
213
|
this.debug(`Adding assembly aliases: ${runFlags.alias}`);
|
|
214
214
|
assembly.aliases = runFlags.alias;
|
|
215
215
|
}
|
|
@@ -261,11 +261,14 @@ class AddAssembly extends base_1.default {
|
|
|
261
261
|
let configContents;
|
|
262
262
|
if (fs_1.default.existsSync(this.target)) {
|
|
263
263
|
this.debug(`Found existing config file ${this.target}`);
|
|
264
|
-
configContents =
|
|
264
|
+
configContents = {
|
|
265
|
+
...defaultConfig,
|
|
266
|
+
...(await this.readJsonFile(this.target)),
|
|
267
|
+
};
|
|
265
268
|
}
|
|
266
269
|
else {
|
|
267
270
|
this.debug(`Creating config file ${this.target}`);
|
|
268
|
-
configContents =
|
|
271
|
+
configContents = { ...defaultConfig };
|
|
269
272
|
}
|
|
270
273
|
if (!configContents.assemblies) {
|
|
271
274
|
configContents.assemblies = [];
|
|
@@ -399,9 +402,8 @@ AddAssembly.examples = [
|
|
|
399
402
|
'# add a bgzip indexed fasta inferred by fa.gz extension. assumes .fa.gz.gzi and .fa.gz.fai files also exists',
|
|
400
403
|
'$ jbrowse add-assembly myfile.fa.gz --load copy',
|
|
401
404
|
];
|
|
402
|
-
AddAssembly.args =
|
|
403
|
-
{
|
|
404
|
-
name: 'sequence',
|
|
405
|
+
AddAssembly.args = {
|
|
406
|
+
sequence: core_1.Args.string({
|
|
405
407
|
required: true,
|
|
406
408
|
description: `sequence file or URL
|
|
407
409
|
|
|
@@ -409,10 +411,10 @@ If TYPE is indexedFasta or bgzipFasta, the index file defaults to <location>.fai
|
|
|
409
411
|
and can be optionally specified with --faiLocation
|
|
410
412
|
If TYPE is bgzipFasta, the gzip index file defaults to <location>.gzi and can be
|
|
411
413
|
optionally specified with --gziLocation`,
|
|
412
|
-
},
|
|
413
|
-
|
|
414
|
+
}),
|
|
415
|
+
};
|
|
414
416
|
AddAssembly.flags = {
|
|
415
|
-
type:
|
|
417
|
+
type: core_1.Flags.string({
|
|
416
418
|
char: 't',
|
|
417
419
|
description: `type of sequence, by default inferred from sequence file
|
|
418
420
|
|
|
@@ -430,54 +432,54 @@ custom Either a JSON file location or inline JSON that defines a custom
|
|
|
430
432
|
sequence adapter; must provide --name if using inline JSON`,
|
|
431
433
|
options: ['indexedFasta', 'bgzipFasta', 'twoBit', 'chromSizes', 'custom'],
|
|
432
434
|
}),
|
|
433
|
-
name:
|
|
435
|
+
name: core_1.Flags.string({
|
|
434
436
|
char: 'n',
|
|
435
437
|
description: 'Name of the assembly; if not specified, will be guessed using the sequence file name',
|
|
436
438
|
}),
|
|
437
|
-
alias:
|
|
439
|
+
alias: core_1.Flags.string({
|
|
438
440
|
char: 'a',
|
|
439
441
|
description: 'An alias for the assembly name (e.g. "hg38" if the name of the assembly is "GRCh38");\ncan be specified multiple times',
|
|
440
442
|
multiple: true,
|
|
441
443
|
}),
|
|
442
|
-
displayName:
|
|
444
|
+
displayName: core_1.Flags.string({
|
|
443
445
|
description: 'The display name to specify for the assembly, e.g. "Homo sapiens (hg38)" while the name can be a shorter identifier like "hg38"',
|
|
444
446
|
}),
|
|
445
|
-
faiLocation:
|
|
447
|
+
faiLocation: core_1.Flags.string({
|
|
446
448
|
description: '[default: <fastaLocation>.fai] FASTA index file or URL',
|
|
447
449
|
}),
|
|
448
|
-
gziLocation:
|
|
450
|
+
gziLocation: core_1.Flags.string({
|
|
449
451
|
description: '[default: <fastaLocation>.gzi] FASTA gzip index file or URL',
|
|
450
452
|
}),
|
|
451
|
-
refNameAliases:
|
|
453
|
+
refNameAliases: core_1.Flags.string({
|
|
452
454
|
description: 'Reference sequence name aliases file or URL; assumed to be a tab-separated aliases\nfile unless --refNameAliasesType is specified',
|
|
453
455
|
}),
|
|
454
|
-
refNameAliasesType:
|
|
456
|
+
refNameAliasesType: core_1.Flags.string({
|
|
455
457
|
description: 'Type of aliases defined by --refNameAliases; if "custom", --refNameAliases is either\na JSON file location or inline JSON that defines a custom sequence adapter',
|
|
456
458
|
options: ['aliases', 'custom'],
|
|
457
459
|
dependsOn: ['refNameAliases'],
|
|
458
460
|
}),
|
|
459
|
-
refNameColors:
|
|
461
|
+
refNameColors: core_1.Flags.string({
|
|
460
462
|
description: 'A comma-separated list of color strings for the reference sequence names; will cycle\nthrough colors if there are fewer colors than sequences',
|
|
461
463
|
}),
|
|
462
|
-
target:
|
|
464
|
+
target: core_1.Flags.string({
|
|
463
465
|
description: 'path to config file in JB2 installation directory to write out to.\nCreates ./config.json if nonexistent',
|
|
464
466
|
}),
|
|
465
|
-
out:
|
|
467
|
+
out: core_1.Flags.string({
|
|
466
468
|
description: 'synonym for target',
|
|
467
469
|
}),
|
|
468
|
-
help:
|
|
469
|
-
load:
|
|
470
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
471
|
+
load: core_1.Flags.string({
|
|
470
472
|
char: 'l',
|
|
471
473
|
description: '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',
|
|
472
474
|
options: ['copy', 'symlink', 'move', 'inPlace'],
|
|
473
475
|
}),
|
|
474
|
-
skipCheck:
|
|
476
|
+
skipCheck: core_1.Flags.boolean({
|
|
475
477
|
description: "Don't check whether or not the sequence file or URL exists or if you are in a JBrowse directory",
|
|
476
478
|
}),
|
|
477
|
-
overwrite:
|
|
479
|
+
overwrite: core_1.Flags.boolean({
|
|
478
480
|
description: 'Overwrite existing assembly if one with the same name exists',
|
|
479
481
|
}),
|
|
480
|
-
force:
|
|
482
|
+
force: core_1.Flags.boolean({
|
|
481
483
|
char: 'f',
|
|
482
484
|
description: 'Equivalent to `--skipCheck --overwrite`',
|
|
483
485
|
}),
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const json_parse_better_errors_1 = __importDefault(require("json-parse-better-errors"));
|
|
@@ -12,8 +12,7 @@ const fetchWithProxy_1 = __importDefault(require("../fetchWithProxy"));
|
|
|
12
12
|
const base_1 = __importDefault(require("../base"));
|
|
13
13
|
class AddConnection extends base_1.default {
|
|
14
14
|
async run() {
|
|
15
|
-
|
|
16
|
-
const { args: runArgs, flags: runFlags } = this.parse(AddConnection);
|
|
15
|
+
const { args: runArgs, flags: runFlags } = await this.parse(AddConnection);
|
|
17
16
|
const output = runFlags.target || runFlags.out || '.';
|
|
18
17
|
const isDir = fs_1.default.lstatSync(output).isDirectory();
|
|
19
18
|
this.target = isDir ? `${output}/config.json` : output;
|
|
@@ -23,29 +22,37 @@ class AddConnection extends base_1.default {
|
|
|
23
22
|
const url = await this.resolveURL(connectionUrlOrPath, !(skipCheck || force));
|
|
24
23
|
const configContents = await this.readJsonFile(this.target);
|
|
25
24
|
this.debug(`Using config file ${this.target}`);
|
|
26
|
-
if (!
|
|
25
|
+
if (!configContents.assemblies?.length) {
|
|
27
26
|
this.error('No assemblies found. Please add one before adding connections', { exit: 120 });
|
|
28
27
|
}
|
|
29
28
|
const configType = type || this.determineConnectionType(url);
|
|
30
29
|
const id = connectionId ||
|
|
31
30
|
[configType, assemblyNames, +Date.now()].filter(f => !!f).join('-');
|
|
32
|
-
const connectionConfig =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
31
|
+
const connectionConfig = {
|
|
32
|
+
type: configType,
|
|
33
|
+
name: name || id,
|
|
34
|
+
...(configType === 'UCSCTrackHubConnection'
|
|
35
|
+
? {
|
|
36
|
+
hubTxtLocation: {
|
|
37
|
+
uri: url,
|
|
38
|
+
locationType: 'UriLocation',
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
: {}),
|
|
42
|
+
...(configType === 'JBrowse1Connection'
|
|
43
|
+
? {
|
|
44
|
+
dataDirLocation: {
|
|
45
|
+
uri: url,
|
|
46
|
+
locationType: 'UriLocation',
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
: {}),
|
|
50
|
+
connectionId: id,
|
|
51
|
+
assemblyNames: assemblyNames || type === 'JBrowse1Connection'
|
|
52
|
+
? [configContents.assemblies[0]?.name]
|
|
53
|
+
: undefined,
|
|
54
|
+
...(config ? (0, json_parse_better_errors_1.default)(config) : {}),
|
|
55
|
+
};
|
|
49
56
|
if (!configContents.connections) {
|
|
50
57
|
configContents.connections = [];
|
|
51
58
|
}
|
|
@@ -121,47 +128,46 @@ AddConnection.examples = [
|
|
|
121
128
|
`$ jbrowse add-connection http://mysite.com/path/to/custom --type custom --config '{"uri":{"url":"https://mysite.com/path/to/custom"}, "locationType": "UriLocation"}' -a hg19`,
|
|
122
129
|
'$ jbrowse add-connection https://mysite.com/path/to/hub.txt --connectionId newId --name newName --target /path/to/jb2/installation/config.json',
|
|
123
130
|
];
|
|
124
|
-
AddConnection.args =
|
|
125
|
-
{
|
|
126
|
-
name: 'connectionUrlOrPath',
|
|
131
|
+
AddConnection.args = {
|
|
132
|
+
connectionUrlOrPath: core_1.Args.string({
|
|
127
133
|
required: true,
|
|
128
134
|
description: `URL of data directory\nFor hub file, usually called hub.txt\nFor JBrowse 1, location of JB1 data directory similar to http://mysite.com/jbrowse/data/ `,
|
|
129
|
-
},
|
|
130
|
-
|
|
135
|
+
}),
|
|
136
|
+
};
|
|
131
137
|
AddConnection.flags = {
|
|
132
|
-
type:
|
|
138
|
+
type: core_1.Flags.string({
|
|
133
139
|
char: 't',
|
|
134
140
|
description: 'type of connection, ex. JBrowse1Connection, UCSCTrackHubConnection, custom',
|
|
135
141
|
}),
|
|
136
|
-
assemblyNames:
|
|
142
|
+
assemblyNames: core_1.Flags.string({
|
|
137
143
|
char: 'a',
|
|
138
144
|
description: 'For UCSC, optional: Comma separated list of assembly name(s) to filter from this connection. For JBrowse: a single assembly name',
|
|
139
145
|
}),
|
|
140
|
-
config:
|
|
146
|
+
config: core_1.Flags.string({
|
|
141
147
|
char: 'c',
|
|
142
148
|
description: `Any extra config settings to add to connection in JSON object format, such as '{"uri":"url":"https://sample.com"}, "locationType": "UriLocation"}'`,
|
|
143
149
|
}),
|
|
144
|
-
connectionId:
|
|
150
|
+
connectionId: core_1.Flags.string({
|
|
145
151
|
description: `Id for the connection that must be unique to JBrowse. Defaults to 'connectionType-assemblyName-currentTime'`,
|
|
146
152
|
}),
|
|
147
|
-
name:
|
|
153
|
+
name: core_1.Flags.string({
|
|
148
154
|
char: 'n',
|
|
149
155
|
description: 'Name of the connection. Defaults to connectionId if not provided',
|
|
150
156
|
}),
|
|
151
|
-
target:
|
|
157
|
+
target: core_1.Flags.string({
|
|
152
158
|
description: 'path to config file in JB2 installation directory to write out to.',
|
|
153
159
|
}),
|
|
154
|
-
out:
|
|
160
|
+
out: core_1.Flags.string({
|
|
155
161
|
description: 'synonym for target',
|
|
156
162
|
}),
|
|
157
|
-
help:
|
|
158
|
-
skipCheck:
|
|
163
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
164
|
+
skipCheck: core_1.Flags.boolean({
|
|
159
165
|
description: "Don't check whether or not the data directory URL exists or if you are in a JBrowse directory",
|
|
160
166
|
}),
|
|
161
|
-
overwrite:
|
|
167
|
+
overwrite: core_1.Flags.boolean({
|
|
162
168
|
description: 'Overwrites any existing connections if same connection id',
|
|
163
169
|
}),
|
|
164
|
-
force:
|
|
170
|
+
force: core_1.Flags.boolean({
|
|
165
171
|
char: 'f',
|
|
166
172
|
description: 'Equivalent to `--skipCheck --overwrite`',
|
|
167
173
|
}),
|
|
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const base_1 = __importDefault(require("../base"));
|
|
9
9
|
class AddTrackJson extends base_1.default {
|
|
10
10
|
async run() {
|
|
11
|
-
const { args, flags: runFlags } = this.parse(AddTrackJson);
|
|
11
|
+
const { args, flags: runFlags } = await this.parse(AddTrackJson);
|
|
12
12
|
const output = runFlags.target || runFlags.out || '.';
|
|
13
13
|
const isDir = (await fs_1.promises.lstat(output)).isDirectory();
|
|
14
14
|
this.target = isDir ? `${output}/config.json` : output;
|
|
@@ -46,22 +46,21 @@ AddTrackJson.examples = [
|
|
|
46
46
|
'$ jbrowse add-track-json track.json',
|
|
47
47
|
'$ jbrowse add-track-json track.json --update',
|
|
48
48
|
];
|
|
49
|
-
AddTrackJson.args =
|
|
50
|
-
{
|
|
51
|
-
name: 'track',
|
|
49
|
+
AddTrackJson.args = {
|
|
50
|
+
track: core_1.Args.string({
|
|
52
51
|
required: true,
|
|
53
52
|
description: `track JSON file or command line arg blob`,
|
|
54
|
-
},
|
|
55
|
-
|
|
53
|
+
}),
|
|
54
|
+
};
|
|
56
55
|
AddTrackJson.flags = {
|
|
57
|
-
update:
|
|
56
|
+
update: core_1.Flags.boolean({
|
|
58
57
|
char: 'u',
|
|
59
58
|
description: `update the contents of an existing track, matched based on trackId`,
|
|
60
59
|
}),
|
|
61
|
-
target:
|
|
60
|
+
target: core_1.Flags.string({
|
|
62
61
|
description: 'path to config file in JB2 installation directory to write out to.\nCreates ./config.json if nonexistent',
|
|
63
62
|
}),
|
|
64
|
-
out:
|
|
63
|
+
out: core_1.Flags.string({
|
|
65
64
|
description: 'synonym for target',
|
|
66
65
|
}),
|
|
67
66
|
};
|