@jbrowse/cli 2.5.0 → 2.6.2
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 +30 -31
- package/lib/base.js +16 -26
- package/lib/commands/add-connection.js +31 -78
- package/lib/commands/create.js +4 -3
- package/lib/commands/upgrade.js +2 -2
- package/lib/fetchWithProxy.js +4 -2
- package/lib/types/gff3Adapter.js +35 -37
- package/lib/types/vcfAdapter.js +36 -41
- package/oclif.manifest.json +1 -1
- package/package.json +6 -6
- package/lib/base.d.ts +0 -129
- package/lib/commands/add-assembly.d.ts +0 -35
- package/lib/commands/add-connection.d.ts +0 -29
- package/lib/commands/add-track-json.d.ts +0 -18
- package/lib/commands/add-track.d.ts +0 -819
- package/lib/commands/admin-server.d.ts +0 -13
- package/lib/commands/create.d.ts +0 -23
- package/lib/commands/remove-track.d.ts +0 -17
- package/lib/commands/set-default-session.d.ts +0 -22
- package/lib/commands/text-index.d.ts +0 -52
- package/lib/commands/upgrade.d.ts +0 -22
- package/lib/fetchWithProxy.d.ts +0 -2
- package/lib/index.d.ts +0 -1
- package/lib/types/common.d.ts +0 -13
- package/lib/types/gff3Adapter.d.ts +0 -9
- package/lib/types/vcfAdapter.d.ts +0 -9
- package/lib/util.d.ts +0 -7
package/README.md
CHANGED
|
@@ -173,7 +173,7 @@ EXAMPLES
|
|
|
173
173
|
```
|
|
174
174
|
|
|
175
175
|
_See code:
|
|
176
|
-
[src/commands/add-assembly.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
176
|
+
[src/commands/add-assembly.ts](https://github.com/GMOD/jbrowse-components/blob/v2.6.2/products/jbrowse-cli/src/commands/add-assembly.ts)_
|
|
177
177
|
|
|
178
178
|
## `jbrowse add-connection CONNECTIONURLORPATH`
|
|
179
179
|
|
|
@@ -189,46 +189,45 @@ ARGUMENTS
|
|
|
189
189
|
For JBrowse 1, location of JB1 data directory similar to http://mysite.com/jbrowse/data/
|
|
190
190
|
|
|
191
191
|
OPTIONS
|
|
192
|
-
-a, --
|
|
193
|
-
|
|
192
|
+
-a, --assemblyNames=assemblyNames For UCSC, optional: Comma separated list of assembly name(s) to filter from this
|
|
193
|
+
connection. For JBrowse: a single assembly name
|
|
194
194
|
|
|
195
|
-
-c, --config=config
|
|
196
|
-
|
|
195
|
+
-c, --config=config Any extra config settings to add to connection in JSON object format, such as
|
|
196
|
+
'{"uri":"url":"https://sample.com"}, "locationType": "UriLocation"}'
|
|
197
197
|
|
|
198
|
-
-f, --force
|
|
198
|
+
-f, --force Equivalent to `--skipCheck --overwrite`
|
|
199
199
|
|
|
200
|
-
-h, --help
|
|
200
|
+
-h, --help show CLI help
|
|
201
201
|
|
|
202
|
-
-n, --name=name
|
|
202
|
+
-n, --name=name Name of the connection. Defaults to connectionId if not provided
|
|
203
203
|
|
|
204
|
-
-t, --type=type
|
|
204
|
+
-t, --type=type type of connection, ex. JBrowse1Connection, UCSCTrackHubConnection, custom
|
|
205
205
|
|
|
206
|
-
--connectionId=connectionId
|
|
207
|
-
|
|
206
|
+
--connectionId=connectionId Id for the connection that must be unique to JBrowse. Defaults to
|
|
207
|
+
'connectionType-assemblyName-currentTime'
|
|
208
208
|
|
|
209
|
-
--out=out
|
|
209
|
+
--out=out synonym for target
|
|
210
210
|
|
|
211
|
-
--overwrite
|
|
211
|
+
--overwrite Overwrites any existing connections if same connection id
|
|
212
212
|
|
|
213
|
-
--skipCheck
|
|
214
|
-
|
|
213
|
+
--skipCheck Don't check whether or not the data directory URL exists or if you are in a JBrowse
|
|
214
|
+
directory
|
|
215
215
|
|
|
216
|
-
--target=target
|
|
216
|
+
--target=target path to config file in JB2 installation directory to write out to.
|
|
217
217
|
|
|
218
218
|
EXAMPLES
|
|
219
|
-
$ jbrowse add-connection http://mysite.com/jbrowse/data/
|
|
220
|
-
$ jbrowse add-connection http://mysite.com/jbrowse/custom_data_folder/ --type JBrowse1Connection
|
|
221
|
-
$ jbrowse add-connection http://mysite.com/path/to/hub.txt
|
|
222
|
-
$ jbrowse add-connection http://mysite.com/path/to/custom_hub_name.txt --type UCSCTrackHubConnection
|
|
223
|
-
hg19
|
|
219
|
+
$ jbrowse add-connection http://mysite.com/jbrowse/data/ -a hg19
|
|
220
|
+
$ jbrowse add-connection http://mysite.com/jbrowse/custom_data_folder/ --type JBrowse1Connection -a hg38
|
|
221
|
+
$ jbrowse add-connection http://mysite.com/path/to/hub.txt
|
|
222
|
+
$ jbrowse add-connection http://mysite.com/path/to/custom_hub_name.txt --type UCSCTrackHubConnection
|
|
224
223
|
$ jbrowse add-connection http://mysite.com/path/to/custom --type custom --config
|
|
225
|
-
'{"uri":{"url":"https://mysite.com/path/to/custom"}, "locationType": "UriLocation"}'
|
|
224
|
+
'{"uri":{"url":"https://mysite.com/path/to/custom"}, "locationType": "UriLocation"}' -a hg19
|
|
226
225
|
$ jbrowse add-connection https://mysite.com/path/to/hub.txt --connectionId newId --name newName --target
|
|
227
226
|
/path/to/jb2/installation/config.json
|
|
228
227
|
```
|
|
229
228
|
|
|
230
229
|
_See code:
|
|
231
|
-
[src/commands/add-connection.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
230
|
+
[src/commands/add-connection.ts](https://github.com/GMOD/jbrowse-components/blob/v2.6.2/products/jbrowse-cli/src/commands/add-connection.ts)_
|
|
232
231
|
|
|
233
232
|
## `jbrowse add-track TRACK`
|
|
234
233
|
|
|
@@ -307,7 +306,7 @@ EXAMPLES
|
|
|
307
306
|
```
|
|
308
307
|
|
|
309
308
|
_See code:
|
|
310
|
-
[src/commands/add-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
309
|
+
[src/commands/add-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.6.2/products/jbrowse-cli/src/commands/add-track.ts)_
|
|
311
310
|
|
|
312
311
|
## `jbrowse add-track-json TRACK`
|
|
313
312
|
|
|
@@ -334,7 +333,7 @@ EXAMPLES
|
|
|
334
333
|
```
|
|
335
334
|
|
|
336
335
|
_See code:
|
|
337
|
-
[src/commands/add-track-json.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
336
|
+
[src/commands/add-track-json.ts](https://github.com/GMOD/jbrowse-components/blob/v2.6.2/products/jbrowse-cli/src/commands/add-track-json.ts)_
|
|
338
337
|
|
|
339
338
|
## `jbrowse admin-server`
|
|
340
339
|
|
|
@@ -365,7 +364,7 @@ EXAMPLES
|
|
|
365
364
|
```
|
|
366
365
|
|
|
367
366
|
_See code:
|
|
368
|
-
[src/commands/admin-server.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
367
|
+
[src/commands/admin-server.ts](https://github.com/GMOD/jbrowse-components/blob/v2.6.2/products/jbrowse-cli/src/commands/admin-server.ts)_
|
|
369
368
|
|
|
370
369
|
## `jbrowse create LOCALPATH`
|
|
371
370
|
|
|
@@ -410,7 +409,7 @@ EXAMPLES
|
|
|
410
409
|
```
|
|
411
410
|
|
|
412
411
|
_See code:
|
|
413
|
-
[src/commands/create.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
412
|
+
[src/commands/create.ts](https://github.com/GMOD/jbrowse-components/blob/v2.6.2/products/jbrowse-cli/src/commands/create.ts)_
|
|
414
413
|
|
|
415
414
|
## `jbrowse help [COMMAND]`
|
|
416
415
|
|
|
@@ -453,7 +452,7 @@ EXAMPLE
|
|
|
453
452
|
```
|
|
454
453
|
|
|
455
454
|
_See code:
|
|
456
|
-
[src/commands/remove-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
455
|
+
[src/commands/remove-track.ts](https://github.com/GMOD/jbrowse-components/blob/v2.6.2/products/jbrowse-cli/src/commands/remove-track.ts)_
|
|
457
456
|
|
|
458
457
|
## `jbrowse set-default-session`
|
|
459
458
|
|
|
@@ -491,7 +490,7 @@ EXAMPLES
|
|
|
491
490
|
```
|
|
492
491
|
|
|
493
492
|
_See code:
|
|
494
|
-
[src/commands/set-default-session.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
493
|
+
[src/commands/set-default-session.ts](https://github.com/GMOD/jbrowse-components/blob/v2.6.2/products/jbrowse-cli/src/commands/set-default-session.ts)_
|
|
495
494
|
|
|
496
495
|
## `jbrowse text-index`
|
|
497
496
|
|
|
@@ -555,7 +554,7 @@ EXAMPLES
|
|
|
555
554
|
```
|
|
556
555
|
|
|
557
556
|
_See code:
|
|
558
|
-
[src/commands/text-index.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
557
|
+
[src/commands/text-index.ts](https://github.com/GMOD/jbrowse-components/blob/v2.6.2/products/jbrowse-cli/src/commands/text-index.ts)_
|
|
559
558
|
|
|
560
559
|
## `jbrowse upgrade [LOCALPATH]`
|
|
561
560
|
|
|
@@ -604,7 +603,7 @@ EXAMPLES
|
|
|
604
603
|
```
|
|
605
604
|
|
|
606
605
|
_See code:
|
|
607
|
-
[src/commands/upgrade.ts](https://github.com/GMOD/jbrowse-components/blob/v2.
|
|
606
|
+
[src/commands/upgrade.ts](https://github.com/GMOD/jbrowse-components/blob/v2.6.2/products/jbrowse-cli/src/commands/upgrade.ts)_
|
|
608
607
|
|
|
609
608
|
<!-- commandsstop -->
|
|
610
609
|
|
package/lib/base.js
CHANGED
|
@@ -118,16 +118,11 @@ class JBrowseCommand extends command_1.default {
|
|
|
118
118
|
var _a, e_1, _b, _c;
|
|
119
119
|
let versions = [];
|
|
120
120
|
try {
|
|
121
|
-
for (var _d = true, _e = __asyncValues(this.fetchVersions()), _f; _f = await _e.next(), _a = _f.done, !_a;) {
|
|
121
|
+
for (var _d = true, _e = __asyncValues(this.fetchVersions()), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
|
|
122
122
|
_c = _f.value;
|
|
123
123
|
_d = false;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
versions = [...versions, ...iter];
|
|
127
|
-
}
|
|
128
|
-
finally {
|
|
129
|
-
_d = true;
|
|
130
|
-
}
|
|
124
|
+
const iter = _c;
|
|
125
|
+
versions = [...versions, ...iter];
|
|
131
126
|
}
|
|
132
127
|
}
|
|
133
128
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -143,27 +138,22 @@ class JBrowseCommand extends command_1.default {
|
|
|
143
138
|
var _a, e_2, _b, _c;
|
|
144
139
|
var _d;
|
|
145
140
|
try {
|
|
146
|
-
for (var _e = true, _f = __asyncValues(this.fetchVersions()), _g; _g = await _f.next(), _a = _g.done, !_a;) {
|
|
141
|
+
for (var _e = true, _f = __asyncValues(this.fetchVersions()), _g; _g = await _f.next(), _a = _g.done, !_a; _e = true) {
|
|
147
142
|
_c = _g.value;
|
|
148
143
|
_e = false;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
throw new Error('no jbrowse-web download found');
|
|
161
|
-
}
|
|
162
|
-
return file;
|
|
144
|
+
const versions = _c;
|
|
145
|
+
// if a release was just uploaded, or an erroneous build was made
|
|
146
|
+
// then it might have no build asset
|
|
147
|
+
const nonprereleases = versions
|
|
148
|
+
.filter(release => release.prerelease === false)
|
|
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');
|
|
163
155
|
}
|
|
164
|
-
|
|
165
|
-
finally {
|
|
166
|
-
_e = true;
|
|
156
|
+
return file;
|
|
167
157
|
}
|
|
168
158
|
}
|
|
169
159
|
}
|
|
@@ -4,98 +4,54 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const command_1 = require("@oclif/command");
|
|
7
|
-
const fetchWithProxy_1 = __importDefault(require("../fetchWithProxy"));
|
|
8
7
|
const fs_1 = __importDefault(require("fs"));
|
|
9
8
|
const path_1 = __importDefault(require("path"));
|
|
10
9
|
const json_parse_better_errors_1 = __importDefault(require("json-parse-better-errors"));
|
|
10
|
+
// locals
|
|
11
|
+
const fetchWithProxy_1 = __importDefault(require("../fetchWithProxy"));
|
|
11
12
|
const base_1 = __importDefault(require("../base"));
|
|
12
13
|
class AddConnection extends base_1.default {
|
|
13
14
|
async run() {
|
|
15
|
+
var _a, _b;
|
|
14
16
|
const { args: runArgs, flags: runFlags } = this.parse(AddConnection);
|
|
15
17
|
const output = runFlags.target || runFlags.out || '.';
|
|
16
18
|
const isDir = fs_1.default.lstatSync(output).isDirectory();
|
|
17
19
|
this.target = isDir ? `${output}/config.json` : output;
|
|
18
|
-
const { connectionUrlOrPath
|
|
19
|
-
const { config } = runFlags;
|
|
20
|
-
let { type, name, connectionId, assemblyName } = runFlags;
|
|
20
|
+
const { connectionUrlOrPath } = runArgs;
|
|
21
|
+
const { assemblyNames, type, name, config, connectionId } = runFlags;
|
|
21
22
|
const { skipCheck, force } = runFlags;
|
|
22
|
-
const url = await this.resolveURL(
|
|
23
|
+
const url = await this.resolveURL(connectionUrlOrPath, !(skipCheck || force));
|
|
23
24
|
const configContents = await this.readJsonFile(this.target);
|
|
24
25
|
this.debug(`Using config file ${this.target}`);
|
|
25
|
-
if (!configContents.assemblies ||
|
|
26
|
+
if (!((_a = configContents.assemblies) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
26
27
|
this.error('No assemblies found. Please add one before adding connections', { exit: 120 });
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
: this.debug(`Assembly name(s) is :${assemblyName}`);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
assemblyName = configContents.assemblies[0].name;
|
|
38
|
-
this.log(`Inferred default assembly name ${assemblyName}`);
|
|
39
|
-
}
|
|
40
|
-
if (type) {
|
|
41
|
-
this.debug(`Type is ${type}`);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
type = this.determineConnectionType(url, config);
|
|
45
|
-
}
|
|
46
|
-
if (connectionId) {
|
|
47
|
-
this.debug(`Connection id is ${connectionId}`);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
connectionId = `${type}-${assemblyName}-${Date.now()}`;
|
|
51
|
-
}
|
|
52
|
-
if (name) {
|
|
53
|
-
this.debug(`Name is: ${name}`);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
name = connectionId;
|
|
57
|
-
}
|
|
58
|
-
let configObj = {};
|
|
59
|
-
if (config) {
|
|
60
|
-
try {
|
|
61
|
-
configObj = (0, json_parse_better_errors_1.default)(config);
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
this.error('Could not parse provided JSON object');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const connectionConfig = Object.assign({ type,
|
|
68
|
-
connectionId, name: name || connectionId, assemblyName }, configObj);
|
|
69
|
-
switch (type) {
|
|
70
|
-
case 'UCSCTrackHubConnection': {
|
|
71
|
-
connectionConfig.hubTxtLocation = {
|
|
29
|
+
const configType = type || this.determineConnectionType(url);
|
|
30
|
+
const id = connectionId ||
|
|
31
|
+
[configType, assemblyNames, +Date.now()].filter(f => !!f).join('-');
|
|
32
|
+
const connectionConfig = Object.assign(Object.assign(Object.assign(Object.assign({ type: configType, name: name || id }, (configType === 'UCSCTrackHubConnection'
|
|
33
|
+
? {
|
|
34
|
+
hubTxtLocation: {
|
|
72
35
|
uri: url,
|
|
73
36
|
locationType: 'UriLocation',
|
|
74
|
-
}
|
|
75
|
-
break;
|
|
37
|
+
},
|
|
76
38
|
}
|
|
77
|
-
|
|
78
|
-
|
|
39
|
+
: {})), (configType === 'JBrowse1Connection'
|
|
40
|
+
? {
|
|
41
|
+
dataDirLocation: {
|
|
79
42
|
uri: url,
|
|
80
43
|
locationType: 'UriLocation',
|
|
81
|
-
}
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
default: {
|
|
85
|
-
if (!config || !this.isValidJSON(config)) {
|
|
86
|
-
this.error('When type is not UCSCTrackHubConnection or JBrowse1Connection, config object must be provided.\nPlease enter a config object using --config', { exit: 140 });
|
|
87
|
-
}
|
|
88
|
-
break;
|
|
44
|
+
},
|
|
89
45
|
}
|
|
90
|
-
|
|
46
|
+
: {})), { connectionId: id, assemblyNames: assemblyNames || type === 'JBrowse1Connection'
|
|
47
|
+
? [(_b = configContents.assemblies[0]) === null || _b === void 0 ? void 0 : _b.name]
|
|
48
|
+
: undefined }), (config ? (0, json_parse_better_errors_1.default)(config) : {}));
|
|
91
49
|
if (!configContents.connections) {
|
|
92
50
|
configContents.connections = [];
|
|
93
51
|
}
|
|
94
|
-
const idx = configContents.connections.findIndex(
|
|
52
|
+
const idx = configContents.connections.findIndex(c => c.connectionId === connectionId);
|
|
95
53
|
if (idx !== -1) {
|
|
96
|
-
this.debug(`Found existing connectionId ${connectionId} in configuration`);
|
|
97
54
|
if (runFlags.force || runFlags.overwrite) {
|
|
98
|
-
this.debug(`Overwriting connection ${connectionId} in configuration`);
|
|
99
55
|
configContents.connections[idx] = connectionConfig;
|
|
100
56
|
}
|
|
101
57
|
else {
|
|
@@ -137,17 +93,14 @@ class AddConnection extends base_1.default {
|
|
|
137
93
|
exit: 180,
|
|
138
94
|
});
|
|
139
95
|
}
|
|
140
|
-
determineConnectionType(url
|
|
96
|
+
determineConnectionType(url) {
|
|
141
97
|
if (path_1.default.basename(url) === 'hub.txt') {
|
|
142
98
|
return 'UCSCTrackHubConnection';
|
|
143
99
|
}
|
|
144
100
|
if (url.includes('jbrowse/data')) {
|
|
145
101
|
return 'JBrowse1Connection';
|
|
146
102
|
}
|
|
147
|
-
|
|
148
|
-
return 'custom';
|
|
149
|
-
}
|
|
150
|
-
return this.error(`Unable to determine a specific connection from URL given.\nPlease specify a type with --type.\nIf you want a custom type, please provide the config object with --config`);
|
|
103
|
+
return 'custom';
|
|
151
104
|
}
|
|
152
105
|
isValidJSON(str) {
|
|
153
106
|
try {
|
|
@@ -161,11 +114,11 @@ class AddConnection extends base_1.default {
|
|
|
161
114
|
}
|
|
162
115
|
AddConnection.description = 'Add a connection to a JBrowse 2 configuration';
|
|
163
116
|
AddConnection.examples = [
|
|
164
|
-
'$ jbrowse add-connection http://mysite.com/jbrowse/data/',
|
|
165
|
-
'$ jbrowse add-connection http://mysite.com/jbrowse/custom_data_folder/ --type JBrowse1Connection',
|
|
166
|
-
'$ jbrowse add-connection http://mysite.com/path/to/hub.txt
|
|
167
|
-
'$ jbrowse add-connection http://mysite.com/path/to/custom_hub_name.txt --type UCSCTrackHubConnection
|
|
168
|
-
`$ jbrowse add-connection http://mysite.com/path/to/custom --type custom --config '{"uri":{"url":"https://mysite.com/path/to/custom"}, "locationType": "UriLocation"}'
|
|
117
|
+
'$ jbrowse add-connection http://mysite.com/jbrowse/data/ -a hg19',
|
|
118
|
+
'$ jbrowse add-connection http://mysite.com/jbrowse/custom_data_folder/ --type JBrowse1Connection -a hg38',
|
|
119
|
+
'$ jbrowse add-connection http://mysite.com/path/to/hub.txt',
|
|
120
|
+
'$ jbrowse add-connection http://mysite.com/path/to/custom_hub_name.txt --type UCSCTrackHubConnection',
|
|
121
|
+
`$ jbrowse add-connection http://mysite.com/path/to/custom --type custom --config '{"uri":{"url":"https://mysite.com/path/to/custom"}, "locationType": "UriLocation"}' -a hg19`,
|
|
169
122
|
'$ jbrowse add-connection https://mysite.com/path/to/hub.txt --connectionId newId --name newName --target /path/to/jb2/installation/config.json',
|
|
170
123
|
];
|
|
171
124
|
AddConnection.args = [
|
|
@@ -180,9 +133,9 @@ AddConnection.flags = {
|
|
|
180
133
|
char: 't',
|
|
181
134
|
description: 'type of connection, ex. JBrowse1Connection, UCSCTrackHubConnection, custom',
|
|
182
135
|
}),
|
|
183
|
-
|
|
136
|
+
assemblyNames: command_1.flags.string({
|
|
184
137
|
char: 'a',
|
|
185
|
-
description: '
|
|
138
|
+
description: 'For UCSC, optional: Comma separated list of assembly name(s) to filter from this connection. For JBrowse: a single assembly name',
|
|
186
139
|
}),
|
|
187
140
|
config: command_1.flags.string({
|
|
188
141
|
char: 'c',
|
package/lib/commands/create.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const command_1 = require("@oclif/command");
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const fetchWithProxy_1 = __importDefault(require("../fetchWithProxy"));
|
|
9
|
-
const unzipper_1 = __importDefault(require("unzipper"));
|
|
10
9
|
const base_1 = __importDefault(require("../base"));
|
|
10
|
+
const decompress_1 = __importDefault(require("decompress"));
|
|
11
11
|
const fsPromises = fs_1.default.promises;
|
|
12
12
|
class Create extends base_1.default {
|
|
13
13
|
async run() {
|
|
@@ -40,7 +40,7 @@ class Create extends base_1.default {
|
|
|
40
40
|
type !== 'application/octet-stream') {
|
|
41
41
|
this.error('The URL provided does not seem to be a JBrowse installation URL');
|
|
42
42
|
}
|
|
43
|
-
await
|
|
43
|
+
await (0, decompress_1.default)(Buffer.from(await response.arrayBuffer()), argsPath);
|
|
44
44
|
this.log(`Unpacked ${locationUrl} at ${argsPath}`);
|
|
45
45
|
}
|
|
46
46
|
async checkPath(userPath) {
|
|
@@ -50,8 +50,9 @@ class Create extends base_1.default {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
async catch(error) {
|
|
53
|
+
var _a;
|
|
53
54
|
// @ts-expect-error
|
|
54
|
-
if (error.parse
|
|
55
|
+
if ((_a = error.parse) === null || _a === void 0 ? void 0 : _a.output.flags.listVersions) {
|
|
55
56
|
const versions = (await this.fetchGithubVersions()).map(version => version.tag_name);
|
|
56
57
|
this.log(`All JBrowse versions:\n${versions.join('\n')}`);
|
|
57
58
|
this.exit();
|
package/lib/commands/upgrade.js
CHANGED
|
@@ -7,8 +7,8 @@ const command_1 = require("@oclif/command");
|
|
|
7
7
|
const rimraf_1 = require("rimraf");
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const decompress_1 = __importDefault(require("decompress"));
|
|
10
11
|
const fetchWithProxy_1 = __importDefault(require("../fetchWithProxy"));
|
|
11
|
-
const unzipper_1 = __importDefault(require("unzipper"));
|
|
12
12
|
const base_1 = __importDefault(require("../base"));
|
|
13
13
|
class Upgrade extends base_1.default {
|
|
14
14
|
async run() {
|
|
@@ -49,7 +49,7 @@ class Upgrade extends base_1.default {
|
|
|
49
49
|
.filter(f => f.includes('worker.js'))
|
|
50
50
|
.forEach(f => fs_1.default.unlinkSync(path_1.default.join(argsPath, f)));
|
|
51
51
|
}
|
|
52
|
-
await
|
|
52
|
+
await (0, decompress_1.default)(Buffer.from(await response.arrayBuffer()), argsPath);
|
|
53
53
|
this.log(`Unpacked ${locationUrl} at ${argsPath}`);
|
|
54
54
|
}
|
|
55
55
|
}
|
package/lib/fetchWithProxy.js
CHANGED
|
@@ -4,9 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
7
|
-
const proxy_agent_1 =
|
|
7
|
+
const proxy_agent_1 = require("proxy-agent");
|
|
8
|
+
// The correct proxy `Agent` implementation to use will be determined
|
|
9
|
+
// via the `http_proxy` / `https_proxy` / `no_proxy` / etc. env vars
|
|
8
10
|
function fetchWithProxy(url, options = {}) {
|
|
9
|
-
const agent = new proxy_agent_1.
|
|
11
|
+
const agent = new proxy_agent_1.ProxyAgent();
|
|
10
12
|
return (0, node_fetch_1.default)(url, Object.assign({ agent }, options));
|
|
11
13
|
}
|
|
12
14
|
exports.default = fetchWithProxy;
|
package/lib/types/gff3Adapter.js
CHANGED
|
@@ -50,46 +50,44 @@ function indexGff3({ config, attributesToIndex, inLocation, outLocation, typesTo
|
|
|
50
50
|
input: inLocation.match(/.b?gz$/) ? stream.pipe((0, zlib_1.createGunzip)()) : stream,
|
|
51
51
|
});
|
|
52
52
|
try {
|
|
53
|
-
for (var _d = true, rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield __await(rl_1.next()), _a = rl_1_1.done, !_a;) {
|
|
53
|
+
for (var _d = true, rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield __await(rl_1.next()), _a = rl_1_1.done, !_a; _d = true) {
|
|
54
54
|
_c = rl_1_1.value;
|
|
55
55
|
_d = false;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
else if (line.startsWith('>')) {
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
const [seq_id, , type, start, end, , , , col9] = line.split('\t');
|
|
65
|
-
const locStr = `${seq_id}:${start}..${end}`;
|
|
66
|
-
if (!typesToExclude.includes(type)) {
|
|
67
|
-
// turns gff3 attrs into a map, and converts the arrays into space
|
|
68
|
-
// separated strings
|
|
69
|
-
const col9attrs = Object.fromEntries(col9
|
|
70
|
-
.split(';')
|
|
71
|
-
.map(f => f.trim())
|
|
72
|
-
.filter(f => !!f)
|
|
73
|
-
.map(f => f.split('='))
|
|
74
|
-
.map(([key, val]) => [
|
|
75
|
-
key.trim(),
|
|
76
|
-
decodeURIComponent(val).trim().split(',').join(' '),
|
|
77
|
-
]));
|
|
78
|
-
const attrs = attributesToIndex
|
|
79
|
-
.map(attr => col9attrs[attr])
|
|
80
|
-
.filter((f) => !!f);
|
|
81
|
-
if (attrs.length) {
|
|
82
|
-
const record = JSON.stringify([
|
|
83
|
-
encodeURIComponent(locStr),
|
|
84
|
-
encodeURIComponent(trackId),
|
|
85
|
-
...attrs.map(a => encodeURIComponent(a)),
|
|
86
|
-
]).replace(/,/g, '|');
|
|
87
|
-
yield yield __await(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
56
|
+
const line = _c;
|
|
57
|
+
if (!line.trim()) {
|
|
58
|
+
continue;
|
|
90
59
|
}
|
|
91
|
-
|
|
92
|
-
|
|
60
|
+
else if (line.startsWith('#')) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
else if (line.startsWith('>')) {
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
const [seq_id, , type, start, end, , , , col9] = line.split('\t');
|
|
67
|
+
const locStr = `${seq_id}:${start}..${end}`;
|
|
68
|
+
if (!typesToExclude.includes(type)) {
|
|
69
|
+
// turns gff3 attrs into a map, and converts the arrays into space
|
|
70
|
+
// separated strings
|
|
71
|
+
const col9attrs = Object.fromEntries(col9
|
|
72
|
+
.split(';')
|
|
73
|
+
.map(f => f.trim())
|
|
74
|
+
.filter(f => !!f)
|
|
75
|
+
.map(f => f.split('='))
|
|
76
|
+
.map(([key, val]) => [
|
|
77
|
+
key.trim(),
|
|
78
|
+
decodeURIComponent(val).trim().split(',').join(' '),
|
|
79
|
+
]));
|
|
80
|
+
const attrs = attributesToIndex
|
|
81
|
+
.map(attr => col9attrs[attr])
|
|
82
|
+
.filter((f) => !!f);
|
|
83
|
+
if (attrs.length) {
|
|
84
|
+
const record = JSON.stringify([
|
|
85
|
+
encodeURIComponent(locStr),
|
|
86
|
+
encodeURIComponent(trackId),
|
|
87
|
+
...attrs.map(a => encodeURIComponent(a)),
|
|
88
|
+
]).replaceAll(',', '|');
|
|
89
|
+
yield yield __await(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
90
|
+
}
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
93
|
}
|
package/lib/types/vcfAdapter.js
CHANGED
|
@@ -53,50 +53,45 @@ function indexVcf({ config, attributesToIndex, inLocation, outLocation, quiet, }
|
|
|
53
53
|
input: gzStream,
|
|
54
54
|
});
|
|
55
55
|
try {
|
|
56
|
-
for (var _d = true, rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield __await(rl_1.next()), _a = rl_1_1.done, !_a;) {
|
|
56
|
+
for (var _d = true, rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield __await(rl_1.next()), _a = rl_1_1.done, !_a; _d = true) {
|
|
57
57
|
_c = rl_1_1.value;
|
|
58
58
|
_d = false;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
65
|
-
const [ref, pos, id, _ref, _alt, _qual, _filter, info] = line.split('\t');
|
|
66
|
-
// turns gff3 attrs into a map, and converts the arrays into space
|
|
67
|
-
// separated strings
|
|
68
|
-
const fields = Object.fromEntries(info
|
|
69
|
-
.split(';')
|
|
70
|
-
.map(f => f.trim())
|
|
71
|
-
.filter(f => !!f)
|
|
72
|
-
.map(f => f.split('='))
|
|
73
|
-
.map(([key, val]) => [
|
|
74
|
-
key.trim(),
|
|
75
|
-
val ? decodeURIComponent(val).trim().split(',').join(' ') : undefined,
|
|
76
|
-
]));
|
|
77
|
-
const end = fields.END;
|
|
78
|
-
const locStr = `${ref}:${pos}..${end || +pos + 1}`;
|
|
79
|
-
if (id === '.') {
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
const infoAttrs = attributesToIndex
|
|
83
|
-
.map(attr => fields[attr])
|
|
84
|
-
.filter((f) => !!f);
|
|
85
|
-
const ids = id.split(',');
|
|
86
|
-
for (let i = 0; i < ids.length; i++) {
|
|
87
|
-
const id = ids[i];
|
|
88
|
-
const attrs = [id];
|
|
89
|
-
const record = JSON.stringify([
|
|
90
|
-
encodeURIComponent(locStr),
|
|
91
|
-
encodeURIComponent(trackId),
|
|
92
|
-
encodeURIComponent(id || ''),
|
|
93
|
-
...infoAttrs.map(a => encodeURIComponent(a || '')),
|
|
94
|
-
]).replace(/,/g, '|');
|
|
95
|
-
yield yield __await(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
96
|
-
}
|
|
59
|
+
const line = _c;
|
|
60
|
+
if (line.startsWith('#')) {
|
|
61
|
+
continue;
|
|
97
62
|
}
|
|
98
|
-
|
|
99
|
-
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
64
|
+
const [ref, pos, id, _ref, _alt, _qual, _filter, info] = line.split('\t');
|
|
65
|
+
// turns gff3 attrs into a map, and converts the arrays into space
|
|
66
|
+
// separated strings
|
|
67
|
+
const fields = Object.fromEntries(info
|
|
68
|
+
.split(';')
|
|
69
|
+
.map(f => f.trim())
|
|
70
|
+
.filter(f => !!f)
|
|
71
|
+
.map(f => f.split('='))
|
|
72
|
+
.map(([key, val]) => [
|
|
73
|
+
key.trim(),
|
|
74
|
+
val ? decodeURIComponent(val).trim().split(',').join(' ') : undefined,
|
|
75
|
+
]));
|
|
76
|
+
const end = fields.END;
|
|
77
|
+
const locStr = `${ref}:${pos}..${end || +pos + 1}`;
|
|
78
|
+
if (id === '.') {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const infoAttrs = attributesToIndex
|
|
82
|
+
.map(attr => fields[attr])
|
|
83
|
+
.filter((f) => !!f);
|
|
84
|
+
const ids = id.split(',');
|
|
85
|
+
for (let i = 0; i < ids.length; i++) {
|
|
86
|
+
const id = ids[i];
|
|
87
|
+
const attrs = [id];
|
|
88
|
+
const record = JSON.stringify([
|
|
89
|
+
encodeURIComponent(locStr),
|
|
90
|
+
encodeURIComponent(trackId),
|
|
91
|
+
encodeURIComponent(id || ''),
|
|
92
|
+
...infoAttrs.map(a => encodeURIComponent(a || '')),
|
|
93
|
+
]).replaceAll(',', '|');
|
|
94
|
+
yield yield __await(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
100
95
|
}
|
|
101
96
|
}
|
|
102
97
|
}
|