@jbrowse/text-indexing 5.0.0-beta.8 → 5.0.0-beta.9
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/esm/TextIndexing.d.ts +1 -2
- package/esm/TextIndexing.js +14 -15
- package/package.json +3 -3
package/esm/TextIndexing.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { indexType } from './util.ts';
|
|
2
2
|
import type { StatusCallback } from '@jbrowse/core/util';
|
|
3
|
-
import type { StopToken } from '@jbrowse/core/util/stopToken';
|
|
4
3
|
import type { Track } from '@jbrowse/text-indexing-core';
|
|
5
4
|
export declare function indexTracks(args: {
|
|
6
5
|
tracks: Track[];
|
|
7
6
|
outDir: string;
|
|
8
|
-
|
|
7
|
+
signal?: AbortSignal;
|
|
9
8
|
attributesToIndex?: string[];
|
|
10
9
|
assemblyNames?: string[];
|
|
11
10
|
featureTypesToExclude?: string[];
|
package/esm/TextIndexing.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { Readable } from 'node:stream';
|
|
4
|
-
import {
|
|
4
|
+
import { checkAbortSignal } from '@jbrowse/core/util/aborting';
|
|
5
5
|
import { TRIX_DIR, defaultAttributesToIndex, defaultFeatureTypesToExclude, generateMeta, indexFiles, isSupportedIndexingAdapter, trixFilePaths, } from '@jbrowse/text-indexing-core';
|
|
6
6
|
import { ixIxxStream } from 'ixixx';
|
|
7
7
|
export async function indexTracks(args) {
|
|
8
|
-
const { tracks, outDir, attributesToIndex, featureTypesToExclude, assemblyNames, indexType, statusCallback,
|
|
8
|
+
const { tracks, outDir, attributesToIndex, featureTypesToExclude, assemblyNames, indexType, statusCallback, signal, } = args;
|
|
9
9
|
const idxType = indexType || 'perTrack';
|
|
10
|
-
|
|
10
|
+
checkAbortSignal(signal);
|
|
11
11
|
await (idxType === 'perTrack'
|
|
12
12
|
? perTrackIndex({
|
|
13
13
|
tracks,
|
|
@@ -15,7 +15,7 @@ export async function indexTracks(args) {
|
|
|
15
15
|
outDir,
|
|
16
16
|
attributesToIndex,
|
|
17
17
|
featureTypesToExclude,
|
|
18
|
-
|
|
18
|
+
signal,
|
|
19
19
|
})
|
|
20
20
|
: aggregateIndex({
|
|
21
21
|
tracks,
|
|
@@ -24,14 +24,14 @@ export async function indexTracks(args) {
|
|
|
24
24
|
attributesToIndex,
|
|
25
25
|
assemblyNames,
|
|
26
26
|
featureTypesToExclude,
|
|
27
|
-
|
|
27
|
+
signal,
|
|
28
28
|
}));
|
|
29
|
-
|
|
29
|
+
checkAbortSignal(signal);
|
|
30
30
|
}
|
|
31
31
|
function ensureTrixDir(outDir) {
|
|
32
32
|
fs.mkdirSync(path.join(outDir, TRIX_DIR), { recursive: true });
|
|
33
33
|
}
|
|
34
|
-
async function perTrackIndex({ tracks, statusCallback, outDir, attributesToIndex = defaultAttributesToIndex, featureTypesToExclude = defaultFeatureTypesToExclude,
|
|
34
|
+
async function perTrackIndex({ tracks, statusCallback, outDir, attributesToIndex = defaultAttributesToIndex, featureTypesToExclude = defaultFeatureTypesToExclude, signal, }) {
|
|
35
35
|
ensureTrixDir(outDir);
|
|
36
36
|
const supportedTracks = tracks.filter(track => isSupportedIndexingAdapter(track.adapter?.type));
|
|
37
37
|
for (const trackConfig of supportedTracks) {
|
|
@@ -44,11 +44,11 @@ async function perTrackIndex({ tracks, statusCallback, outDir, attributesToIndex
|
|
|
44
44
|
featureTypesToExclude,
|
|
45
45
|
assemblyNames,
|
|
46
46
|
statusCallback,
|
|
47
|
-
|
|
47
|
+
signal,
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
async function aggregateIndex({ tracks, statusCallback, outDir, attributesToIndex = defaultAttributesToIndex, featureTypesToExclude = defaultFeatureTypesToExclude,
|
|
51
|
+
async function aggregateIndex({ tracks, statusCallback, outDir, attributesToIndex = defaultAttributesToIndex, featureTypesToExclude = defaultFeatureTypesToExclude, signal, assemblyNames, }) {
|
|
52
52
|
if (!assemblyNames) {
|
|
53
53
|
throw new Error('No assemblies passed. Assemblies required for aggregate indexes');
|
|
54
54
|
}
|
|
@@ -65,12 +65,11 @@ async function aggregateIndex({ tracks, statusCallback, outDir, attributesToInde
|
|
|
65
65
|
featureTypesToExclude,
|
|
66
66
|
assemblyNames: [asm],
|
|
67
67
|
statusCallback,
|
|
68
|
-
|
|
68
|
+
signal,
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
async function indexDriver({ tracks, outDir, attributesToIndex, name, featureTypesToExclude, assemblyNames, statusCallback,
|
|
73
|
-
const checker = createStopTokenChecker(stopToken);
|
|
72
|
+
async function indexDriver({ tracks, outDir, attributesToIndex, name, featureTypesToExclude, assemblyNames, statusCallback, signal, }) {
|
|
74
73
|
// accumulate across tracks so an aggregate index reports monotonic progress
|
|
75
74
|
// rather than resetting to zero at each track. The denominator grows as each
|
|
76
75
|
// track's size is discovered (we don't stat every file up front), but the
|
|
@@ -83,7 +82,7 @@ async function indexDriver({ tracks, outDir, attributesToIndex, name, featureTyp
|
|
|
83
82
|
outDir,
|
|
84
83
|
featureTypesToExclude,
|
|
85
84
|
checkAbort: () => {
|
|
86
|
-
|
|
85
|
+
checkAbortSignal(signal);
|
|
87
86
|
},
|
|
88
87
|
makeProgress: () => {
|
|
89
88
|
let trackTotal = 0;
|
|
@@ -112,7 +111,7 @@ async function indexDriver({ tracks, outDir, attributesToIndex, name, featureTyp
|
|
|
112
111
|
});
|
|
113
112
|
statusCallback?.('Indexing files');
|
|
114
113
|
await runIxIxx(readable, outDir, name);
|
|
115
|
-
|
|
114
|
+
checkAbortSignal(signal);
|
|
116
115
|
generateMeta({
|
|
117
116
|
configs: tracks,
|
|
118
117
|
attributesToIndex,
|
|
@@ -121,7 +120,7 @@ async function indexDriver({ tracks, outDir, attributesToIndex, name, featureTyp
|
|
|
121
120
|
featureTypesToExclude,
|
|
122
121
|
assemblyNames,
|
|
123
122
|
});
|
|
124
|
-
|
|
123
|
+
checkAbortSignal(signal);
|
|
125
124
|
}
|
|
126
125
|
function runIxIxx(readStream, idxLocation, name) {
|
|
127
126
|
const { ix, ixx } = trixFilePaths(idxLocation, name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/text-indexing",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JBrowse 2 text indexing for desktop",
|
|
6
6
|
"keywords": [
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"ixixx": "^3.0.13",
|
|
32
|
-
"@jbrowse/
|
|
33
|
-
"@jbrowse/core": "^5.0.0-beta.
|
|
32
|
+
"@jbrowse/core": "^5.0.0-beta.9",
|
|
33
|
+
"@jbrowse/text-indexing-core": "^5.0.0-beta.9"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": ">=19.0.0",
|