@jbrowse/text-indexing 2.17.0 → 2.18.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/dist/TextIndexing.d.ts +2 -2
- package/dist/TextIndexing.js +17 -17
- package/dist/types/common.d.ts +1 -4
- package/dist/types/common.js +1 -9
- package/dist/types/gff3Adapter.js +1 -4
- package/dist/types/vcfAdapter.js +1 -5
- package/dist/util.js +1 -2
- package/esm/TextIndexing.d.ts +2 -2
- package/esm/TextIndexing.js +17 -17
- package/esm/types/common.d.ts +1 -4
- package/esm/types/common.js +1 -9
- package/esm/types/gff3Adapter.js +1 -4
- package/esm/types/vcfAdapter.js +1 -5
- package/esm/util.js +1 -2
- package/package.json +3 -3
package/dist/TextIndexing.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Track, indexType } from './util';
|
|
1
|
+
import type { Track, indexType } from './util';
|
|
2
2
|
export declare function indexTracks(args: {
|
|
3
3
|
tracks: Track[];
|
|
4
4
|
outDir?: string;
|
|
5
|
-
|
|
5
|
+
stopToken?: string;
|
|
6
6
|
attributesToIndex?: string[];
|
|
7
7
|
assemblyNames?: string[];
|
|
8
8
|
featureTypesToExclude?: string[];
|
package/dist/TextIndexing.js
CHANGED
|
@@ -7,15 +7,16 @@ exports.indexTracks = indexTracks;
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const stream_1 = require("stream");
|
|
10
|
+
const util_1 = require("@jbrowse/core/util");
|
|
11
|
+
const stopToken_1 = require("@jbrowse/core/util/stopToken");
|
|
12
|
+
const ixixx_1 = require("ixixx");
|
|
13
|
+
const common_1 = require("./types/common");
|
|
10
14
|
const gff3Adapter_1 = require("./types/gff3Adapter");
|
|
11
15
|
const vcfAdapter_1 = require("./types/vcfAdapter");
|
|
12
|
-
const common_1 = require("./types/common");
|
|
13
|
-
const ixixx_1 = require("ixixx");
|
|
14
|
-
const util_1 = require("@jbrowse/core/util");
|
|
15
16
|
async function indexTracks(args) {
|
|
16
|
-
const { tracks, outDir, attributesToIndex, featureTypesToExclude, assemblyNames, indexType, statusCallback,
|
|
17
|
+
const { tracks, outDir, attributesToIndex, featureTypesToExclude, assemblyNames, indexType, statusCallback, stopToken, } = args;
|
|
17
18
|
const idxType = indexType || 'perTrack';
|
|
18
|
-
(0,
|
|
19
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
19
20
|
await (idxType === 'perTrack'
|
|
20
21
|
? perTrackIndex({
|
|
21
22
|
tracks,
|
|
@@ -23,7 +24,7 @@ async function indexTracks(args) {
|
|
|
23
24
|
outDir,
|
|
24
25
|
attributesToIndex,
|
|
25
26
|
featureTypesToExclude,
|
|
26
|
-
|
|
27
|
+
stopToken,
|
|
27
28
|
})
|
|
28
29
|
: aggregateIndex({
|
|
29
30
|
tracks,
|
|
@@ -32,12 +33,12 @@ async function indexTracks(args) {
|
|
|
32
33
|
attributesToIndex,
|
|
33
34
|
assemblyNames,
|
|
34
35
|
featureTypesToExclude,
|
|
35
|
-
|
|
36
|
+
stopToken,
|
|
36
37
|
}));
|
|
37
|
-
(0,
|
|
38
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
38
39
|
return [];
|
|
39
40
|
}
|
|
40
|
-
async function perTrackIndex({ tracks, statusCallback, outDir: paramOutDir, attributesToIndex = ['Name', 'ID'], featureTypesToExclude = ['exon', 'CDS'],
|
|
41
|
+
async function perTrackIndex({ tracks, statusCallback, outDir: paramOutDir, attributesToIndex = ['Name', 'ID'], featureTypesToExclude = ['exon', 'CDS'], stopToken, }) {
|
|
41
42
|
const outFlag = paramOutDir || '.';
|
|
42
43
|
const isDir = fs_1.default.lstatSync(outFlag).isDirectory();
|
|
43
44
|
const confFilePath = isDir ? path_1.default.join(outFlag, 'config.json') : outFlag;
|
|
@@ -46,7 +47,6 @@ async function perTrackIndex({ tracks, statusCallback, outDir: paramOutDir, attr
|
|
|
46
47
|
if (!fs_1.default.existsSync(trixDir)) {
|
|
47
48
|
fs_1.default.mkdirSync(trixDir);
|
|
48
49
|
}
|
|
49
|
-
// default settings
|
|
50
50
|
const supportedTracks = tracks.filter(track => { var _a; return (0, util_1.isSupportedIndexingAdapter)((_a = track.adapter) === null || _a === void 0 ? void 0 : _a.type); });
|
|
51
51
|
for (const trackConfig of supportedTracks) {
|
|
52
52
|
const { trackId, assemblyNames } = trackConfig;
|
|
@@ -59,11 +59,11 @@ async function perTrackIndex({ tracks, statusCallback, outDir: paramOutDir, attr
|
|
|
59
59
|
featureTypesToExclude,
|
|
60
60
|
assemblyNames,
|
|
61
61
|
statusCallback,
|
|
62
|
-
|
|
62
|
+
stopToken,
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
async function aggregateIndex({ tracks, statusCallback, outDir: paramOutDir, attributesToIndex = ['Name', 'ID'], featureTypesToExclude = ['exon', 'CDS'],
|
|
66
|
+
async function aggregateIndex({ tracks, statusCallback, outDir: paramOutDir, attributesToIndex = ['Name', 'ID'], featureTypesToExclude = ['exon', 'CDS'], stopToken, assemblyNames, }) {
|
|
67
67
|
const outFlag = paramOutDir || '.';
|
|
68
68
|
const isDir = fs_1.default.lstatSync(outFlag).isDirectory();
|
|
69
69
|
const confFilePath = isDir ? path_1.default.join(outFlag, 'config.json') : outFlag;
|
|
@@ -88,22 +88,22 @@ async function aggregateIndex({ tracks, statusCallback, outDir: paramOutDir, att
|
|
|
88
88
|
featureTypesToExclude,
|
|
89
89
|
assemblyNames: [asm],
|
|
90
90
|
statusCallback,
|
|
91
|
-
|
|
91
|
+
stopToken,
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
async function indexDriver({ tracks, outDir, attributesToIndex, name, featureTypesToExclude, assemblyNames, statusCallback,
|
|
95
|
+
async function indexDriver({ tracks, outDir, attributesToIndex, name, featureTypesToExclude, assemblyNames, statusCallback, stopToken, }) {
|
|
96
96
|
const readable = stream_1.Readable.from(indexFiles({
|
|
97
97
|
tracks,
|
|
98
98
|
attributesToIndex,
|
|
99
99
|
outDir,
|
|
100
100
|
featureTypesToExclude,
|
|
101
101
|
statusCallback,
|
|
102
|
-
|
|
102
|
+
stopToken,
|
|
103
103
|
}));
|
|
104
104
|
statusCallback('Indexing files.');
|
|
105
105
|
await runIxIxx(readable, outDir, name);
|
|
106
|
-
(0,
|
|
106
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
107
107
|
await (0, common_1.generateMeta)({
|
|
108
108
|
configs: tracks,
|
|
109
109
|
attributesToIndex,
|
|
@@ -112,7 +112,7 @@ async function indexDriver({ tracks, outDir, attributesToIndex, name, featureTyp
|
|
|
112
112
|
featureTypesToExclude,
|
|
113
113
|
assemblyNames,
|
|
114
114
|
});
|
|
115
|
-
(0,
|
|
115
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
116
116
|
}
|
|
117
117
|
async function* indexFiles({ tracks, attributesToIndex: idx1, outDir, featureTypesToExclude: edx1, statusCallback, }) {
|
|
118
118
|
for (const track of tracks) {
|
package/dist/types/common.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import fetch from 'node-fetch';
|
|
3
|
-
import { LocalPathLocation,
|
|
3
|
+
import type { LocalPathLocation, Track, UriLocation } from '../util';
|
|
4
4
|
export declare function createRemoteStream(urlIn: string): Promise<fetch.Response>;
|
|
5
5
|
export declare function isURL(FileName: string): boolean;
|
|
6
6
|
export declare function getLocalOrRemoteStream({ file, out, onBytesReceived, onTotalBytes, }: {
|
|
@@ -11,9 +11,6 @@ export declare function getLocalOrRemoteStream({ file, out, onBytesReceived, onT
|
|
|
11
11
|
}): Promise<NodeJS.ReadableStream | fs.ReadStream>;
|
|
12
12
|
export declare function makeLocation(location: string, protocol: string): UriLocation | LocalPathLocation;
|
|
13
13
|
export declare function guessAdapterFromFileName(filePath: string): Track;
|
|
14
|
-
/**
|
|
15
|
-
* Generates metadata of index given a filename (trackId or assembly)
|
|
16
|
-
*/
|
|
17
14
|
export declare function generateMeta({ configs, attributesToIndex, outDir, name, featureTypesToExclude, assemblyNames, }: {
|
|
18
15
|
configs: Track[];
|
|
19
16
|
attributesToIndex: string[];
|
package/dist/types/common.js
CHANGED
|
@@ -10,10 +10,8 @@ exports.makeLocation = makeLocation;
|
|
|
10
10
|
exports.guessAdapterFromFileName = guessAdapterFromFileName;
|
|
11
11
|
exports.generateMeta = generateMeta;
|
|
12
12
|
const fs_1 = __importDefault(require("fs"));
|
|
13
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
14
13
|
const path_1 = __importDefault(require("path"));
|
|
15
|
-
|
|
16
|
-
// parser depending on if it is gzipped or not. Returns a @gmod/gff stream.
|
|
14
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
17
15
|
async function createRemoteStream(urlIn) {
|
|
18
16
|
const res = await (0, node_fetch_1.default)(urlIn);
|
|
19
17
|
if (!res.ok) {
|
|
@@ -21,8 +19,6 @@ async function createRemoteStream(urlIn) {
|
|
|
21
19
|
}
|
|
22
20
|
return res;
|
|
23
21
|
}
|
|
24
|
-
// Checks if the passed in string is a valid URL.
|
|
25
|
-
// Returns a boolean.
|
|
26
22
|
function isURL(FileName) {
|
|
27
23
|
let url;
|
|
28
24
|
try {
|
|
@@ -68,7 +64,6 @@ function makeLocation(location, protocol) {
|
|
|
68
64
|
throw new Error(`invalid protocol ${protocol}`);
|
|
69
65
|
}
|
|
70
66
|
function guessAdapterFromFileName(filePath) {
|
|
71
|
-
// const uri = isURL(filePath) ? filePath : path.resolve(filePath)
|
|
72
67
|
const protocol = isURL(filePath) ? 'uri' : 'localPath';
|
|
73
68
|
const name = path_1.default.basename(filePath);
|
|
74
69
|
if (/\.vcf\.b?gz$/i.test(filePath)) {
|
|
@@ -130,9 +125,6 @@ function guessAdapterFromFileName(filePath) {
|
|
|
130
125
|
throw new Error(`Unsupported file type ${filePath}`);
|
|
131
126
|
}
|
|
132
127
|
}
|
|
133
|
-
/**
|
|
134
|
-
* Generates metadata of index given a filename (trackId or assembly)
|
|
135
|
-
*/
|
|
136
128
|
async function generateMeta({ configs, attributesToIndex, outDir, name, featureTypesToExclude, assemblyNames, }) {
|
|
137
129
|
fs_1.default.writeFileSync(path_1.default.join(outDir, 'trix', `${name}_meta.json`), JSON.stringify({
|
|
138
130
|
dateCreated: new Date().toISOString(),
|
|
@@ -4,9 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.indexGff3 = indexGff3;
|
|
7
|
-
const zlib_1 = require("zlib");
|
|
8
7
|
const readline_1 = __importDefault(require("readline"));
|
|
9
|
-
|
|
8
|
+
const zlib_1 = require("zlib");
|
|
10
9
|
const util_1 = require("../util");
|
|
11
10
|
const common_1 = require("./common");
|
|
12
11
|
async function* indexGff3({ config, attributesToIndex, inLocation, outDir, featureTypesToExclude, onStart, onUpdate, }) {
|
|
@@ -33,8 +32,6 @@ async function* indexGff3({ config, attributesToIndex, inLocation, outDir, featu
|
|
|
33
32
|
const [seq_id, , type, start, end, , , , col9] = line.split('\t');
|
|
34
33
|
const locStr = `${seq_id}:${start}..${end}`;
|
|
35
34
|
if (!featureTypesToExclude.includes(type)) {
|
|
36
|
-
// turns gff3 attrs into a map, and converts the arrays into space
|
|
37
|
-
// separated strings
|
|
38
35
|
const col9attrs = Object.fromEntries(col9
|
|
39
36
|
.split(';')
|
|
40
37
|
.map(f => f.trim())
|
package/dist/types/vcfAdapter.js
CHANGED
|
@@ -4,9 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.indexVcf = indexVcf;
|
|
7
|
-
const zlib_1 = require("zlib");
|
|
8
7
|
const readline_1 = __importDefault(require("readline"));
|
|
9
|
-
|
|
8
|
+
const zlib_1 = require("zlib");
|
|
10
9
|
const util_1 = require("../util");
|
|
11
10
|
const common_1 = require("./common");
|
|
12
11
|
async function* indexVcf({ config, attributesToIndex, inLocation, outDir, onStart, onUpdate, }) {
|
|
@@ -27,10 +26,7 @@ async function* indexVcf({ config, attributesToIndex, inLocation, outDir, onStar
|
|
|
27
26
|
if (line.startsWith('#')) {
|
|
28
27
|
continue;
|
|
29
28
|
}
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
29
|
const [ref, pos, id, _ref, _alt, _qual, _filter, info] = line.split('\t');
|
|
32
|
-
// turns gff3 attrs into a map, and converts the arrays into space
|
|
33
|
-
// separated strings
|
|
34
30
|
const fields = Object.fromEntries(info
|
|
35
31
|
.split(';')
|
|
36
32
|
.map(f => f.trim())
|
package/dist/util.js
CHANGED
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.createTextSearchConf = createTextSearchConf;
|
|
7
7
|
exports.findTrackConfigsToIndex = findTrackConfigsToIndex;
|
|
8
8
|
exports.decodeURIComponentNoThrow = decodeURIComponentNoThrow;
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
9
10
|
const util_1 = require("@jbrowse/core/util");
|
|
10
11
|
const sanitize_filename_1 = __importDefault(require("sanitize-filename"));
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
12
12
|
function createTextSearchConf(name, trackIds, assemblyNames, locationPath) {
|
|
13
13
|
const base = path_1.default.join(locationPath, 'trix');
|
|
14
14
|
const n = (0, sanitize_filename_1.default)(name);
|
|
@@ -48,7 +48,6 @@ function decodeURIComponentNoThrow(uri) {
|
|
|
48
48
|
return decodeURIComponent(uri);
|
|
49
49
|
}
|
|
50
50
|
catch (e) {
|
|
51
|
-
// avoid throwing exception on a failure to decode URI component
|
|
52
51
|
return uri;
|
|
53
52
|
}
|
|
54
53
|
}
|
package/esm/TextIndexing.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Track, indexType } from './util';
|
|
1
|
+
import type { Track, indexType } from './util';
|
|
2
2
|
export declare function indexTracks(args: {
|
|
3
3
|
tracks: Track[];
|
|
4
4
|
outDir?: string;
|
|
5
|
-
|
|
5
|
+
stopToken?: string;
|
|
6
6
|
attributesToIndex?: string[];
|
|
7
7
|
assemblyNames?: string[];
|
|
8
8
|
featureTypesToExclude?: string[];
|
package/esm/TextIndexing.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { Readable } from 'stream';
|
|
4
|
+
import { isSupportedIndexingAdapter } from '@jbrowse/core/util';
|
|
5
|
+
import { checkStopToken } from '@jbrowse/core/util/stopToken';
|
|
6
|
+
import { ixIxxStream } from 'ixixx';
|
|
7
|
+
import { generateMeta } from './types/common';
|
|
4
8
|
import { indexGff3 } from './types/gff3Adapter';
|
|
5
9
|
import { indexVcf } from './types/vcfAdapter';
|
|
6
|
-
import { generateMeta } from './types/common';
|
|
7
|
-
import { ixIxxStream } from 'ixixx';
|
|
8
|
-
import { checkAbortSignal, isSupportedIndexingAdapter, } from '@jbrowse/core/util';
|
|
9
10
|
export async function indexTracks(args) {
|
|
10
|
-
const { tracks, outDir, attributesToIndex, featureTypesToExclude, assemblyNames, indexType, statusCallback,
|
|
11
|
+
const { tracks, outDir, attributesToIndex, featureTypesToExclude, assemblyNames, indexType, statusCallback, stopToken, } = args;
|
|
11
12
|
const idxType = indexType || 'perTrack';
|
|
12
|
-
|
|
13
|
+
checkStopToken(stopToken);
|
|
13
14
|
await (idxType === 'perTrack'
|
|
14
15
|
? perTrackIndex({
|
|
15
16
|
tracks,
|
|
@@ -17,7 +18,7 @@ export async function indexTracks(args) {
|
|
|
17
18
|
outDir,
|
|
18
19
|
attributesToIndex,
|
|
19
20
|
featureTypesToExclude,
|
|
20
|
-
|
|
21
|
+
stopToken,
|
|
21
22
|
})
|
|
22
23
|
: aggregateIndex({
|
|
23
24
|
tracks,
|
|
@@ -26,12 +27,12 @@ export async function indexTracks(args) {
|
|
|
26
27
|
attributesToIndex,
|
|
27
28
|
assemblyNames,
|
|
28
29
|
featureTypesToExclude,
|
|
29
|
-
|
|
30
|
+
stopToken,
|
|
30
31
|
}));
|
|
31
|
-
|
|
32
|
+
checkStopToken(stopToken);
|
|
32
33
|
return [];
|
|
33
34
|
}
|
|
34
|
-
async function perTrackIndex({ tracks, statusCallback, outDir: paramOutDir, attributesToIndex = ['Name', 'ID'], featureTypesToExclude = ['exon', 'CDS'],
|
|
35
|
+
async function perTrackIndex({ tracks, statusCallback, outDir: paramOutDir, attributesToIndex = ['Name', 'ID'], featureTypesToExclude = ['exon', 'CDS'], stopToken, }) {
|
|
35
36
|
const outFlag = paramOutDir || '.';
|
|
36
37
|
const isDir = fs.lstatSync(outFlag).isDirectory();
|
|
37
38
|
const confFilePath = isDir ? path.join(outFlag, 'config.json') : outFlag;
|
|
@@ -40,7 +41,6 @@ async function perTrackIndex({ tracks, statusCallback, outDir: paramOutDir, attr
|
|
|
40
41
|
if (!fs.existsSync(trixDir)) {
|
|
41
42
|
fs.mkdirSync(trixDir);
|
|
42
43
|
}
|
|
43
|
-
// default settings
|
|
44
44
|
const supportedTracks = tracks.filter(track => { var _a; return isSupportedIndexingAdapter((_a = track.adapter) === null || _a === void 0 ? void 0 : _a.type); });
|
|
45
45
|
for (const trackConfig of supportedTracks) {
|
|
46
46
|
const { trackId, assemblyNames } = trackConfig;
|
|
@@ -53,11 +53,11 @@ async function perTrackIndex({ tracks, statusCallback, outDir: paramOutDir, attr
|
|
|
53
53
|
featureTypesToExclude,
|
|
54
54
|
assemblyNames,
|
|
55
55
|
statusCallback,
|
|
56
|
-
|
|
56
|
+
stopToken,
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
async function aggregateIndex({ tracks, statusCallback, outDir: paramOutDir, attributesToIndex = ['Name', 'ID'], featureTypesToExclude = ['exon', 'CDS'],
|
|
60
|
+
async function aggregateIndex({ tracks, statusCallback, outDir: paramOutDir, attributesToIndex = ['Name', 'ID'], featureTypesToExclude = ['exon', 'CDS'], stopToken, assemblyNames, }) {
|
|
61
61
|
const outFlag = paramOutDir || '.';
|
|
62
62
|
const isDir = fs.lstatSync(outFlag).isDirectory();
|
|
63
63
|
const confFilePath = isDir ? path.join(outFlag, 'config.json') : outFlag;
|
|
@@ -82,22 +82,22 @@ async function aggregateIndex({ tracks, statusCallback, outDir: paramOutDir, att
|
|
|
82
82
|
featureTypesToExclude,
|
|
83
83
|
assemblyNames: [asm],
|
|
84
84
|
statusCallback,
|
|
85
|
-
|
|
85
|
+
stopToken,
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
async function indexDriver({ tracks, outDir, attributesToIndex, name, featureTypesToExclude, assemblyNames, statusCallback,
|
|
89
|
+
async function indexDriver({ tracks, outDir, attributesToIndex, name, featureTypesToExclude, assemblyNames, statusCallback, stopToken, }) {
|
|
90
90
|
const readable = Readable.from(indexFiles({
|
|
91
91
|
tracks,
|
|
92
92
|
attributesToIndex,
|
|
93
93
|
outDir,
|
|
94
94
|
featureTypesToExclude,
|
|
95
95
|
statusCallback,
|
|
96
|
-
|
|
96
|
+
stopToken,
|
|
97
97
|
}));
|
|
98
98
|
statusCallback('Indexing files.');
|
|
99
99
|
await runIxIxx(readable, outDir, name);
|
|
100
|
-
|
|
100
|
+
checkStopToken(stopToken);
|
|
101
101
|
await generateMeta({
|
|
102
102
|
configs: tracks,
|
|
103
103
|
attributesToIndex,
|
|
@@ -106,7 +106,7 @@ async function indexDriver({ tracks, outDir, attributesToIndex, name, featureTyp
|
|
|
106
106
|
featureTypesToExclude,
|
|
107
107
|
assemblyNames,
|
|
108
108
|
});
|
|
109
|
-
|
|
109
|
+
checkStopToken(stopToken);
|
|
110
110
|
}
|
|
111
111
|
async function* indexFiles({ tracks, attributesToIndex: idx1, outDir, featureTypesToExclude: edx1, statusCallback, }) {
|
|
112
112
|
for (const track of tracks) {
|
package/esm/types/common.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import fetch from 'node-fetch';
|
|
3
|
-
import { LocalPathLocation,
|
|
3
|
+
import type { LocalPathLocation, Track, UriLocation } from '../util';
|
|
4
4
|
export declare function createRemoteStream(urlIn: string): Promise<fetch.Response>;
|
|
5
5
|
export declare function isURL(FileName: string): boolean;
|
|
6
6
|
export declare function getLocalOrRemoteStream({ file, out, onBytesReceived, onTotalBytes, }: {
|
|
@@ -11,9 +11,6 @@ export declare function getLocalOrRemoteStream({ file, out, onBytesReceived, onT
|
|
|
11
11
|
}): Promise<NodeJS.ReadableStream | fs.ReadStream>;
|
|
12
12
|
export declare function makeLocation(location: string, protocol: string): UriLocation | LocalPathLocation;
|
|
13
13
|
export declare function guessAdapterFromFileName(filePath: string): Track;
|
|
14
|
-
/**
|
|
15
|
-
* Generates metadata of index given a filename (trackId or assembly)
|
|
16
|
-
*/
|
|
17
14
|
export declare function generateMeta({ configs, attributesToIndex, outDir, name, featureTypesToExclude, assemblyNames, }: {
|
|
18
15
|
configs: Track[];
|
|
19
16
|
attributesToIndex: string[];
|
package/esm/types/common.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
-
import fetch from 'node-fetch';
|
|
3
2
|
import path from 'path';
|
|
4
|
-
|
|
5
|
-
// parser depending on if it is gzipped or not. Returns a @gmod/gff stream.
|
|
3
|
+
import fetch from 'node-fetch';
|
|
6
4
|
export async function createRemoteStream(urlIn) {
|
|
7
5
|
const res = await fetch(urlIn);
|
|
8
6
|
if (!res.ok) {
|
|
@@ -10,8 +8,6 @@ export async function createRemoteStream(urlIn) {
|
|
|
10
8
|
}
|
|
11
9
|
return res;
|
|
12
10
|
}
|
|
13
|
-
// Checks if the passed in string is a valid URL.
|
|
14
|
-
// Returns a boolean.
|
|
15
11
|
export function isURL(FileName) {
|
|
16
12
|
let url;
|
|
17
13
|
try {
|
|
@@ -57,7 +53,6 @@ export function makeLocation(location, protocol) {
|
|
|
57
53
|
throw new Error(`invalid protocol ${protocol}`);
|
|
58
54
|
}
|
|
59
55
|
export function guessAdapterFromFileName(filePath) {
|
|
60
|
-
// const uri = isURL(filePath) ? filePath : path.resolve(filePath)
|
|
61
56
|
const protocol = isURL(filePath) ? 'uri' : 'localPath';
|
|
62
57
|
const name = path.basename(filePath);
|
|
63
58
|
if (/\.vcf\.b?gz$/i.test(filePath)) {
|
|
@@ -119,9 +114,6 @@ export function guessAdapterFromFileName(filePath) {
|
|
|
119
114
|
throw new Error(`Unsupported file type ${filePath}`);
|
|
120
115
|
}
|
|
121
116
|
}
|
|
122
|
-
/**
|
|
123
|
-
* Generates metadata of index given a filename (trackId or assembly)
|
|
124
|
-
*/
|
|
125
117
|
export async function generateMeta({ configs, attributesToIndex, outDir, name, featureTypesToExclude, assemblyNames, }) {
|
|
126
118
|
fs.writeFileSync(path.join(outDir, 'trix', `${name}_meta.json`), JSON.stringify({
|
|
127
119
|
dateCreated: new Date().toISOString(),
|
package/esm/types/gff3Adapter.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { createGunzip } from 'zlib';
|
|
2
1
|
import readline from 'readline';
|
|
3
|
-
|
|
2
|
+
import { createGunzip } from 'zlib';
|
|
4
3
|
import { decodeURIComponentNoThrow } from '../util';
|
|
5
4
|
import { getLocalOrRemoteStream } from './common';
|
|
6
5
|
export async function* indexGff3({ config, attributesToIndex, inLocation, outDir, featureTypesToExclude, onStart, onUpdate, }) {
|
|
@@ -27,8 +26,6 @@ export async function* indexGff3({ config, attributesToIndex, inLocation, outDir
|
|
|
27
26
|
const [seq_id, , type, start, end, , , , col9] = line.split('\t');
|
|
28
27
|
const locStr = `${seq_id}:${start}..${end}`;
|
|
29
28
|
if (!featureTypesToExclude.includes(type)) {
|
|
30
|
-
// turns gff3 attrs into a map, and converts the arrays into space
|
|
31
|
-
// separated strings
|
|
32
29
|
const col9attrs = Object.fromEntries(col9
|
|
33
30
|
.split(';')
|
|
34
31
|
.map(f => f.trim())
|
package/esm/types/vcfAdapter.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { createGunzip } from 'zlib';
|
|
2
1
|
import readline from 'readline';
|
|
3
|
-
|
|
2
|
+
import { createGunzip } from 'zlib';
|
|
4
3
|
import { decodeURIComponentNoThrow } from '../util';
|
|
5
4
|
import { getLocalOrRemoteStream } from './common';
|
|
6
5
|
export async function* indexVcf({ config, attributesToIndex, inLocation, outDir, onStart, onUpdate, }) {
|
|
@@ -21,10 +20,7 @@ export async function* indexVcf({ config, attributesToIndex, inLocation, outDir,
|
|
|
21
20
|
if (line.startsWith('#')) {
|
|
22
21
|
continue;
|
|
23
22
|
}
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
23
|
const [ref, pos, id, _ref, _alt, _qual, _filter, info] = line.split('\t');
|
|
26
|
-
// turns gff3 attrs into a map, and converts the arrays into space
|
|
27
|
-
// separated strings
|
|
28
24
|
const fields = Object.fromEntries(info
|
|
29
25
|
.split(';')
|
|
30
26
|
.map(f => f.trim())
|
package/esm/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import path from 'path';
|
|
1
2
|
import { isSupportedIndexingAdapter } from '@jbrowse/core/util';
|
|
2
3
|
import sanitize from 'sanitize-filename';
|
|
3
|
-
import path from 'path';
|
|
4
4
|
export function createTextSearchConf(name, trackIds, assemblyNames, locationPath) {
|
|
5
5
|
const base = path.join(locationPath, 'trix');
|
|
6
6
|
const n = sanitize(name);
|
|
@@ -40,7 +40,6 @@ export function decodeURIComponentNoThrow(uri) {
|
|
|
40
40
|
return decodeURIComponent(uri);
|
|
41
41
|
}
|
|
42
42
|
catch (e) {
|
|
43
|
-
// avoid throwing exception on a failure to decode URI component
|
|
44
43
|
return uri;
|
|
45
44
|
}
|
|
46
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/text-indexing",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "JBrowse 2 text indexing for desktop",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@babel/runtime": "^7.16.3",
|
|
45
|
-
"@jbrowse/core": "^2.
|
|
45
|
+
"@jbrowse/core": "^2.18.0",
|
|
46
46
|
"ixixx": "^2.0.1",
|
|
47
47
|
"node-fetch": "^2.6.0",
|
|
48
48
|
"sanitize-filename": "^1.6.3"
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "c344ea60099cb7e460b77f15808946b24a7eee74"
|
|
62
62
|
}
|