@jbrowse/cli 1.4.3 → 1.5.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 +68 -32
- package/lib/base.d.ts +12 -8
- package/lib/base.js +31 -23
- package/lib/commands/add-assembly.js +53 -19
- package/lib/commands/add-connection.js +18 -13
- package/lib/commands/add-track-json.js +1 -1
- package/lib/commands/add-track.d.ts +81 -7
- package/lib/commands/add-track.js +68 -84
- package/lib/commands/admin-server.d.ts +0 -2
- package/lib/commands/admin-server.js +41 -37
- package/lib/commands/create.d.ts +1 -1
- package/lib/commands/create.js +16 -7
- package/lib/commands/set-default-session.js +4 -4
- package/lib/commands/text-index.js +25 -16
- package/lib/commands/upgrade.d.ts +2 -9
- package/lib/commands/upgrade.js +20 -14
- package/lib/index.js +1 -0
- package/lib/types/common.js +7 -7
- package/lib/types/gff3Adapter.js +10 -10
- package/lib/types/gtfAdapter.js +13 -21
- package/lib/types/vcfAdapter.js +11 -10
- package/oclif.manifest.json +1 -1
- package/package.json +6 -4
package/lib/commands/create.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
-
const unzipper_1 = tslib_1.__importDefault(require("unzipper"));
|
|
8
|
-
const base_1 = tslib_1.__importDefault(require("../base"));
|
|
5
|
+
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
6
|
+
const node_fetch_1 = (0, tslib_1.__importDefault)(require("node-fetch"));
|
|
7
|
+
const unzipper_1 = (0, tslib_1.__importDefault)(require("unzipper"));
|
|
8
|
+
const base_1 = (0, tslib_1.__importDefault)(require("../base"));
|
|
9
9
|
const fsPromises = fs_1.default.promises;
|
|
10
10
|
class Create extends base_1.default {
|
|
11
11
|
async run() {
|
|
@@ -28,7 +28,7 @@ class Create extends base_1.default {
|
|
|
28
28
|
(branch ? await this.getBranch(branch) : '') ||
|
|
29
29
|
(tag ? await this.getTag(tag) : await this.getLatest());
|
|
30
30
|
this.log(`Fetching ${locationUrl}...`);
|
|
31
|
-
const response = await node_fetch_1.default(locationUrl);
|
|
31
|
+
const response = await (0, node_fetch_1.default)(locationUrl);
|
|
32
32
|
if (!response.ok) {
|
|
33
33
|
this.error(`Failed to fetch: ${response.statusText}`, { exit: 100 });
|
|
34
34
|
}
|
|
@@ -47,8 +47,8 @@ class Create extends base_1.default {
|
|
|
47
47
|
this.error(`${userPath} This directory has existing files and could cause conflicts with create. Please choose another directory or use the force flag to overwrite existing files`, { exit: 120 });
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
50
|
async catch(error) {
|
|
51
|
+
// @ts-ignore
|
|
52
52
|
if (error.parse && error.parse.output.flags.listVersions) {
|
|
53
53
|
const versions = (await this.fetchGithubVersions()).map(version => version.tag_name);
|
|
54
54
|
this.log(`All JBrowse versions:\n${versions.join('\n')}`);
|
|
@@ -60,11 +60,20 @@ class Create extends base_1.default {
|
|
|
60
60
|
exports.default = Create;
|
|
61
61
|
Create.description = 'Downloads and installs the latest JBrowse 2 release';
|
|
62
62
|
Create.examples = [
|
|
63
|
+
'# Download latest release from github, and put in specific path',
|
|
63
64
|
'$ jbrowse create /path/to/new/installation',
|
|
65
|
+
'',
|
|
66
|
+
'# Download latest release from github and force overwrite existing contents at path',
|
|
64
67
|
'$ jbrowse create /path/to/new/installation --force',
|
|
68
|
+
'',
|
|
69
|
+
'# Download latest release from a specific URL',
|
|
65
70
|
'$ jbrowse create /path/to/new/installation --url url.com/directjbrowselink.zip',
|
|
71
|
+
'',
|
|
72
|
+
'# Download a specific tag from github',
|
|
66
73
|
'$ jbrowse create /path/to/new/installation --tag v1.0.0',
|
|
67
|
-
'
|
|
74
|
+
'',
|
|
75
|
+
'# List available versions',
|
|
76
|
+
'$ jbrowse create --listVersions',
|
|
68
77
|
];
|
|
69
78
|
Create.args = [
|
|
70
79
|
{
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
const json_parse_better_errors_1 = tslib_1.__importDefault(require("json-parse-better-errors"));
|
|
7
|
-
const base_1 = tslib_1.__importDefault(require("../base"));
|
|
5
|
+
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
6
|
+
const json_parse_better_errors_1 = (0, tslib_1.__importDefault)(require("json-parse-better-errors"));
|
|
7
|
+
const base_1 = (0, tslib_1.__importDefault)(require("../base"));
|
|
8
8
|
const fsPromises = fs_1.default.promises;
|
|
9
9
|
class SetDefaultSession extends base_1.default {
|
|
10
10
|
async run() {
|
|
@@ -86,7 +86,7 @@ class SetDefaultSession extends base_1.default {
|
|
|
86
86
|
return this.error('Could not read the provided file', { exit: 150 });
|
|
87
87
|
}
|
|
88
88
|
try {
|
|
89
|
-
const session = json_parse_better_errors_1.default(defaultSessionJson);
|
|
89
|
+
const session = (0, json_parse_better_errors_1.default)(defaultSessionJson);
|
|
90
90
|
// return top-level "session" if it exists, such as in files created by
|
|
91
91
|
// "File -> Export session"
|
|
92
92
|
return session.session || session;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
5
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
4
|
+
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
5
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
6
6
|
const stream_1 = require("stream");
|
|
7
7
|
const ixixx_1 = require("ixixx");
|
|
8
8
|
const command_1 = require("@oclif/command");
|
|
9
9
|
const gff3Adapter_1 = require("../types/gff3Adapter");
|
|
10
|
-
const gtfAdapter_1 = require("../types/gtfAdapter");
|
|
11
10
|
const vcfAdapter_1 = require("../types/vcfAdapter");
|
|
12
|
-
const base_1 = tslib_1.__importDefault(require("../base"));
|
|
11
|
+
const base_1 = (0, tslib_1.__importDefault)(require("../base"));
|
|
13
12
|
const common_1 = require("../types/common");
|
|
13
|
+
const object_fromentries_1 = (0, tslib_1.__importDefault)(require("object.fromentries"));
|
|
14
|
+
if (!Object.fromEntries) {
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
object_fromentries_1.default.shim();
|
|
17
|
+
}
|
|
14
18
|
function readConf(confFilePath) {
|
|
15
19
|
return JSON.parse(fs_1.default.readFileSync(confFilePath, 'utf8'));
|
|
16
20
|
}
|
|
@@ -43,7 +47,8 @@ class TextIndex extends base_1.default {
|
|
|
43
47
|
fs_1.default.mkdirSync(trixDir);
|
|
44
48
|
}
|
|
45
49
|
const aggregateAdapters = config.aggregateTextSearchAdapters || [];
|
|
46
|
-
const asms = (assemblies === null || assemblies === void 0 ? void 0 : assemblies.split(',')) ||
|
|
50
|
+
const asms = (assemblies === null || assemblies === void 0 ? void 0 : assemblies.split(',')) ||
|
|
51
|
+
((_a = config.assemblies) === null || _a === void 0 ? void 0 : _a.map(a => a.name)) ||
|
|
47
52
|
(config.assembly ? [config.assembly.name] : []);
|
|
48
53
|
if (!(asms === null || asms === void 0 ? void 0 : asms.length)) {
|
|
49
54
|
throw new Error('No assemblies found');
|
|
@@ -78,12 +83,15 @@ class TextIndex extends base_1.default {
|
|
|
78
83
|
textSearchAdapterId: id,
|
|
79
84
|
ixFilePath: {
|
|
80
85
|
uri: `trix/${asm}.ix`,
|
|
86
|
+
locationType: 'UriLocation',
|
|
81
87
|
},
|
|
82
88
|
ixxFilePath: {
|
|
83
89
|
uri: `trix/${asm}.ixx`,
|
|
90
|
+
locationType: 'UriLocation',
|
|
84
91
|
},
|
|
85
92
|
metaFilePath: {
|
|
86
93
|
uri: `trix/${asm}_meta.json`,
|
|
94
|
+
locationType: 'UriLocation',
|
|
87
95
|
},
|
|
88
96
|
assemblyNames: [asm],
|
|
89
97
|
};
|
|
@@ -142,12 +150,15 @@ class TextIndex extends base_1.default {
|
|
|
142
150
|
textSearchAdapterId: id,
|
|
143
151
|
ixFilePath: {
|
|
144
152
|
uri: `trix/${trackId}.ix`,
|
|
153
|
+
locationType: 'UriLocation',
|
|
145
154
|
},
|
|
146
155
|
ixxFilePath: {
|
|
147
156
|
uri: `trix/${trackId}.ixx`,
|
|
157
|
+
locationType: 'UriLocation',
|
|
148
158
|
},
|
|
149
159
|
metaFilePath: {
|
|
150
160
|
uri: `trix/${trackId}_meta.json`,
|
|
161
|
+
locationType: 'UriLocation',
|
|
151
162
|
},
|
|
152
163
|
assemblyNames: assemblyNames,
|
|
153
164
|
} }) });
|
|
@@ -167,8 +178,8 @@ class TextIndex extends base_1.default {
|
|
|
167
178
|
fs_1.default.mkdirSync(trixDir);
|
|
168
179
|
}
|
|
169
180
|
const configs = file
|
|
170
|
-
.map(file => common_1.guessAdapterFromFileName(file))
|
|
171
|
-
.filter(fileConfig => common_1.supported(fileConfig.adapter.type));
|
|
181
|
+
.map(file => (0, common_1.guessAdapterFromFileName)(file))
|
|
182
|
+
.filter(fileConfig => (0, common_1.supported)(fileConfig.adapter.type));
|
|
172
183
|
await this.indexDriver({
|
|
173
184
|
configs,
|
|
174
185
|
outDir: outFlag,
|
|
@@ -183,7 +194,7 @@ class TextIndex extends base_1.default {
|
|
|
183
194
|
async indexDriver({ configs, attributes, outDir, name, quiet, exclude, assemblyNames, }) {
|
|
184
195
|
const readable = stream_1.Readable.from(this.indexFiles(configs, attributes, outDir, quiet, exclude));
|
|
185
196
|
const ixIxxStream = await this.runIxIxx(readable, outDir, name);
|
|
186
|
-
await common_1.generateMeta({
|
|
197
|
+
await (0, common_1.generateMeta)({
|
|
187
198
|
configs,
|
|
188
199
|
attributes,
|
|
189
200
|
outDir,
|
|
@@ -194,27 +205,25 @@ class TextIndex extends base_1.default {
|
|
|
194
205
|
return ixIxxStream;
|
|
195
206
|
}
|
|
196
207
|
indexFiles(trackConfigs, attributes, outLocation, quiet, typesToExclude) {
|
|
197
|
-
return tslib_1.__asyncGenerator(this, arguments, function* indexFiles_1() {
|
|
208
|
+
return (0, tslib_1.__asyncGenerator)(this, arguments, function* indexFiles_1() {
|
|
198
209
|
for (const config of trackConfigs) {
|
|
199
210
|
const { adapter, textSearching } = config;
|
|
200
211
|
const { type } = adapter;
|
|
201
212
|
const { indexingFeatureTypesToExclude: types = typesToExclude, indexingAttributes: attrs = attributes, } = textSearching || {};
|
|
202
213
|
if (type === 'Gff3TabixAdapter') {
|
|
203
|
-
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(gff3Adapter_1.indexGff3(config, attrs, outLocation, types, quiet))));
|
|
204
|
-
}
|
|
205
|
-
else if (type === 'GtfTabixAdapter') {
|
|
206
|
-
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(gtfAdapter_1.indexGtf(config, attrs, outLocation, types, quiet))));
|
|
214
|
+
yield (0, tslib_1.__await)(yield* (0, tslib_1.__asyncDelegator)((0, tslib_1.__asyncValues)((0, gff3Adapter_1.indexGff3)(config, attrs, outLocation, types, quiet))));
|
|
207
215
|
}
|
|
208
216
|
else if (type === 'VcfTabixAdapter') {
|
|
209
|
-
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(vcfAdapter_1.indexVcf(config, attrs, outLocation, types, quiet))));
|
|
217
|
+
yield (0, tslib_1.__await)(yield* (0, tslib_1.__asyncDelegator)((0, tslib_1.__asyncValues)((0, vcfAdapter_1.indexVcf)(config, attrs, outLocation, types, quiet))));
|
|
210
218
|
}
|
|
219
|
+
// gtf unused currently
|
|
211
220
|
}
|
|
212
221
|
});
|
|
213
222
|
}
|
|
214
223
|
runIxIxx(readStream, outLocation, name) {
|
|
215
224
|
const ixFilename = path_1.default.join(outLocation, 'trix', `${name}.ix`);
|
|
216
225
|
const ixxFilename = path_1.default.join(outLocation, 'trix', `${name}.ixx`);
|
|
217
|
-
return ixixx_1.ixIxxStream(readStream, ixFilename, ixxFilename);
|
|
226
|
+
return (0, ixixx_1.ixIxxStream)(readStream, ixFilename, ixxFilename);
|
|
218
227
|
}
|
|
219
228
|
async getTrackConfigs(configPath, trackIds, assemblyName) {
|
|
220
229
|
const { tracks } = readConf(configPath);
|
|
@@ -230,7 +239,7 @@ class TextIndex extends base_1.default {
|
|
|
230
239
|
}
|
|
231
240
|
return currentTrack;
|
|
232
241
|
})
|
|
233
|
-
.filter(track => common_1.supported(track.adapter.type))
|
|
242
|
+
.filter(track => { var _a; return (0, common_1.supported)((_a = track.adapter) === null || _a === void 0 ? void 0 : _a.type); })
|
|
234
243
|
.filter(track => assemblyName ? track.assemblyNames.includes(assemblyName) : true);
|
|
235
244
|
}
|
|
236
245
|
}
|
|
@@ -3,19 +3,12 @@ import JBrowseCommand from '../base';
|
|
|
3
3
|
export default class Upgrade extends JBrowseCommand {
|
|
4
4
|
static description: string;
|
|
5
5
|
static examples: string[];
|
|
6
|
-
static args:
|
|
6
|
+
static args: {
|
|
7
7
|
name: string;
|
|
8
8
|
required: boolean;
|
|
9
9
|
description: string;
|
|
10
10
|
default: string;
|
|
11
|
-
|
|
12
|
-
} | {
|
|
13
|
-
name: string;
|
|
14
|
-
required: boolean;
|
|
15
|
-
description: string;
|
|
16
|
-
hidden: boolean;
|
|
17
|
-
default?: undefined;
|
|
18
|
-
})[];
|
|
11
|
+
}[];
|
|
19
12
|
static flags: {
|
|
20
13
|
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
21
14
|
listVersions: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
package/lib/commands/upgrade.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
8
|
-
const unzipper_1 = tslib_1.__importDefault(require("unzipper"));
|
|
9
|
-
const base_1 = tslib_1.__importDefault(require("../base"));
|
|
5
|
+
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
6
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
7
|
+
const node_fetch_1 = (0, tslib_1.__importDefault)(require("node-fetch"));
|
|
8
|
+
const unzipper_1 = (0, tslib_1.__importDefault)(require("unzipper"));
|
|
9
|
+
const base_1 = (0, tslib_1.__importDefault)(require("../base"));
|
|
10
10
|
class Upgrade extends base_1.default {
|
|
11
11
|
async run() {
|
|
12
12
|
const { args: runArgs, flags: runFlags } = this.parse(Upgrade);
|
|
@@ -30,7 +30,7 @@ class Upgrade extends base_1.default {
|
|
|
30
30
|
(branch ? await this.getBranch(branch) : '') ||
|
|
31
31
|
(tag ? await this.getTag(tag) : await this.getLatest());
|
|
32
32
|
this.log(`Fetching ${locationUrl}...`);
|
|
33
|
-
const response = await node_fetch_1.default(locationUrl);
|
|
33
|
+
const response = await (0, node_fetch_1.default)(locationUrl);
|
|
34
34
|
if (!response.ok) {
|
|
35
35
|
this.error(`Failed to fetch: ${response.statusText}`, { exit: 100 });
|
|
36
36
|
}
|
|
@@ -47,11 +47,23 @@ class Upgrade extends base_1.default {
|
|
|
47
47
|
exports.default = Upgrade;
|
|
48
48
|
Upgrade.description = 'Upgrades JBrowse 2 to latest version';
|
|
49
49
|
Upgrade.examples = [
|
|
50
|
-
'
|
|
50
|
+
'# Upgrades current directory to latest jbrowse release',
|
|
51
|
+
'$ jbrowse upgrade',
|
|
52
|
+
'',
|
|
53
|
+
'# Upgrade jbrowse instance at a specific filesystem path',
|
|
51
54
|
'$ jbrowse upgrade /path/to/jbrowse2/installation',
|
|
55
|
+
'',
|
|
56
|
+
'# Upgrade to a specific tag',
|
|
52
57
|
'$ jbrowse upgrade /path/to/jbrowse2/installation --tag v1.0.0',
|
|
53
|
-
'
|
|
58
|
+
'',
|
|
59
|
+
'# List versions available on github',
|
|
60
|
+
'$ jbrowse upgrade --listVersions',
|
|
61
|
+
'',
|
|
62
|
+
'# Upgrade from a specific URL',
|
|
54
63
|
'$ jbrowse upgrade --url https://sample.com/jbrowse2.zip',
|
|
64
|
+
'',
|
|
65
|
+
'# Get nightly release from main branch',
|
|
66
|
+
'$ jbrowse upgrade --nightly',
|
|
55
67
|
];
|
|
56
68
|
Upgrade.args = [
|
|
57
69
|
{
|
|
@@ -60,12 +72,6 @@ Upgrade.args = [
|
|
|
60
72
|
description: `Location where JBrowse 2 is installed`,
|
|
61
73
|
default: '.',
|
|
62
74
|
},
|
|
63
|
-
{
|
|
64
|
-
name: 'placeholder',
|
|
65
|
-
required: false,
|
|
66
|
-
description: `Placeholder for config file migration scripts`,
|
|
67
|
-
hidden: true,
|
|
68
|
-
},
|
|
69
75
|
];
|
|
70
76
|
Upgrade.flags = {
|
|
71
77
|
help: command_1.flags.help({ char: 'h' }),
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.run = void 0;
|
|
3
4
|
var command_1 = require("@oclif/command");
|
|
4
5
|
Object.defineProperty(exports, "run", { enumerable: true, get: function () { return command_1.run; } });
|
|
5
6
|
// trigger build
|
package/lib/types/common.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateMeta = exports.supported = exports.guessAdapterFromFileName = exports.isURL = exports.createRemoteStream = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
5
|
+
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
6
6
|
const follow_redirects_1 = require("follow-redirects");
|
|
7
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
8
8
|
// Method for handing off the parsing of a gff3 file URL.
|
|
9
9
|
// Calls the proper parser depending on if it is gzipped or not.
|
|
10
10
|
// Returns a @gmod/gff stream.
|
|
@@ -37,7 +37,7 @@ function guessAdapterFromFileName(filePath) {
|
|
|
37
37
|
assemblyNames: [],
|
|
38
38
|
adapter: {
|
|
39
39
|
type: 'VcfTabixAdapter',
|
|
40
|
-
vcfGzLocation: { uri },
|
|
40
|
+
vcfGzLocation: { uri, locationType: 'UriLocation' },
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
43
|
}
|
|
@@ -48,7 +48,7 @@ function guessAdapterFromFileName(filePath) {
|
|
|
48
48
|
assemblyNames: [],
|
|
49
49
|
adapter: {
|
|
50
50
|
type: 'Gff3TabixAdapter',
|
|
51
|
-
gffGzLocation: { uri },
|
|
51
|
+
gffGzLocation: { uri, locationType: 'UriLocation' },
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
54
|
}
|
|
@@ -58,8 +58,8 @@ function guessAdapterFromFileName(filePath) {
|
|
|
58
58
|
name,
|
|
59
59
|
assemblyNames: [],
|
|
60
60
|
adapter: {
|
|
61
|
-
type: '
|
|
62
|
-
|
|
61
|
+
type: 'GtfAdapter',
|
|
62
|
+
gtfLocation: { uri, locationType: 'UriLocation' },
|
|
63
63
|
},
|
|
64
64
|
};
|
|
65
65
|
}
|
|
@@ -69,7 +69,7 @@ function guessAdapterFromFileName(filePath) {
|
|
|
69
69
|
}
|
|
70
70
|
exports.guessAdapterFromFileName = guessAdapterFromFileName;
|
|
71
71
|
function supported(type) {
|
|
72
|
-
return ['Gff3TabixAdapter', '
|
|
72
|
+
return ['Gff3TabixAdapter', 'VcfTabixAdapter'].includes(type);
|
|
73
73
|
}
|
|
74
74
|
exports.supported = supported;
|
|
75
75
|
/**
|
package/lib/types/gff3Adapter.js
CHANGED
|
@@ -5,11 +5,11 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const common_1 = require("../types/common");
|
|
6
6
|
const cli_progress_1 = require("cli-progress");
|
|
7
7
|
const zlib_1 = require("zlib");
|
|
8
|
-
const readline_1 = tslib_1.__importDefault(require("readline"));
|
|
9
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
10
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
8
|
+
const readline_1 = (0, tslib_1.__importDefault)(require("readline"));
|
|
9
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
10
|
+
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
11
11
|
function indexGff3(config, attributes, outLocation, typesToExclude, quiet) {
|
|
12
|
-
return tslib_1.__asyncGenerator(this, arguments, function* indexGff3_1() {
|
|
12
|
+
return (0, tslib_1.__asyncGenerator)(this, arguments, function* indexGff3_1() {
|
|
13
13
|
var e_1, _a;
|
|
14
14
|
const { adapter, trackId } = config;
|
|
15
15
|
const { gffGzLocation: { uri }, } = adapter;
|
|
@@ -22,8 +22,8 @@ function indexGff3(config, attributes, outLocation, typesToExclude, quiet) {
|
|
|
22
22
|
let fileDataStream;
|
|
23
23
|
let totalBytes = 0;
|
|
24
24
|
let receivedBytes = 0;
|
|
25
|
-
if (common_1.isURL(uri)) {
|
|
26
|
-
fileDataStream = yield tslib_1.__await(common_1.createRemoteStream(uri));
|
|
25
|
+
if ((0, common_1.isURL)(uri)) {
|
|
26
|
+
fileDataStream = yield (0, tslib_1.__await)((0, common_1.createRemoteStream)(uri));
|
|
27
27
|
totalBytes = +(fileDataStream.headers['content-length'] || 0);
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
@@ -40,11 +40,11 @@ function indexGff3(config, attributes, outLocation, typesToExclude, quiet) {
|
|
|
40
40
|
});
|
|
41
41
|
const rl = readline_1.default.createInterface({
|
|
42
42
|
input: uri.endsWith('.gz')
|
|
43
|
-
? fileDataStream.pipe(zlib_1.createGunzip())
|
|
43
|
+
? fileDataStream.pipe((0, zlib_1.createGunzip)())
|
|
44
44
|
: fileDataStream,
|
|
45
45
|
});
|
|
46
46
|
try {
|
|
47
|
-
for (var rl_1 = tslib_1.__asyncValues(rl), rl_1_1; rl_1_1 = yield tslib_1.__await(rl_1.next()), !rl_1_1.done;) {
|
|
47
|
+
for (var rl_1 = (0, tslib_1.__asyncValues)(rl), rl_1_1; rl_1_1 = yield (0, tslib_1.__await)(rl_1.next()), !rl_1_1.done;) {
|
|
48
48
|
const line = rl_1_1.value;
|
|
49
49
|
if (line.startsWith('#')) {
|
|
50
50
|
continue;
|
|
@@ -75,7 +75,7 @@ function indexGff3(config, attributes, outLocation, typesToExclude, quiet) {
|
|
|
75
75
|
encodeURIComponent(trackId),
|
|
76
76
|
...attrs.map(a => encodeURIComponent(a)),
|
|
77
77
|
]).replace(/,/g, '|');
|
|
78
|
-
yield yield tslib_1.__await(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
78
|
+
yield yield (0, tslib_1.__await)(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -83,7 +83,7 @@ function indexGff3(config, attributes, outLocation, typesToExclude, quiet) {
|
|
|
83
83
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
84
84
|
finally {
|
|
85
85
|
try {
|
|
86
|
-
if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield tslib_1.__await(_a.call(rl_1));
|
|
86
|
+
if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield (0, tslib_1.__await)(_a.call(rl_1));
|
|
87
87
|
}
|
|
88
88
|
finally { if (e_1) throw e_1.error; }
|
|
89
89
|
}
|
package/lib/types/gtfAdapter.js
CHANGED
|
@@ -5,14 +5,14 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const common_1 = require("../types/common");
|
|
6
6
|
const cli_progress_1 = require("cli-progress");
|
|
7
7
|
const zlib_1 = require("zlib");
|
|
8
|
-
const readline_1 = tslib_1.__importDefault(require("readline"));
|
|
9
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
10
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
8
|
+
const readline_1 = (0, tslib_1.__importDefault)(require("readline"));
|
|
9
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
10
|
+
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
11
11
|
function indexGtf(config, attributes, outLocation, typesToExclude, quiet) {
|
|
12
|
-
return tslib_1.__asyncGenerator(this, arguments, function* indexGtf_1() {
|
|
12
|
+
return (0, tslib_1.__asyncGenerator)(this, arguments, function* indexGtf_1() {
|
|
13
13
|
var e_1, _a;
|
|
14
14
|
const { adapter, trackId } = config;
|
|
15
|
-
const {
|
|
15
|
+
const { gtfLocation: { uri }, } = adapter;
|
|
16
16
|
// progress bar code was aided by blog post at
|
|
17
17
|
// https://webomnizz.com/download-a-file-with-progressbar-using-node-js/
|
|
18
18
|
const progressBar = new cli_progress_1.SingleBar({
|
|
@@ -22,8 +22,8 @@ function indexGtf(config, attributes, outLocation, typesToExclude, quiet) {
|
|
|
22
22
|
let fileDataStream;
|
|
23
23
|
let totalBytes = 0;
|
|
24
24
|
let receivedBytes = 0;
|
|
25
|
-
if (common_1.isURL(uri)) {
|
|
26
|
-
fileDataStream = yield tslib_1.__await(common_1.createRemoteStream(uri));
|
|
25
|
+
if ((0, common_1.isURL)(uri)) {
|
|
26
|
+
fileDataStream = yield (0, tslib_1.__await)((0, common_1.createRemoteStream)(uri));
|
|
27
27
|
totalBytes = +(fileDataStream.headers['content-length'] || 0);
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
@@ -39,13 +39,13 @@ function indexGtf(config, attributes, outLocation, typesToExclude, quiet) {
|
|
|
39
39
|
progressBar.update(receivedBytes);
|
|
40
40
|
});
|
|
41
41
|
const gzStream = uri.endsWith('.gz')
|
|
42
|
-
? fileDataStream.pipe(zlib_1.createGunzip())
|
|
42
|
+
? fileDataStream.pipe((0, zlib_1.createGunzip)())
|
|
43
43
|
: fileDataStream;
|
|
44
44
|
const rl = readline_1.default.createInterface({
|
|
45
45
|
input: gzStream,
|
|
46
46
|
});
|
|
47
47
|
try {
|
|
48
|
-
for (var rl_1 = tslib_1.__asyncValues(rl), rl_1_1; rl_1_1 = yield tslib_1.__await(rl_1.next()), !rl_1_1.done;) {
|
|
48
|
+
for (var rl_1 = (0, tslib_1.__asyncValues)(rl), rl_1_1; rl_1_1 = yield (0, tslib_1.__await)(rl_1.next()), !rl_1_1.done;) {
|
|
49
49
|
const line = rl_1_1.value;
|
|
50
50
|
if (line.startsWith('#')) {
|
|
51
51
|
continue;
|
|
@@ -67,24 +67,16 @@ function indexGtf(config, attributes, outLocation, typesToExclude, quiet) {
|
|
|
67
67
|
val.trim().split(',').join(' ').replace(/("|')/g, ''),
|
|
68
68
|
];
|
|
69
69
|
}));
|
|
70
|
-
const name = col9Attrs['gene_name'] || '';
|
|
71
|
-
const id = col9Attrs['gene_id'] || '';
|
|
72
70
|
const attrs = attributes
|
|
73
71
|
.map(attr => col9Attrs[attr])
|
|
74
72
|
.filter((f) => !!f);
|
|
75
|
-
|
|
76
|
-
.filter(attr => attr !== 'gene_name' && attr !== 'gene_id')
|
|
77
|
-
.map(attr => col9Attrs[attr])
|
|
78
|
-
.filter((f) => !!f);
|
|
79
|
-
if (name || id) {
|
|
73
|
+
if (attrs.length) {
|
|
80
74
|
const record = JSON.stringify([
|
|
81
75
|
encodeURIComponent(locStr),
|
|
82
76
|
encodeURIComponent(trackId),
|
|
83
|
-
encodeURIComponent(
|
|
84
|
-
encodeURIComponent(id),
|
|
85
|
-
...restAttrs.map(a => encodeURIComponent(a || '')),
|
|
77
|
+
...attrs.map(a => encodeURIComponent(a || '')),
|
|
86
78
|
]).replace(/,/g, '|');
|
|
87
|
-
yield yield tslib_1.__await(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
79
|
+
yield yield (0, tslib_1.__await)(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
88
80
|
}
|
|
89
81
|
}
|
|
90
82
|
}
|
|
@@ -92,7 +84,7 @@ function indexGtf(config, attributes, outLocation, typesToExclude, quiet) {
|
|
|
92
84
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
93
85
|
finally {
|
|
94
86
|
try {
|
|
95
|
-
if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield tslib_1.__await(_a.call(rl_1));
|
|
87
|
+
if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield (0, tslib_1.__await)(_a.call(rl_1));
|
|
96
88
|
}
|
|
97
89
|
finally { if (e_1) throw e_1.error; }
|
|
98
90
|
}
|
package/lib/types/vcfAdapter.js
CHANGED
|
@@ -5,11 +5,11 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const common_1 = require("../types/common");
|
|
6
6
|
const cli_progress_1 = require("cli-progress");
|
|
7
7
|
const zlib_1 = require("zlib");
|
|
8
|
-
const readline_1 = tslib_1.__importDefault(require("readline"));
|
|
9
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
10
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
8
|
+
const readline_1 = (0, tslib_1.__importDefault)(require("readline"));
|
|
9
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
10
|
+
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
11
11
|
function indexVcf(config, attributesToIndex, outLocation, typesToExclude, quiet) {
|
|
12
|
-
return tslib_1.__asyncGenerator(this, arguments, function* indexVcf_1() {
|
|
12
|
+
return (0, tslib_1.__asyncGenerator)(this, arguments, function* indexVcf_1() {
|
|
13
13
|
var e_1, _a;
|
|
14
14
|
const { adapter, trackId } = config;
|
|
15
15
|
const { vcfGzLocation: { uri }, } = adapter;
|
|
@@ -22,8 +22,8 @@ function indexVcf(config, attributesToIndex, outLocation, typesToExclude, quiet)
|
|
|
22
22
|
let fileDataStream;
|
|
23
23
|
let totalBytes = 0;
|
|
24
24
|
let receivedBytes = 0;
|
|
25
|
-
if (common_1.isURL(uri)) {
|
|
26
|
-
fileDataStream = yield tslib_1.__await(common_1.createRemoteStream(uri));
|
|
25
|
+
if ((0, common_1.isURL)(uri)) {
|
|
26
|
+
fileDataStream = yield (0, tslib_1.__await)((0, common_1.createRemoteStream)(uri));
|
|
27
27
|
totalBytes = +(fileDataStream.headers['content-length'] || 0);
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
@@ -39,17 +39,18 @@ function indexVcf(config, attributesToIndex, outLocation, typesToExclude, quiet)
|
|
|
39
39
|
progressBar.update(receivedBytes);
|
|
40
40
|
});
|
|
41
41
|
const gzStream = uri.endsWith('.gz')
|
|
42
|
-
? fileDataStream.pipe(zlib_1.createGunzip())
|
|
42
|
+
? fileDataStream.pipe((0, zlib_1.createGunzip)())
|
|
43
43
|
: fileDataStream;
|
|
44
44
|
const rl = readline_1.default.createInterface({
|
|
45
45
|
input: gzStream,
|
|
46
46
|
});
|
|
47
47
|
try {
|
|
48
|
-
for (var rl_1 = tslib_1.__asyncValues(rl), rl_1_1; rl_1_1 = yield tslib_1.__await(rl_1.next()), !rl_1_1.done;) {
|
|
48
|
+
for (var rl_1 = (0, tslib_1.__asyncValues)(rl), rl_1_1; rl_1_1 = yield (0, tslib_1.__await)(rl_1.next()), !rl_1_1.done;) {
|
|
49
49
|
const line = rl_1_1.value;
|
|
50
50
|
if (line.startsWith('#')) {
|
|
51
51
|
continue;
|
|
52
52
|
}
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
53
54
|
const [ref, pos, id, _ref, _alt, _qual, _filter, info] = line.split('\t');
|
|
54
55
|
// turns gff3 attrs into a map, and converts the arrays into space
|
|
55
56
|
// separated strings
|
|
@@ -80,14 +81,14 @@ function indexVcf(config, attributesToIndex, outLocation, typesToExclude, quiet)
|
|
|
80
81
|
encodeURIComponent(id || ''),
|
|
81
82
|
...infoAttrs.map(a => encodeURIComponent(a || '')),
|
|
82
83
|
]).replace(/,/g, '|');
|
|
83
|
-
yield yield tslib_1.__await(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
84
|
+
yield yield (0, tslib_1.__await)(`${record} ${[...new Set(attrs)].join(' ')}\n`);
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
88
89
|
finally {
|
|
89
90
|
try {
|
|
90
|
-
if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield tslib_1.__await(_a.call(rl_1));
|
|
91
|
+
if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield (0, tslib_1.__await)(_a.call(rl_1));
|
|
91
92
|
}
|
|
92
93
|
finally { if (e_1) throw e_1.error; }
|
|
93
94
|
}
|