From f3d9323d79cb64b669c206f54fd9db1ae4178a70 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 19 Sep 2024 09:48:04 -0400 Subject: [PATCH] Fix plaintext indexing desktop --- packages/text-indexing/src/TextIndexing.ts | 36 +++++++++++++++++-- .../jbrowse-desktop/src/indexJobsModel.ts | 1 + 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/packages/text-indexing/src/TextIndexing.ts b/packages/text-indexing/src/TextIndexing.ts index b0f3573cc8..25d940ab9c 100644 --- a/packages/text-indexing/src/TextIndexing.ts +++ b/packages/text-indexing/src/TextIndexing.ts @@ -215,7 +215,22 @@ async function* indexFiles({ indexingAttributes: attributesToIndex = idx1, } = textSearching || {} let myTotalBytes: number | undefined - if (type === 'Gff3TabixAdapter' || type === 'Gff3Adapter') { + if (type === 'Gff3Adapter') { + yield* indexGff3({ + config: track, + attributesToIndex, + inLocation: getLoc('gffLocation', track), + outDir, + featureTypesToExclude, + onStart: totalBytes => { + myTotalBytes = totalBytes + }, + onUpdate: progressBytes => { + statusCallback(`${progressBytes}/${myTotalBytes}`) + }, + }) + } + if (type === 'Gff3TabixAdapter') { yield* indexGff3({ config: track, attributesToIndex, @@ -229,7 +244,20 @@ async function* indexFiles({ statusCallback(`${progressBytes}/${myTotalBytes}`) }, }) - } else if (type === 'VcfTabixAdapter' || type === 'VcfAdapter') { + } else if (type === 'VcfAdapter') { + yield* indexVcf({ + config: track, + attributesToIndex, + inLocation: getLoc('vcfLocation', track), + outDir, + onStart: totalBytes => { + myTotalBytes = totalBytes + }, + onUpdate: progressBytes => { + statusCallback(`${progressBytes}/${myTotalBytes}`) + }, + }) + } else if (type === 'VcfTabixAdapter') { yield* indexVcf({ config: track, attributesToIndex, @@ -252,7 +280,9 @@ function getLoc(attr: string, config: Track) { | { uri: string; localPath: string } | undefined if (!elt) { - throw new Error('none') + throw new Error( + `can't get find ${attr} from ${config.adapter} for text indexing`, + ) } return elt.uri || elt.localPath } diff --git a/products/jbrowse-desktop/src/indexJobsModel.ts b/products/jbrowse-desktop/src/indexJobsModel.ts index eb3c7b0f0c..02196dd7a5 100644 --- a/products/jbrowse-desktop/src/indexJobsModel.ts +++ b/products/jbrowse-desktop/src/indexJobsModel.ts @@ -313,6 +313,7 @@ export default function jobsModelFactory(_pluginManager: PluginManager) { } } } catch (e) { + console.error(e) if (isAbortException(e)) { self.session?.notify('Cancelled job', 'info') } else {