@jbrowse/cli 1.7.9 → 2.0.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 +11 -9
- package/lib/base.js +34 -13
- package/lib/commands/add-assembly.js +10 -6
- package/lib/commands/add-connection.js +9 -7
- package/lib/commands/add-track-json.js +4 -2
- package/lib/commands/add-track.js +7 -5
- package/lib/commands/admin-server.js +12 -10
- package/lib/commands/create.js +8 -6
- package/lib/commands/set-default-session.js +6 -4
- package/lib/commands/text-index.d.ts +1 -0
- package/lib/commands/text-index.js +46 -11
- package/lib/commands/upgrade.js +10 -8
- package/lib/fetchWithProxy.d.ts +2 -0
- package/lib/fetchWithProxy.js +12 -0
- package/lib/types/common.js +7 -5
- package/lib/types/gff3Adapter.js +28 -7
- package/lib/types/gtfAdapter.js +28 -7
- package/lib/types/vcfAdapter.js +28 -7
- package/lib/util.js +5 -3
- package/oclif.manifest.json +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -157,7 +157,7 @@ EXAMPLES
|
|
|
157
157
|
$ jbrowse add-assembly myfile.fa.gz --load copy
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
_See code: [src/commands/add-assembly.ts](https://github.com/GMOD/jbrowse-components/blob/
|
|
160
|
+
_See code: [src/commands/add-assembly.ts](https://github.com/GMOD/jbrowse-components/blob/v2.0.0/products/jbrowse-cli/src/commands/add-assembly.ts)_
|
|
161
161
|
|
|
162
162
|
## `jbrowse add-connection CONNECTIONURLORPATH`
|
|
163
163
|
|
|
@@ -211,7 +211,7 @@ EXAMPLES
|
|
|
211
211
|
/path/to/jb2/installation/config.json
|
|
212
212
|
```
|
|
213
213
|
|
|
214
|
-
_See code: [src/commands/add-connection.ts](https://github.com/GMOD/jbrowse-components/blob/
|
|
214
|
+
_See code: [src/commands/add-connection.ts](https://github.com/GMOD/jbrowse-components/blob/v2.0.0/products/jbrowse-cli/src/commands/add-connection.ts)_
|
|
215
215
|
|
|
216
216
|
## `jbrowse add-track TRACK`
|
|
217
217
|
|
|
@@ -285,7 +285,7 @@ EXAMPLES
|
|
|
285
285
|
$ jbrowse add-track /url/relative/path.bam --load inPlace
|
|
286
286
|
```
|
|
287
287
|
|
|
288
|
-
_See code: [src/commands/add-track.ts](https://github.com/GMOD/jbrowse-components/blob/
|
|
288
|
+
_See code: [src/commands/add-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.0.0/products/jbrowse-cli/src/commands/add-track.ts)_
|
|
289
289
|
|
|
290
290
|
## `jbrowse add-track-json TRACK`
|
|
291
291
|
|
|
@@ -310,7 +310,7 @@ EXAMPLES
|
|
|
310
310
|
$ jbrowse add-track-json track.json --update
|
|
311
311
|
```
|
|
312
312
|
|
|
313
|
-
_See code: [src/commands/add-track-json.ts](https://github.com/GMOD/jbrowse-components/blob/
|
|
313
|
+
_See code: [src/commands/add-track-json.ts](https://github.com/GMOD/jbrowse-components/blob/v2.0.0/products/jbrowse-cli/src/commands/add-track-json.ts)_
|
|
314
314
|
|
|
315
315
|
## `jbrowse admin-server`
|
|
316
316
|
|
|
@@ -340,7 +340,7 @@ EXAMPLES
|
|
|
340
340
|
$ jbrowse admin-server -p 8888
|
|
341
341
|
```
|
|
342
342
|
|
|
343
|
-
_See code: [src/commands/admin-server.ts](https://github.com/GMOD/jbrowse-components/blob/
|
|
343
|
+
_See code: [src/commands/admin-server.ts](https://github.com/GMOD/jbrowse-components/blob/v2.0.0/products/jbrowse-cli/src/commands/admin-server.ts)_
|
|
344
344
|
|
|
345
345
|
## `jbrowse create LOCALPATH`
|
|
346
346
|
|
|
@@ -384,7 +384,7 @@ EXAMPLES
|
|
|
384
384
|
$ jbrowse create --listVersions
|
|
385
385
|
```
|
|
386
386
|
|
|
387
|
-
_See code: [src/commands/create.ts](https://github.com/GMOD/jbrowse-components/blob/
|
|
387
|
+
_See code: [src/commands/create.ts](https://github.com/GMOD/jbrowse-components/blob/v2.0.0/products/jbrowse-cli/src/commands/create.ts)_
|
|
388
388
|
|
|
389
389
|
## `jbrowse help [COMMAND]`
|
|
390
390
|
|
|
@@ -438,7 +438,7 @@ EXAMPLES
|
|
|
438
438
|
$ jbrowse set-default-session --currentSession # Prints out current default session
|
|
439
439
|
```
|
|
440
440
|
|
|
441
|
-
_See code: [src/commands/set-default-session.ts](https://github.com/GMOD/jbrowse-components/blob/
|
|
441
|
+
_See code: [src/commands/set-default-session.ts](https://github.com/GMOD/jbrowse-components/blob/v2.0.0/products/jbrowse-cli/src/commands/set-default-session.ts)_
|
|
442
442
|
|
|
443
443
|
## `jbrowse text-index`
|
|
444
444
|
|
|
@@ -465,6 +465,8 @@ OPTIONS
|
|
|
465
465
|
--file=file File or files to index (can be used to create trix indexes for embedded component use
|
|
466
466
|
cases not using a config.json for example)
|
|
467
467
|
|
|
468
|
+
--fileId=fileId Set the trackId used for the indexes generated with the --file argument
|
|
469
|
+
|
|
468
470
|
--force Overwrite previously existing indexes
|
|
469
471
|
|
|
470
472
|
--out=out Synonym for target
|
|
@@ -497,7 +499,7 @@ EXAMPLES
|
|
|
497
499
|
$ jbrowse text-index --file myfile.gff3.gz --file myfile.vcfgz --out indexes
|
|
498
500
|
```
|
|
499
501
|
|
|
500
|
-
_See code: [src/commands/text-index.ts](https://github.com/GMOD/jbrowse-components/blob/
|
|
502
|
+
_See code: [src/commands/text-index.ts](https://github.com/GMOD/jbrowse-components/blob/v2.0.0/products/jbrowse-cli/src/commands/text-index.ts)_
|
|
501
503
|
|
|
502
504
|
## `jbrowse upgrade [LOCALPATH]`
|
|
503
505
|
|
|
@@ -545,7 +547,7 @@ EXAMPLES
|
|
|
545
547
|
$ jbrowse upgrade --nightly
|
|
546
548
|
```
|
|
547
549
|
|
|
548
|
-
_See code: [src/commands/upgrade.ts](https://github.com/GMOD/jbrowse-components/blob/
|
|
550
|
+
_See code: [src/commands/upgrade.ts](https://github.com/GMOD/jbrowse-components/blob/v2.0.0/products/jbrowse-cli/src/commands/upgrade.ts)_
|
|
549
551
|
|
|
550
552
|
<!-- commandsstop -->
|
|
551
553
|
|
package/lib/base.js
CHANGED
|
@@ -2,13 +2,34 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
5
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
7
|
-
const command_1 = tslib_1.__importDefault(require("@oclif/command"));
|
|
28
|
+
const command_1 = __importDefault(require("@oclif/command"));
|
|
8
29
|
const fs_1 = require("fs");
|
|
9
|
-
const path_1 =
|
|
10
|
-
const json_parse_better_errors_1 =
|
|
11
|
-
const
|
|
30
|
+
const path_1 = __importDefault(require("path"));
|
|
31
|
+
const json_parse_better_errors_1 = __importDefault(require("json-parse-better-errors"));
|
|
32
|
+
const fetchWithProxy_1 = __importDefault(require("./fetchWithProxy"));
|
|
12
33
|
class JBrowseCommand extends command_1.default {
|
|
13
34
|
async init() { }
|
|
14
35
|
async readFile(location) {
|
|
@@ -55,7 +76,7 @@ class JBrowseCommand extends command_1.default {
|
|
|
55
76
|
}
|
|
56
77
|
if (locationUrl) {
|
|
57
78
|
if (check) {
|
|
58
|
-
const response = await (0,
|
|
79
|
+
const response = await (0, fetchWithProxy_1.default)(locationUrl, { method: 'HEAD' });
|
|
59
80
|
if (!response.ok) {
|
|
60
81
|
throw new Error(`${locationUrl} result ${response.statusText}`);
|
|
61
82
|
}
|
|
@@ -102,7 +123,7 @@ class JBrowseCommand extends command_1.default {
|
|
|
102
123
|
var e_1, _a;
|
|
103
124
|
let versions = [];
|
|
104
125
|
try {
|
|
105
|
-
for (var _b =
|
|
126
|
+
for (var _b = __asyncValues(this.fetchVersions()), _c; _c = await _b.next(), !_c.done;) {
|
|
106
127
|
const iter = _c.value;
|
|
107
128
|
versions = versions.concat(iter);
|
|
108
129
|
}
|
|
@@ -120,7 +141,7 @@ class JBrowseCommand extends command_1.default {
|
|
|
120
141
|
var e_2, _a;
|
|
121
142
|
var _b;
|
|
122
143
|
try {
|
|
123
|
-
for (var _c =
|
|
144
|
+
for (var _c = __asyncValues(this.fetchVersions()), _d; _d = await _c.next(), !_d.done;) {
|
|
124
145
|
const versions = _d.value;
|
|
125
146
|
// if a release was just uploaded, or an erroneous build was made
|
|
126
147
|
// then it might have no build asset
|
|
@@ -147,14 +168,14 @@ class JBrowseCommand extends command_1.default {
|
|
|
147
168
|
throw new Error('no version tags found');
|
|
148
169
|
}
|
|
149
170
|
fetchVersions() {
|
|
150
|
-
return
|
|
171
|
+
return __asyncGenerator(this, arguments, function* fetchVersions_1() {
|
|
151
172
|
let page = 1;
|
|
152
173
|
let result;
|
|
153
174
|
do {
|
|
154
|
-
const response = yield
|
|
175
|
+
const response = yield __await((0, fetchWithProxy_1.default)(`https://api.github.com/repos/GMOD/jbrowse-components/releases?page=${page}`));
|
|
155
176
|
if (response.ok) {
|
|
156
|
-
result = (yield
|
|
157
|
-
yield yield
|
|
177
|
+
result = (yield __await(response.json()));
|
|
178
|
+
yield yield __await(result.filter(release => release.tag_name.startsWith('v')));
|
|
158
179
|
page++;
|
|
159
180
|
}
|
|
160
181
|
else {
|
|
@@ -165,7 +186,7 @@ class JBrowseCommand extends command_1.default {
|
|
|
165
186
|
}
|
|
166
187
|
async getTag(tag) {
|
|
167
188
|
var _a, _b;
|
|
168
|
-
const response = await (0,
|
|
189
|
+
const response = await (0, fetchWithProxy_1.default)(`https://api.github.com/repos/GMOD/jbrowse-components/releases/tags/${tag}`);
|
|
169
190
|
if (response.ok) {
|
|
170
191
|
const result = (await response.json());
|
|
171
192
|
const file = (_b = (_a = result === null || result === void 0 ? void 0 : result.assets) === null || _a === void 0 ? void 0 : _a.find(f => f.name.includes('jbrowse-web'))) === null || _b === void 0 ? void 0 : _b.browser_download_url;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
6
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const fs_1 =
|
|
6
|
-
const path_1 =
|
|
7
|
-
const base_1 =
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const base_1 = __importDefault(require("../base"));
|
|
8
10
|
const { rename, copyFile, mkdir, symlink } = fs_1.default.promises;
|
|
9
11
|
function isValidJSON(string) {
|
|
10
12
|
try {
|
|
@@ -299,7 +301,9 @@ class AddAssembly extends base_1.default {
|
|
|
299
301
|
sequence.endsWith('.fasta')) {
|
|
300
302
|
return 'indexedFasta';
|
|
301
303
|
}
|
|
302
|
-
if (sequence.endsWith('.fa.gz') ||
|
|
304
|
+
if (sequence.endsWith('.fa.gz') ||
|
|
305
|
+
sequence.endsWith('.fna.gz') ||
|
|
306
|
+
sequence.endsWith('.fasta.gz')) {
|
|
303
307
|
return 'bgzipFasta';
|
|
304
308
|
}
|
|
305
309
|
if (sequence.endsWith('.2bit')) {
|
|
@@ -314,7 +318,7 @@ class AddAssembly extends base_1.default {
|
|
|
314
318
|
if (isValidJSON(sequence)) {
|
|
315
319
|
return 'custom';
|
|
316
320
|
}
|
|
317
|
-
return this.error('Could not determine sequence type', { exit: 170 });
|
|
321
|
+
return this.error('Could not determine sequence type automatically, add --type to specify it', { exit: 170 });
|
|
318
322
|
}
|
|
319
323
|
needLoadData(location) {
|
|
320
324
|
let locationUrl;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
6
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const
|
|
6
|
-
const fs_1 =
|
|
7
|
-
const path_1 =
|
|
8
|
-
const json_parse_better_errors_1 =
|
|
9
|
-
const base_1 =
|
|
7
|
+
const fetchWithProxy_1 = __importDefault(require("../fetchWithProxy"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const json_parse_better_errors_1 = __importDefault(require("json-parse-better-errors"));
|
|
11
|
+
const base_1 = __importDefault(require("../base"));
|
|
10
12
|
class AddConnection extends base_1.default {
|
|
11
13
|
async run() {
|
|
12
14
|
const { args: runArgs, flags: runFlags } = this.parse(AddConnection);
|
|
@@ -118,7 +120,7 @@ class AddConnection extends base_1.default {
|
|
|
118
120
|
let response;
|
|
119
121
|
try {
|
|
120
122
|
if (check) {
|
|
121
|
-
response = await (0,
|
|
123
|
+
response = await (0, fetchWithProxy_1.default)(locationUrl, { method: 'HEAD' });
|
|
122
124
|
}
|
|
123
125
|
if (!response || response.ok) {
|
|
124
126
|
return locationUrl.href;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
6
|
const command_1 = require("@oclif/command");
|
|
5
7
|
const fs_1 = require("fs");
|
|
6
|
-
const base_1 =
|
|
8
|
+
const base_1 = __importDefault(require("../base"));
|
|
7
9
|
class AddTrackJson extends base_1.default {
|
|
8
10
|
async run() {
|
|
9
11
|
const { args, flags: runFlags } = this.parse(AddTrackJson);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
6
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const fs_1 =
|
|
6
|
-
const path_1 =
|
|
7
|
-
const json_parse_better_errors_1 =
|
|
8
|
-
const base_1 =
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const json_parse_better_errors_1 = __importDefault(require("json-parse-better-errors"));
|
|
10
|
+
const base_1 = __importDefault(require("../base"));
|
|
9
11
|
const { copyFile, rename, symlink } = fs_1.default.promises;
|
|
10
12
|
const { COPYFILE_EXCL } = fs_1.default.constants;
|
|
11
13
|
const isUrl = (loc) => loc === null || loc === void 0 ? void 0 : loc.match(/^https?:\/\//);
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
6
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const path_1 =
|
|
6
|
-
const fs_1 =
|
|
7
|
-
const crypto_1 =
|
|
8
|
-
const boxen_1 =
|
|
9
|
-
const chalk_1 =
|
|
10
|
-
const os_1 =
|
|
11
|
-
const express_1 =
|
|
12
|
-
const cors_1 =
|
|
13
|
-
const base_1 =
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
10
|
+
const boxen_1 = __importDefault(require("boxen"));
|
|
11
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
12
|
+
const os_1 = __importDefault(require("os"));
|
|
13
|
+
const express_1 = __importDefault(require("express"));
|
|
14
|
+
const cors_1 = __importDefault(require("cors"));
|
|
15
|
+
const base_1 = __importDefault(require("../base"));
|
|
14
16
|
function isValidPort(port) {
|
|
15
17
|
return port > 0 && port < 65535;
|
|
16
18
|
}
|
package/lib/commands/create.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
6
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const fs_1 =
|
|
6
|
-
const
|
|
7
|
-
const unzipper_1 =
|
|
8
|
-
const base_1 =
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const fetchWithProxy_1 = __importDefault(require("../fetchWithProxy"));
|
|
9
|
+
const unzipper_1 = __importDefault(require("unzipper"));
|
|
10
|
+
const base_1 = __importDefault(require("../base"));
|
|
9
11
|
const fsPromises = fs_1.default.promises;
|
|
10
12
|
class Create extends base_1.default {
|
|
11
13
|
async run() {
|
|
@@ -28,7 +30,7 @@ class Create extends base_1.default {
|
|
|
28
30
|
(branch ? await this.getBranch(branch) : '') ||
|
|
29
31
|
(tag ? await this.getTag(tag) : await this.getLatest());
|
|
30
32
|
this.log(`Fetching ${locationUrl}...`);
|
|
31
|
-
const response = await (0,
|
|
33
|
+
const response = await (0, fetchWithProxy_1.default)(locationUrl);
|
|
32
34
|
if (!response.ok) {
|
|
33
35
|
this.error(`Failed to fetch: ${response.statusText}`, { exit: 100 });
|
|
34
36
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
6
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const fs_1 =
|
|
6
|
-
const json_parse_better_errors_1 =
|
|
7
|
-
const base_1 =
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const json_parse_better_errors_1 = __importDefault(require("json-parse-better-errors"));
|
|
9
|
+
const base_1 = __importDefault(require("../base"));
|
|
8
10
|
const fsPromises = fs_1.default.promises;
|
|
9
11
|
class SetDefaultSession extends base_1.default {
|
|
10
12
|
async run() {
|
|
@@ -18,6 +18,7 @@ export default class TextIndex extends JBrowseCommand {
|
|
|
18
18
|
exclude: flags.IOptionFlag<string>;
|
|
19
19
|
prefixSize: import("@oclif/parser/lib/flags").IOptionFlag<number>;
|
|
20
20
|
file: flags.IOptionFlag<string[]>;
|
|
21
|
+
fileId: flags.IOptionFlag<string[]>;
|
|
21
22
|
dryrun: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
22
23
|
};
|
|
23
24
|
run(): Promise<void>;
|
|
@@ -1,16 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
|
+
var m = o[Symbol.asyncIterator], i;
|
|
5
|
+
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);
|
|
6
|
+
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); }); }; }
|
|
7
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
8
|
+
};
|
|
9
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
10
|
+
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
|
11
|
+
var i, p;
|
|
12
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
13
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
14
|
+
};
|
|
15
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
16
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
17
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
18
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
19
|
+
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); }); }; }
|
|
20
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
21
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
22
|
+
function fulfill(value) { resume("next", value); }
|
|
23
|
+
function reject(value) { resume("throw", value); }
|
|
24
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
2
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
30
|
+
const fs_1 = __importDefault(require("fs"));
|
|
31
|
+
const path_1 = __importDefault(require("path"));
|
|
6
32
|
const stream_1 = require("stream");
|
|
7
33
|
const ixixx_1 = require("ixixx");
|
|
8
34
|
const command_1 = require("@oclif/command");
|
|
9
35
|
const gff3Adapter_1 = require("../types/gff3Adapter");
|
|
10
36
|
const vcfAdapter_1 = require("../types/vcfAdapter");
|
|
11
|
-
const base_1 =
|
|
37
|
+
const base_1 = __importDefault(require("../base"));
|
|
12
38
|
const common_1 = require("../types/common");
|
|
13
|
-
const object_fromentries_1 =
|
|
39
|
+
const object_fromentries_1 = __importDefault(require("object.fromentries"));
|
|
14
40
|
if (!Object.fromEntries) {
|
|
15
41
|
// @ts-ignore
|
|
16
42
|
object_fromentries_1.default.shim();
|
|
@@ -173,7 +199,7 @@ class TextIndex extends base_1.default {
|
|
|
173
199
|
}
|
|
174
200
|
async indexFileList() {
|
|
175
201
|
const { flags } = this.parse(TextIndex);
|
|
176
|
-
const { out, target, file, attributes, quiet, exclude, prefixSize } = flags;
|
|
202
|
+
const { out, target, fileId, file, attributes, quiet, exclude, prefixSize, } = flags;
|
|
177
203
|
const outFlag = target || out || '.';
|
|
178
204
|
const trixDir = path_1.default.join(outFlag, 'trix');
|
|
179
205
|
if (!fs_1.default.existsSync(trixDir)) {
|
|
@@ -182,6 +208,11 @@ class TextIndex extends base_1.default {
|
|
|
182
208
|
const configs = file
|
|
183
209
|
.map(file => (0, common_1.guessAdapterFromFileName)(file))
|
|
184
210
|
.filter(fileConfig => (0, common_1.supported)(fileConfig.adapter.type));
|
|
211
|
+
if (fileId === null || fileId === void 0 ? void 0 : fileId.length) {
|
|
212
|
+
for (let i = 0; i < fileId.length; i++) {
|
|
213
|
+
configs[i].trackId = fileId[i];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
185
216
|
await this.indexDriver({
|
|
186
217
|
configs,
|
|
187
218
|
outDir: outFlag,
|
|
@@ -214,22 +245,22 @@ class TextIndex extends base_1.default {
|
|
|
214
245
|
return elt.uri;
|
|
215
246
|
}
|
|
216
247
|
indexFiles(trackConfigs, attributes, outLocation, quiet, typesToExclude) {
|
|
217
|
-
return
|
|
248
|
+
return __asyncGenerator(this, arguments, function* indexFiles_1() {
|
|
218
249
|
for (const config of trackConfigs) {
|
|
219
250
|
const { adapter, textSearching } = config;
|
|
220
251
|
const { type } = adapter;
|
|
221
252
|
const { indexingFeatureTypesToExclude: types = typesToExclude, indexingAttributes: attrs = attributes, } = textSearching || {};
|
|
222
253
|
if (type === 'Gff3TabixAdapter') {
|
|
223
|
-
yield
|
|
254
|
+
yield __await(yield* __asyncDelegator(__asyncValues((0, gff3Adapter_1.indexGff3)(config, attrs, this.getLoc(adapter.gffGzLocation), outLocation, types, quiet))));
|
|
224
255
|
}
|
|
225
256
|
else if (type === 'Gff3Adapter') {
|
|
226
|
-
yield
|
|
257
|
+
yield __await(yield* __asyncDelegator(__asyncValues((0, gff3Adapter_1.indexGff3)(config, attrs, this.getLoc(adapter.gffLocation), outLocation, types, quiet))));
|
|
227
258
|
}
|
|
228
259
|
else if (type === 'VcfTabixAdapter') {
|
|
229
|
-
yield
|
|
260
|
+
yield __await(yield* __asyncDelegator(__asyncValues((0, vcfAdapter_1.indexVcf)(config, attrs, this.getLoc(adapter.vcfGzLocation), outLocation, types, quiet))));
|
|
230
261
|
}
|
|
231
262
|
else if (type === 'VcfAdapter') {
|
|
232
|
-
yield
|
|
263
|
+
yield __await(yield* __asyncDelegator(__asyncValues((0, vcfAdapter_1.indexVcf)(config, attrs, this.getLoc(adapter.vcfLocation), outLocation, types, quiet))));
|
|
233
264
|
}
|
|
234
265
|
// gtf unused currently
|
|
235
266
|
}
|
|
@@ -320,6 +351,10 @@ TextIndex.flags = {
|
|
|
320
351
|
description: 'File or files to index (can be used to create trix indexes for embedded component use cases not using a config.json for example)',
|
|
321
352
|
multiple: true,
|
|
322
353
|
}),
|
|
354
|
+
fileId: command_1.flags.string({
|
|
355
|
+
description: 'Set the trackId used for the indexes generated with the --file argument',
|
|
356
|
+
multiple: true,
|
|
357
|
+
}),
|
|
323
358
|
dryrun: command_1.flags.boolean({
|
|
324
359
|
description: 'Just print out tracks that will be indexed by the process, without doing any indexing',
|
|
325
360
|
}),
|
package/lib/commands/upgrade.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
6
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const rimraf_1 =
|
|
6
|
-
const fs_1 =
|
|
7
|
-
const path_1 =
|
|
8
|
-
const
|
|
9
|
-
const unzipper_1 =
|
|
10
|
-
const base_1 =
|
|
7
|
+
const rimraf_1 = __importDefault(require("rimraf"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const fetchWithProxy_1 = __importDefault(require("../fetchWithProxy"));
|
|
11
|
+
const unzipper_1 = __importDefault(require("unzipper"));
|
|
12
|
+
const base_1 = __importDefault(require("../base"));
|
|
11
13
|
class Upgrade extends base_1.default {
|
|
12
14
|
async run() {
|
|
13
15
|
const { args: runArgs, flags: runFlags } = this.parse(Upgrade);
|
|
@@ -31,7 +33,7 @@ class Upgrade extends base_1.default {
|
|
|
31
33
|
(branch ? await this.getBranch(branch) : '') ||
|
|
32
34
|
(tag ? await this.getTag(tag) : await this.getLatest());
|
|
33
35
|
this.log(`Fetching ${locationUrl}...`);
|
|
34
|
-
const response = await (0,
|
|
36
|
+
const response = await (0, fetchWithProxy_1.default)(locationUrl);
|
|
35
37
|
if (!response.ok) {
|
|
36
38
|
this.error(`Failed to fetch: ${response.statusText}`, { exit: 100 });
|
|
37
39
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
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 node_fetch_1 = __importDefault(require("node-fetch"));
|
|
7
|
+
const proxy_agent_1 = __importDefault(require("proxy-agent"));
|
|
8
|
+
function fetchWithProxy(url, options = {}) {
|
|
9
|
+
const agent = new proxy_agent_1.default();
|
|
10
|
+
return (0, node_fetch_1.default)(url, Object.assign({ agent }, options));
|
|
11
|
+
}
|
|
12
|
+
exports.default = fetchWithProxy;
|
package/lib/types/common.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.generateMeta = exports.supported = exports.guessAdapterFromFileName = exports.isURL = exports.createRemoteStream = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const fetchWithProxy_1 = __importDefault(require("../fetchWithProxy"));
|
|
8
10
|
// Method for handing off the parsing of a gff3 file URL.
|
|
9
11
|
// Calls the proper parser depending on if it is gzipped or not.
|
|
10
12
|
// Returns a @gmod/gff stream.
|
|
11
13
|
async function createRemoteStream(urlIn) {
|
|
12
|
-
const response = await (0,
|
|
14
|
+
const response = await (0, fetchWithProxy_1.default)(urlIn);
|
|
13
15
|
if (!response.ok) {
|
|
14
16
|
throw new Error(`Failed to fetch ${urlIn} status ${response.status} ${response.statusText}`);
|
|
15
17
|
}
|
package/lib/types/gff3Adapter.js
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
3
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
4
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
5
|
+
var m = o[Symbol.asyncIterator], i;
|
|
6
|
+
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);
|
|
7
|
+
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); }); }; }
|
|
8
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
9
|
+
};
|
|
10
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
11
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
12
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
13
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
14
|
+
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); }); }; }
|
|
15
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
16
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
17
|
+
function fulfill(value) { resume("next", value); }
|
|
18
|
+
function reject(value) { resume("throw", value); }
|
|
19
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
2
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
25
|
exports.indexGff3 = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
26
|
const util_1 = require("../util");
|
|
6
27
|
const cli_progress_1 = require("cli-progress");
|
|
7
28
|
const zlib_1 = require("zlib");
|
|
8
|
-
const readline_1 =
|
|
29
|
+
const readline_1 = __importDefault(require("readline"));
|
|
9
30
|
function indexGff3(config, attributes, inLocation, outLocation, typesToExclude, quiet) {
|
|
10
|
-
return
|
|
31
|
+
return __asyncGenerator(this, arguments, function* indexGff3_1() {
|
|
11
32
|
var e_1, _a;
|
|
12
33
|
const { trackId } = config;
|
|
13
34
|
// progress bar code was aided by blog post at
|
|
@@ -17,7 +38,7 @@ function indexGff3(config, attributes, inLocation, outLocation, typesToExclude,
|
|
|
17
38
|
etaBuffer: 2000,
|
|
18
39
|
}, cli_progress_1.Presets.shades_classic);
|
|
19
40
|
let receivedBytes = 0;
|
|
20
|
-
const { totalBytes, stream } = yield
|
|
41
|
+
const { totalBytes, stream } = yield __await((0, util_1.getLocalOrRemoteStream)(inLocation, outLocation));
|
|
21
42
|
if (!quiet) {
|
|
22
43
|
progressBar.start(totalBytes, 0);
|
|
23
44
|
}
|
|
@@ -29,7 +50,7 @@ function indexGff3(config, attributes, inLocation, outLocation, typesToExclude,
|
|
|
29
50
|
input: inLocation.match(/.b?gz$/) ? stream.pipe((0, zlib_1.createGunzip)()) : stream,
|
|
30
51
|
});
|
|
31
52
|
try {
|
|
32
|
-
for (var rl_1 =
|
|
53
|
+
for (var rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield __await(rl_1.next()), !rl_1_1.done;) {
|
|
33
54
|
const line = rl_1_1.value;
|
|
34
55
|
if (line.startsWith('#')) {
|
|
35
56
|
continue;
|
|
@@ -60,7 +81,7 @@ function indexGff3(config, attributes, inLocation, outLocation, typesToExclude,
|
|
|
60
81
|
encodeURIComponent(trackId),
|
|
61
82
|
...attrs.map(a => encodeURIComponent(a)),
|
|
62
83
|
]).replace(/,/g, '|');
|
|
63
|
-
yield yield
|
|
84
|
+
yield yield __await(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
64
85
|
}
|
|
65
86
|
}
|
|
66
87
|
}
|
|
@@ -68,7 +89,7 @@ function indexGff3(config, attributes, inLocation, outLocation, typesToExclude,
|
|
|
68
89
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
69
90
|
finally {
|
|
70
91
|
try {
|
|
71
|
-
if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield
|
|
92
|
+
if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield __await(_a.call(rl_1));
|
|
72
93
|
}
|
|
73
94
|
finally { if (e_1) throw e_1.error; }
|
|
74
95
|
}
|
package/lib/types/gtfAdapter.js
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
3
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
4
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
5
|
+
var m = o[Symbol.asyncIterator], i;
|
|
6
|
+
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);
|
|
7
|
+
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); }); }; }
|
|
8
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
9
|
+
};
|
|
10
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
11
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
12
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
13
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
14
|
+
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); }); }; }
|
|
15
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
16
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
17
|
+
function fulfill(value) { resume("next", value); }
|
|
18
|
+
function reject(value) { resume("throw", value); }
|
|
19
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
2
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
25
|
exports.indexGtf = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
26
|
const util_1 = require("../util");
|
|
6
27
|
const cli_progress_1 = require("cli-progress");
|
|
7
28
|
const zlib_1 = require("zlib");
|
|
8
|
-
const readline_1 =
|
|
29
|
+
const readline_1 = __importDefault(require("readline"));
|
|
9
30
|
function indexGtf(config, attributes, outLocation, typesToExclude, quiet) {
|
|
10
|
-
return
|
|
31
|
+
return __asyncGenerator(this, arguments, function* indexGtf_1() {
|
|
11
32
|
var e_1, _a;
|
|
12
33
|
const { adapter, trackId } = config;
|
|
13
34
|
const { gtfLocation: { uri }, } = adapter;
|
|
@@ -18,7 +39,7 @@ function indexGtf(config, attributes, outLocation, typesToExclude, quiet) {
|
|
|
18
39
|
etaBuffer: 2000,
|
|
19
40
|
}, cli_progress_1.Presets.shades_classic);
|
|
20
41
|
let receivedBytes = 0;
|
|
21
|
-
const { totalBytes, stream } = yield
|
|
42
|
+
const { totalBytes, stream } = yield __await((0, util_1.getLocalOrRemoteStream)(uri, outLocation));
|
|
22
43
|
if (!quiet) {
|
|
23
44
|
progressBar.start(totalBytes, 0);
|
|
24
45
|
}
|
|
@@ -31,7 +52,7 @@ function indexGtf(config, attributes, outLocation, typesToExclude, quiet) {
|
|
|
31
52
|
input: gzStream,
|
|
32
53
|
});
|
|
33
54
|
try {
|
|
34
|
-
for (var rl_1 =
|
|
55
|
+
for (var rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield __await(rl_1.next()), !rl_1_1.done;) {
|
|
35
56
|
const line = rl_1_1.value;
|
|
36
57
|
if (line.startsWith('#')) {
|
|
37
58
|
continue;
|
|
@@ -62,7 +83,7 @@ function indexGtf(config, attributes, outLocation, typesToExclude, quiet) {
|
|
|
62
83
|
encodeURIComponent(trackId),
|
|
63
84
|
...attrs.map(a => encodeURIComponent(a || '')),
|
|
64
85
|
]).replace(/,/g, '|');
|
|
65
|
-
yield yield
|
|
86
|
+
yield yield __await(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
66
87
|
}
|
|
67
88
|
}
|
|
68
89
|
}
|
|
@@ -70,7 +91,7 @@ function indexGtf(config, attributes, outLocation, typesToExclude, quiet) {
|
|
|
70
91
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
71
92
|
finally {
|
|
72
93
|
try {
|
|
73
|
-
if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield
|
|
94
|
+
if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield __await(_a.call(rl_1));
|
|
74
95
|
}
|
|
75
96
|
finally { if (e_1) throw e_1.error; }
|
|
76
97
|
}
|
package/lib/types/vcfAdapter.js
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
3
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
4
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
5
|
+
var m = o[Symbol.asyncIterator], i;
|
|
6
|
+
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);
|
|
7
|
+
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); }); }; }
|
|
8
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
9
|
+
};
|
|
10
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
11
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
12
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
13
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
14
|
+
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); }); }; }
|
|
15
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
16
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
17
|
+
function fulfill(value) { resume("next", value); }
|
|
18
|
+
function reject(value) { resume("throw", value); }
|
|
19
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
2
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
25
|
exports.indexVcf = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
26
|
const util_1 = require("../util");
|
|
6
27
|
const cli_progress_1 = require("cli-progress");
|
|
7
28
|
const zlib_1 = require("zlib");
|
|
8
|
-
const readline_1 =
|
|
29
|
+
const readline_1 = __importDefault(require("readline"));
|
|
9
30
|
function indexVcf(config, attributesToIndex, inLocation, outLocation, typesToExclude, quiet) {
|
|
10
|
-
return
|
|
31
|
+
return __asyncGenerator(this, arguments, function* indexVcf_1() {
|
|
11
32
|
var e_1, _a;
|
|
12
33
|
const { trackId } = config;
|
|
13
34
|
// progress bar code was aided by blog post at
|
|
@@ -17,7 +38,7 @@ function indexVcf(config, attributesToIndex, inLocation, outLocation, typesToExc
|
|
|
17
38
|
etaBuffer: 2000,
|
|
18
39
|
}, cli_progress_1.Presets.shades_classic);
|
|
19
40
|
let receivedBytes = 0;
|
|
20
|
-
const { totalBytes, stream } = yield
|
|
41
|
+
const { totalBytes, stream } = yield __await((0, util_1.getLocalOrRemoteStream)(inLocation, outLocation));
|
|
21
42
|
if (!quiet) {
|
|
22
43
|
progressBar.start(totalBytes, 0);
|
|
23
44
|
}
|
|
@@ -32,7 +53,7 @@ function indexVcf(config, attributesToIndex, inLocation, outLocation, typesToExc
|
|
|
32
53
|
input: gzStream,
|
|
33
54
|
});
|
|
34
55
|
try {
|
|
35
|
-
for (var rl_1 =
|
|
56
|
+
for (var rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield __await(rl_1.next()), !rl_1_1.done;) {
|
|
36
57
|
const line = rl_1_1.value;
|
|
37
58
|
if (line.startsWith('#')) {
|
|
38
59
|
continue;
|
|
@@ -68,14 +89,14 @@ function indexVcf(config, attributesToIndex, inLocation, outLocation, typesToExc
|
|
|
68
89
|
encodeURIComponent(id || ''),
|
|
69
90
|
...infoAttrs.map(a => encodeURIComponent(a || '')),
|
|
70
91
|
]).replace(/,/g, '|');
|
|
71
|
-
yield yield
|
|
92
|
+
yield yield __await(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
72
93
|
}
|
|
73
94
|
}
|
|
74
95
|
}
|
|
75
96
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
76
97
|
finally {
|
|
77
98
|
try {
|
|
78
|
-
if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield
|
|
99
|
+
if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield __await(_a.call(rl_1));
|
|
79
100
|
}
|
|
80
101
|
finally { if (e_1) throw e_1.error; }
|
|
81
102
|
}
|
package/lib/util.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.getLocalOrRemoteStream = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
7
|
const common_1 = require("./types/common");
|
|
6
|
-
const fs_1 =
|
|
7
|
-
const path_1 =
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
8
10
|
async function getLocalOrRemoteStream(uri, out) {
|
|
9
11
|
let stream;
|
|
10
12
|
let totalBytes = 0;
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.7.9","commands":{"add-assembly":{"id":"add-assembly","description":"Add an assembly to a JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# add assembly to installation in current directory. assumes .fai file also exists, and copies GRCh38.fa and GRCh38.fa.fai to current directory","$ jbrowse add-assembly GRCh38.fa --load copy","","# add assembly to a specific jb2 installation path using --out, and copies the .fa and .fa.fai file to /path/to/jb2","$ jbrowse add-assembly GRCh38.fa --out /path/to/jb2/ --load copy","","# force indexedFasta for add-assembly without relying on file extension","$ jbrowse add-assembly GRCh38.xyz --type indexedFasta --load copy","","# add displayName for an assembly","$ jbrowse add-assembly myFile.fa.gz --name hg38 --displayName \"Homo sapiens (hg38)\"","","# use chrom.sizes file for assembly instead of a fasta file","$ jbrowse add-assembly GRCh38.chrom.sizes --load inPlace","","# add assembly from preconfigured json file, expert option","$ jbrowse add-assembly GRCh38.config.json --load copy","","# add assembly from a 2bit file, also note pointing direct to a URL so no --load flag needed","$ jbrowse add-assembly https://example.com/data/sample.2bit","","# add a bgzip indexed fasta inferred by fa.gz extension. assumes .fa.gz.gzi and .fa.gz.fai files also exists","$ jbrowse add-assembly myfile.fa.gz --load copy"],"flags":{"type":{"name":"type","type":"option","char":"t","description":"type of sequence, by default inferred from sequence file\n\nindexedFasta An index FASTA (e.g. .fa or .fasta) file;\n can optionally specify --faiLocation\n\nbgzipFasta A block-gzipped and indexed FASTA (e.g. .fa.gz or .fasta.gz) file;\n can optionally specify --faiLocation and/or --gziLocation\n\ntwoBit A twoBit (e.g. .2bit) file\n\nchromSizes A chromosome sizes (e.g. .chrom.sizes) file\n\ncustom Either a JSON file location or inline JSON that defines a custom\n sequence adapter; must provide --name if using inline JSON","options":["indexedFasta","bgzipFasta","twoBit","chromSizes","custom"]},"name":{"name":"name","type":"option","char":"n","description":"Name of the assembly; if not specified, will be guessed using the sequence file name"},"alias":{"name":"alias","type":"option","char":"a","description":"An alias for the assembly name (e.g. \"hg38\" if the name of the assembly is \"GRCh38\");\ncan be specified multiple times"},"displayName":{"name":"displayName","type":"option","description":"The display name to specify for the assembly, e.g. \"Homo sapiens (hg38)\" while the name can be a shorter identifier like \"hg38\""},"faiLocation":{"name":"faiLocation","type":"option","description":"[default: <fastaLocation>.fai] FASTA index file or URL"},"gziLocation":{"name":"gziLocation","type":"option","description":"[default: <fastaLocation>.gzi] FASTA gzip index file or URL"},"refNameAliases":{"name":"refNameAliases","type":"option","description":"Reference sequence name aliases file or URL; assumed to be a tab-separated aliases\nfile unless --refNameAliasesType is specified"},"refNameAliasesType":{"name":"refNameAliasesType","type":"option","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","options":["aliases","custom"]},"refNameColors":{"name":"refNameColors","type":"option","description":"A comma-separated list of color strings for the reference sequence names; will cycle\nthrough colors if there are fewer colors than sequences"},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to.\nCreates ./config.json if nonexistent"},"out":{"name":"out","type":"option","description":"synonym for target"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"load":{"name":"load","type":"option","char":"l","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","options":["copy","symlink","move","inPlace"]},"skipCheck":{"name":"skipCheck","type":"boolean","description":"Don't check whether or not the sequence file or URL exists or if you are in a JBrowse directory","allowNo":false},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrite existing assembly if one with the same name exists","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Equivalent to `--skipCheck --overwrite`","allowNo":false}},"args":[{"name":"sequence","description":"sequence file or URL\n\nIf TYPE is indexedFasta or bgzipFasta, the index file defaults to <location>.fai\nand can be optionally specified with --faiLocation\nIf TYPE is bgzipFasta, the gzip index file defaults to <location>.gzi and can be\noptionally specified with --gziLocation","required":true}]},"add-connection":{"id":"add-connection","description":"Add a connection to a JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse add-connection http://mysite.com/jbrowse/data/","$ jbrowse add-connection http://mysite.com/jbrowse/custom_data_folder/ --type JBrowse1Connection","$ jbrowse add-connection http://mysite.com/path/to/hub.txt --assemblyName hg19","$ jbrowse add-connection http://mysite.com/path/to/custom_hub_name.txt --type UCSCTrackHubConnection --assemblyName hg19","$ jbrowse add-connection http://mysite.com/path/to/custom --type custom --config '{\"uri\":{\"url\":\"https://mysite.com/path/to/custom\"}, \"locationType\": \"UriLocation\"}' --assemblyName hg19","$ jbrowse add-connection https://mysite.com/path/to/hub.txt --connectionId newId --name newName --target /path/to/jb2/installation/config.json"],"flags":{"type":{"name":"type","type":"option","char":"t","description":"type of connection, ex. JBrowse1Connection, UCSCTrackHubConnection, custom"},"assemblyName":{"name":"assemblyName","type":"option","char":"a","description":"Assembly name of the connection If none, will default to the assembly in your config file"},"config":{"name":"config","type":"option","char":"c","description":"Any extra config settings to add to connection in JSON object format, such as '{\"uri\":\"url\":\"https://sample.com\"}, \"locationType\": \"UriLocation\"}'"},"connectionId":{"name":"connectionId","type":"option","description":"Id for the connection that must be unique to JBrowse. Defaults to 'connectionType-assemblyName-currentTime'"},"name":{"name":"name","type":"option","char":"n","description":"Name of the connection. Defaults to connectionId if not provided"},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to."},"out":{"name":"out","type":"option","description":"synonym for target"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"skipCheck":{"name":"skipCheck","type":"boolean","description":"Don't check whether or not the data directory URL exists or if you are in a JBrowse directory","allowNo":false},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrites any existing connections if same connection id","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Equivalent to `--skipCheck --overwrite`","allowNo":false}},"args":[{"name":"connectionUrlOrPath","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/ ","required":true}]},"add-track-json":{"id":"add-track-json","description":"Add a track configuration directly from a JSON hunk to the JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse add-track-json track.json","$ jbrowse add-track-json track.json --update"],"flags":{"update":{"name":"update","type":"boolean","char":"u","description":"update the contents of an existing track, matched based on trackId","allowNo":false},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to.\nCreates ./config.json if nonexistent"},"out":{"name":"out","type":"option","description":"synonym for target"}},"args":[{"name":"track","description":"track JSON file or command line arg blob","required":true}]},"add-track":{"id":"add-track","description":"Add a track to a JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# copy /path/to/my.bam and /path/to/my.bam.bai to current directory and adds track to config.json","$ jbrowse add-track /path/to/my.bam --load copy","","# copy my.bam and my.bam.bai to /path/to/jb2/bam and adds track entry to /path/to/jb2/bam/config.json","$ jbrowse add-track my.bam --load copy --out /path/to/jb2 --subDir bam","","# same as above, but specify path to bai file. needed for if the bai file does not have the extension .bam.bai","$ jbrowse add-track my.bam --indexFile my.bai --load copy","","# creates symlink for /path/to/my.bam and adds track to config.json","$ jbrowse add-track /path/to/my.bam --load symlink","","# add track from URL to config.json, no --load flag needed","$ jbrowse add-track https://mywebsite.com/my.bam","","# --load inPlace adds a track without doing file operations","$ jbrowse add-track /url/relative/path.bam --load inPlace"],"flags":{"trackType":{"name":"trackType","type":"option","char":"t","description":"Type of track, by default inferred from track file"},"name":{"name":"name","type":"option","char":"n","description":"Name of the track. Will be defaulted to the trackId if none specified"},"indexFile":{"name":"indexFile","type":"option","description":"Optional index file for the track"},"description":{"name":"description","type":"option","char":"d","description":"Optional description of the track"},"assemblyNames":{"name":"assemblyNames","type":"option","char":"a","description":"Assembly name or names for track as comma separated string. If none, will default to the assembly in your config file"},"category":{"name":"category","type":"option","description":"Optional Comma separated string of categories to group tracks"},"config":{"name":"config","type":"option","description":"Any extra config settings to add to a track. i.e '{\"defaultRendering\": \"density\"}'"},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation to write out to."},"out":{"name":"out","type":"option","description":"synonym for target"},"subDir":{"name":"subDir","type":"option","description":"when using --load a file, output to a subdirectory of the target dir","default":""},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"trackId":{"name":"trackId","type":"option","description":"trackId for the track, by default inferred from filename, must be unique throughout config"},"load":{"name":"load","type":"option","char":"l","description":"Required flag when using a local file. Choose how to manage the track. Copy, symlink, or move the track to the JBrowse directory. Or inPlace to leave track alone","options":["copy","symlink","move","inPlace"]},"skipCheck":{"name":"skipCheck","type":"boolean","description":"Skip check for whether or not the file or URL exists or if you are in a JBrowse directory","allowNo":false},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrites existing track if it shares the same trackId","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Equivalent to `--skipCheck --overwrite`","allowNo":false},"protocol":{"name":"protocol","type":"option","description":"Force protocol to a specific value","default":"uri"}},"args":[{"name":"track","description":"Track file or URL","required":true}]},"admin-server":{"id":"admin-server","description":"Start up a small admin server for JBrowse configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse admin-server","$ jbrowse admin-server -p 8888"],"flags":{"port":{"name":"port","type":"option","char":"p","description":"Specifified port to start the server on;\nDefault is 9090."},"root":{"name":"root","type":"option","description":"path to the root of the JB2 installation.\nCreates ./config.json if nonexistent. note that you can navigate to ?config=path/to/subconfig.json in the web browser and it will write to rootDir/path/to/subconfig.json"},"bodySizeLimit":{"name":"bodySizeLimit","type":"option","description":"Size limit of the update message; may need to increase if config is large.\nArgument is passed to bytes library for parsing: https://www.npmjs.com/package/bytes.","default":"25mb"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"create":{"id":"create","description":"Downloads and installs the latest JBrowse 2 release","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# Download latest release from github, and put in specific path","$ jbrowse create /path/to/new/installation","","# Download latest release from github and force overwrite existing contents at path","$ jbrowse create /path/to/new/installation --force","","# Download latest release from a specific URL","$ jbrowse create /path/to/new/installation --url url.com/directjbrowselink.zip","","# Download a specific tag from github","$ jbrowse create /path/to/new/installation --tag v1.0.0","","# List available versions","$ jbrowse create --listVersions"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Overwrites existing JBrowse 2 installation if present in path","allowNo":false},"listVersions":{"name":"listVersions","type":"boolean","char":"l","description":"Lists out all versions of JBrowse 2","allowNo":false},"branch":{"name":"branch","type":"option","description":"Download a development build from a named git branch"},"nightly":{"name":"nightly","type":"boolean","description":"Download the latest development build from the main branch","allowNo":false},"url":{"name":"url","type":"option","char":"u","description":"A direct URL to a JBrowse 2 release"},"tag":{"name":"tag","type":"option","char":"t","description":"Version of JBrowse 2 to install. Format is v1.0.0.\nDefaults to latest"}},"args":[{"name":"localPath","description":"Location where JBrowse 2 will be installed","required":true}]},"set-default-session":{"id":"set-default-session","description":"Set a default session with views and tracks","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse set-default-session --session /path/to/default/session.json","$ jbrowse set-default-session --target /path/to/jb2/installation/config.json --view LinearGenomeView --tracks track1, track2, track3","$ jbrowse set-default-session --view LinearGenomeView, --name newName --viewId view-no-tracks","$ jbrowse set-default-session --currentSession # Prints out current default session"],"flags":{"session":{"name":"session","type":"option","char":"s","description":"set path to a file containing session in json format"},"name":{"name":"name","type":"option","char":"n","description":"Give a name for the default session","default":"New Default Session"},"view":{"name":"view","type":"option","char":"v","description":"View type in config to be added as default session, i.e LinearGenomeView, CircularView, DotplotView.\nMust be provided if no default session file provided"},"viewId":{"name":"viewId","type":"option","description":"Identifier for the view. Will be generated on default"},"tracks":{"name":"tracks","type":"option","char":"t","description":"Track id or track ids as comma separated string to put into default session"},"currentSession":{"name":"currentSession","type":"boolean","char":"c","description":"List out the current default session","allowNo":false},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to"},"out":{"name":"out","type":"option","description":"synonym for target"},"delete":{"name":"delete","type":"boolean","description":"Delete any existing default session.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"text-index":{"id":"text-index","description":"Make a text-indexing file for any given track(s).","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# indexes all tracks that it can find in the current directory's config.json","$ jbrowse text-index","","# indexes specific trackIds that it can find in the current directory's config.json","$ jbrowse text-index --tracks=track1,track2,track3","","# indexes all tracks in a directory's config.json or in a specific config file","$ jbrowse text-index --out /path/to/jb2/","","# indexes only a specific assembly, and overwrite what was previously there using force (which is needed if a previous index already existed)","$ jbrowse text-index -a hg19 --force","","# create index for some files for use in @jbrowse/react-linear-genome-view or similar","$ jbrowse text-index --file myfile.gff3.gz --file myfile.vcfgz --out indexes"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"tracks":{"name":"tracks","type":"option","description":"Specific tracks to index, formatted as comma separated trackIds. If unspecified, indexes all available tracks"},"target":{"name":"target","type":"option","description":"Path to config file in JB2 installation directory to read from."},"out":{"name":"out","type":"option","description":"Synonym for target"},"attributes":{"name":"attributes","type":"option","description":"Comma separated list of attributes to index","default":"Name,ID"},"assemblies":{"name":"assemblies","type":"option","char":"a","description":"Specify the assembl(ies) to create an index for. If unspecified, creates an index for each assembly in the config"},"force":{"name":"force","type":"boolean","description":"Overwrite previously existing indexes","allowNo":false},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"Hide the progress bars","allowNo":false},"perTrack":{"name":"perTrack","type":"boolean","description":"If set, creates an index per track","allowNo":false},"exclude":{"name":"exclude","type":"option","description":"Adds gene type to list of excluded types","default":"CDS,exon"},"prefixSize":{"name":"prefixSize","type":"option","description":"Specify the prefix size for the ixx index, increase size if many of your gene IDs have same prefix e.g. Z000000001, Z000000002","default":6},"file":{"name":"file","type":"option","description":"File or files to index (can be used to create trix indexes for embedded component use cases not using a config.json for example)"},"dryrun":{"name":"dryrun","type":"boolean","description":"Just print out tracks that will be indexed by the process, without doing any indexing","allowNo":false}},"args":[]},"upgrade":{"id":"upgrade","description":"Upgrades JBrowse 2 to latest version","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# Upgrades current directory to latest jbrowse release","$ jbrowse upgrade","","# Upgrade jbrowse instance at a specific filesystem path","$ jbrowse upgrade /path/to/jbrowse2/installation","","# Upgrade to a specific tag","$ jbrowse upgrade /path/to/jbrowse2/installation --tag v1.0.0","","# List versions available on github","$ jbrowse upgrade --listVersions","","# Upgrade from a specific URL","$ jbrowse upgrade --url https://sample.com/jbrowse2.zip","","# Get nightly release from main branch","$ jbrowse upgrade --nightly"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"listVersions":{"name":"listVersions","type":"boolean","char":"l","description":"Lists out all versions of JBrowse 2","allowNo":false},"tag":{"name":"tag","type":"option","char":"t","description":"Version of JBrowse 2 to install. Format is v1.0.0.\nDefaults to latest"},"branch":{"name":"branch","type":"option","description":"Download a development build from a named git branch"},"nightly":{"name":"nightly","type":"boolean","description":"Download the latest development build from the main branch","allowNo":false},"clean":{"name":"clean","type":"boolean","description":"Removes old js,map,and LICENSE files in the installation","allowNo":false},"url":{"name":"url","type":"option","char":"u","description":"A direct URL to a JBrowse 2 release"}},"args":[{"name":"localPath","description":"Location where JBrowse 2 is installed","required":false,"default":"."}]}}}
|
|
1
|
+
{"version":"2.0.0","commands":{"add-assembly":{"id":"add-assembly","description":"Add an assembly to a JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# add assembly to installation in current directory. assumes .fai file also exists, and copies GRCh38.fa and GRCh38.fa.fai to current directory","$ jbrowse add-assembly GRCh38.fa --load copy","","# add assembly to a specific jb2 installation path using --out, and copies the .fa and .fa.fai file to /path/to/jb2","$ jbrowse add-assembly GRCh38.fa --out /path/to/jb2/ --load copy","","# force indexedFasta for add-assembly without relying on file extension","$ jbrowse add-assembly GRCh38.xyz --type indexedFasta --load copy","","# add displayName for an assembly","$ jbrowse add-assembly myFile.fa.gz --name hg38 --displayName \"Homo sapiens (hg38)\"","","# use chrom.sizes file for assembly instead of a fasta file","$ jbrowse add-assembly GRCh38.chrom.sizes --load inPlace","","# add assembly from preconfigured json file, expert option","$ jbrowse add-assembly GRCh38.config.json --load copy","","# add assembly from a 2bit file, also note pointing direct to a URL so no --load flag needed","$ jbrowse add-assembly https://example.com/data/sample.2bit","","# add a bgzip indexed fasta inferred by fa.gz extension. assumes .fa.gz.gzi and .fa.gz.fai files also exists","$ jbrowse add-assembly myfile.fa.gz --load copy"],"flags":{"type":{"name":"type","type":"option","char":"t","description":"type of sequence, by default inferred from sequence file\n\nindexedFasta An index FASTA (e.g. .fa or .fasta) file;\n can optionally specify --faiLocation\n\nbgzipFasta A block-gzipped and indexed FASTA (e.g. .fa.gz or .fasta.gz) file;\n can optionally specify --faiLocation and/or --gziLocation\n\ntwoBit A twoBit (e.g. .2bit) file\n\nchromSizes A chromosome sizes (e.g. .chrom.sizes) file\n\ncustom Either a JSON file location or inline JSON that defines a custom\n sequence adapter; must provide --name if using inline JSON","options":["indexedFasta","bgzipFasta","twoBit","chromSizes","custom"]},"name":{"name":"name","type":"option","char":"n","description":"Name of the assembly; if not specified, will be guessed using the sequence file name"},"alias":{"name":"alias","type":"option","char":"a","description":"An alias for the assembly name (e.g. \"hg38\" if the name of the assembly is \"GRCh38\");\ncan be specified multiple times"},"displayName":{"name":"displayName","type":"option","description":"The display name to specify for the assembly, e.g. \"Homo sapiens (hg38)\" while the name can be a shorter identifier like \"hg38\""},"faiLocation":{"name":"faiLocation","type":"option","description":"[default: <fastaLocation>.fai] FASTA index file or URL"},"gziLocation":{"name":"gziLocation","type":"option","description":"[default: <fastaLocation>.gzi] FASTA gzip index file or URL"},"refNameAliases":{"name":"refNameAliases","type":"option","description":"Reference sequence name aliases file or URL; assumed to be a tab-separated aliases\nfile unless --refNameAliasesType is specified"},"refNameAliasesType":{"name":"refNameAliasesType","type":"option","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","options":["aliases","custom"]},"refNameColors":{"name":"refNameColors","type":"option","description":"A comma-separated list of color strings for the reference sequence names; will cycle\nthrough colors if there are fewer colors than sequences"},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to.\nCreates ./config.json if nonexistent"},"out":{"name":"out","type":"option","description":"synonym for target"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"load":{"name":"load","type":"option","char":"l","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","options":["copy","symlink","move","inPlace"]},"skipCheck":{"name":"skipCheck","type":"boolean","description":"Don't check whether or not the sequence file or URL exists or if you are in a JBrowse directory","allowNo":false},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrite existing assembly if one with the same name exists","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Equivalent to `--skipCheck --overwrite`","allowNo":false}},"args":[{"name":"sequence","description":"sequence file or URL\n\nIf TYPE is indexedFasta or bgzipFasta, the index file defaults to <location>.fai\nand can be optionally specified with --faiLocation\nIf TYPE is bgzipFasta, the gzip index file defaults to <location>.gzi and can be\noptionally specified with --gziLocation","required":true}]},"add-connection":{"id":"add-connection","description":"Add a connection to a JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse add-connection http://mysite.com/jbrowse/data/","$ jbrowse add-connection http://mysite.com/jbrowse/custom_data_folder/ --type JBrowse1Connection","$ jbrowse add-connection http://mysite.com/path/to/hub.txt --assemblyName hg19","$ jbrowse add-connection http://mysite.com/path/to/custom_hub_name.txt --type UCSCTrackHubConnection --assemblyName hg19","$ jbrowse add-connection http://mysite.com/path/to/custom --type custom --config '{\"uri\":{\"url\":\"https://mysite.com/path/to/custom\"}, \"locationType\": \"UriLocation\"}' --assemblyName hg19","$ jbrowse add-connection https://mysite.com/path/to/hub.txt --connectionId newId --name newName --target /path/to/jb2/installation/config.json"],"flags":{"type":{"name":"type","type":"option","char":"t","description":"type of connection, ex. JBrowse1Connection, UCSCTrackHubConnection, custom"},"assemblyName":{"name":"assemblyName","type":"option","char":"a","description":"Assembly name of the connection If none, will default to the assembly in your config file"},"config":{"name":"config","type":"option","char":"c","description":"Any extra config settings to add to connection in JSON object format, such as '{\"uri\":\"url\":\"https://sample.com\"}, \"locationType\": \"UriLocation\"}'"},"connectionId":{"name":"connectionId","type":"option","description":"Id for the connection that must be unique to JBrowse. Defaults to 'connectionType-assemblyName-currentTime'"},"name":{"name":"name","type":"option","char":"n","description":"Name of the connection. Defaults to connectionId if not provided"},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to."},"out":{"name":"out","type":"option","description":"synonym for target"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"skipCheck":{"name":"skipCheck","type":"boolean","description":"Don't check whether or not the data directory URL exists or if you are in a JBrowse directory","allowNo":false},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrites any existing connections if same connection id","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Equivalent to `--skipCheck --overwrite`","allowNo":false}},"args":[{"name":"connectionUrlOrPath","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/ ","required":true}]},"add-track-json":{"id":"add-track-json","description":"Add a track configuration directly from a JSON hunk to the JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse add-track-json track.json","$ jbrowse add-track-json track.json --update"],"flags":{"update":{"name":"update","type":"boolean","char":"u","description":"update the contents of an existing track, matched based on trackId","allowNo":false},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to.\nCreates ./config.json if nonexistent"},"out":{"name":"out","type":"option","description":"synonym for target"}},"args":[{"name":"track","description":"track JSON file or command line arg blob","required":true}]},"add-track":{"id":"add-track","description":"Add a track to a JBrowse 2 configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# copy /path/to/my.bam and /path/to/my.bam.bai to current directory and adds track to config.json","$ jbrowse add-track /path/to/my.bam --load copy","","# copy my.bam and my.bam.bai to /path/to/jb2/bam and adds track entry to /path/to/jb2/bam/config.json","$ jbrowse add-track my.bam --load copy --out /path/to/jb2 --subDir bam","","# same as above, but specify path to bai file. needed for if the bai file does not have the extension .bam.bai","$ jbrowse add-track my.bam --indexFile my.bai --load copy","","# creates symlink for /path/to/my.bam and adds track to config.json","$ jbrowse add-track /path/to/my.bam --load symlink","","# add track from URL to config.json, no --load flag needed","$ jbrowse add-track https://mywebsite.com/my.bam","","# --load inPlace adds a track without doing file operations","$ jbrowse add-track /url/relative/path.bam --load inPlace"],"flags":{"trackType":{"name":"trackType","type":"option","char":"t","description":"Type of track, by default inferred from track file"},"name":{"name":"name","type":"option","char":"n","description":"Name of the track. Will be defaulted to the trackId if none specified"},"indexFile":{"name":"indexFile","type":"option","description":"Optional index file for the track"},"description":{"name":"description","type":"option","char":"d","description":"Optional description of the track"},"assemblyNames":{"name":"assemblyNames","type":"option","char":"a","description":"Assembly name or names for track as comma separated string. If none, will default to the assembly in your config file"},"category":{"name":"category","type":"option","description":"Optional Comma separated string of categories to group tracks"},"config":{"name":"config","type":"option","description":"Any extra config settings to add to a track. i.e '{\"defaultRendering\": \"density\"}'"},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation to write out to."},"out":{"name":"out","type":"option","description":"synonym for target"},"subDir":{"name":"subDir","type":"option","description":"when using --load a file, output to a subdirectory of the target dir","default":""},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"trackId":{"name":"trackId","type":"option","description":"trackId for the track, by default inferred from filename, must be unique throughout config"},"load":{"name":"load","type":"option","char":"l","description":"Required flag when using a local file. Choose how to manage the track. Copy, symlink, or move the track to the JBrowse directory. Or inPlace to leave track alone","options":["copy","symlink","move","inPlace"]},"skipCheck":{"name":"skipCheck","type":"boolean","description":"Skip check for whether or not the file or URL exists or if you are in a JBrowse directory","allowNo":false},"overwrite":{"name":"overwrite","type":"boolean","description":"Overwrites existing track if it shares the same trackId","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Equivalent to `--skipCheck --overwrite`","allowNo":false},"protocol":{"name":"protocol","type":"option","description":"Force protocol to a specific value","default":"uri"}},"args":[{"name":"track","description":"Track file or URL","required":true}]},"admin-server":{"id":"admin-server","description":"Start up a small admin server for JBrowse configuration","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse admin-server","$ jbrowse admin-server -p 8888"],"flags":{"port":{"name":"port","type":"option","char":"p","description":"Specifified port to start the server on;\nDefault is 9090."},"root":{"name":"root","type":"option","description":"path to the root of the JB2 installation.\nCreates ./config.json if nonexistent. note that you can navigate to ?config=path/to/subconfig.json in the web browser and it will write to rootDir/path/to/subconfig.json"},"bodySizeLimit":{"name":"bodySizeLimit","type":"option","description":"Size limit of the update message; may need to increase if config is large.\nArgument is passed to bytes library for parsing: https://www.npmjs.com/package/bytes.","default":"25mb"},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"create":{"id":"create","description":"Downloads and installs the latest JBrowse 2 release","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# Download latest release from github, and put in specific path","$ jbrowse create /path/to/new/installation","","# Download latest release from github and force overwrite existing contents at path","$ jbrowse create /path/to/new/installation --force","","# Download latest release from a specific URL","$ jbrowse create /path/to/new/installation --url url.com/directjbrowselink.zip","","# Download a specific tag from github","$ jbrowse create /path/to/new/installation --tag v1.0.0","","# List available versions","$ jbrowse create --listVersions"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Overwrites existing JBrowse 2 installation if present in path","allowNo":false},"listVersions":{"name":"listVersions","type":"boolean","char":"l","description":"Lists out all versions of JBrowse 2","allowNo":false},"branch":{"name":"branch","type":"option","description":"Download a development build from a named git branch"},"nightly":{"name":"nightly","type":"boolean","description":"Download the latest development build from the main branch","allowNo":false},"url":{"name":"url","type":"option","char":"u","description":"A direct URL to a JBrowse 2 release"},"tag":{"name":"tag","type":"option","char":"t","description":"Version of JBrowse 2 to install. Format is v1.0.0.\nDefaults to latest"}},"args":[{"name":"localPath","description":"Location where JBrowse 2 will be installed","required":true}]},"set-default-session":{"id":"set-default-session","description":"Set a default session with views and tracks","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["$ jbrowse set-default-session --session /path/to/default/session.json","$ jbrowse set-default-session --target /path/to/jb2/installation/config.json --view LinearGenomeView --tracks track1, track2, track3","$ jbrowse set-default-session --view LinearGenomeView, --name newName --viewId view-no-tracks","$ jbrowse set-default-session --currentSession # Prints out current default session"],"flags":{"session":{"name":"session","type":"option","char":"s","description":"set path to a file containing session in json format"},"name":{"name":"name","type":"option","char":"n","description":"Give a name for the default session","default":"New Default Session"},"view":{"name":"view","type":"option","char":"v","description":"View type in config to be added as default session, i.e LinearGenomeView, CircularView, DotplotView.\nMust be provided if no default session file provided"},"viewId":{"name":"viewId","type":"option","description":"Identifier for the view. Will be generated on default"},"tracks":{"name":"tracks","type":"option","char":"t","description":"Track id or track ids as comma separated string to put into default session"},"currentSession":{"name":"currentSession","type":"boolean","char":"c","description":"List out the current default session","allowNo":false},"target":{"name":"target","type":"option","description":"path to config file in JB2 installation directory to write out to"},"out":{"name":"out","type":"option","description":"synonym for target"},"delete":{"name":"delete","type":"boolean","description":"Delete any existing default session.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"text-index":{"id":"text-index","description":"Make a text-indexing file for any given track(s).","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# indexes all tracks that it can find in the current directory's config.json","$ jbrowse text-index","","# indexes specific trackIds that it can find in the current directory's config.json","$ jbrowse text-index --tracks=track1,track2,track3","","# indexes all tracks in a directory's config.json or in a specific config file","$ jbrowse text-index --out /path/to/jb2/","","# indexes only a specific assembly, and overwrite what was previously there using force (which is needed if a previous index already existed)","$ jbrowse text-index -a hg19 --force","","# create index for some files for use in @jbrowse/react-linear-genome-view or similar","$ jbrowse text-index --file myfile.gff3.gz --file myfile.vcfgz --out indexes"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"tracks":{"name":"tracks","type":"option","description":"Specific tracks to index, formatted as comma separated trackIds. If unspecified, indexes all available tracks"},"target":{"name":"target","type":"option","description":"Path to config file in JB2 installation directory to read from."},"out":{"name":"out","type":"option","description":"Synonym for target"},"attributes":{"name":"attributes","type":"option","description":"Comma separated list of attributes to index","default":"Name,ID"},"assemblies":{"name":"assemblies","type":"option","char":"a","description":"Specify the assembl(ies) to create an index for. If unspecified, creates an index for each assembly in the config"},"force":{"name":"force","type":"boolean","description":"Overwrite previously existing indexes","allowNo":false},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"Hide the progress bars","allowNo":false},"perTrack":{"name":"perTrack","type":"boolean","description":"If set, creates an index per track","allowNo":false},"exclude":{"name":"exclude","type":"option","description":"Adds gene type to list of excluded types","default":"CDS,exon"},"prefixSize":{"name":"prefixSize","type":"option","description":"Specify the prefix size for the ixx index, increase size if many of your gene IDs have same prefix e.g. Z000000001, Z000000002","default":6},"file":{"name":"file","type":"option","description":"File or files to index (can be used to create trix indexes for embedded component use cases not using a config.json for example)"},"fileId":{"name":"fileId","type":"option","description":"Set the trackId used for the indexes generated with the --file argument"},"dryrun":{"name":"dryrun","type":"boolean","description":"Just print out tracks that will be indexed by the process, without doing any indexing","allowNo":false}},"args":[]},"upgrade":{"id":"upgrade","description":"Upgrades JBrowse 2 to latest version","pluginName":"@jbrowse/cli","pluginType":"core","aliases":[],"examples":["# Upgrades current directory to latest jbrowse release","$ jbrowse upgrade","","# Upgrade jbrowse instance at a specific filesystem path","$ jbrowse upgrade /path/to/jbrowse2/installation","","# Upgrade to a specific tag","$ jbrowse upgrade /path/to/jbrowse2/installation --tag v1.0.0","","# List versions available on github","$ jbrowse upgrade --listVersions","","# Upgrade from a specific URL","$ jbrowse upgrade --url https://sample.com/jbrowse2.zip","","# Get nightly release from main branch","$ jbrowse upgrade --nightly"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"listVersions":{"name":"listVersions","type":"boolean","char":"l","description":"Lists out all versions of JBrowse 2","allowNo":false},"tag":{"name":"tag","type":"option","char":"t","description":"Version of JBrowse 2 to install. Format is v1.0.0.\nDefaults to latest"},"branch":{"name":"branch","type":"option","description":"Download a development build from a named git branch"},"nightly":{"name":"nightly","type":"boolean","description":"Download the latest development build from the main branch","allowNo":false},"clean":{"name":"clean","type":"boolean","description":"Removes old js,map,and LICENSE files in the installation","allowNo":false},"url":{"name":"url","type":"option","char":"u","description":"A direct URL to a JBrowse 2 release"}},"args":[{"name":"localPath","description":"Location where JBrowse 2 is installed","required":false,"default":"."}]}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A command line tool for working with JBrowse 2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"json-parse-better-errors": "^1.0.2",
|
|
59
59
|
"node-fetch": "^2.6.0",
|
|
60
60
|
"object.fromentries": "^2.0.5",
|
|
61
|
+
"proxy-agent": "^5.0.0",
|
|
61
62
|
"rimraf": "^3.0.2",
|
|
62
63
|
"tslib": "^2.3.1",
|
|
63
64
|
"unzipper": "^0.10.11"
|
|
@@ -76,5 +77,5 @@
|
|
|
76
77
|
"publishConfig": {
|
|
77
78
|
"access": "public"
|
|
78
79
|
},
|
|
79
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "ecc7f5d47351a5ea04bc00f3a6eb6dfb607342e6"
|
|
80
81
|
}
|