@jbrowse/plugin-bed 5.0.0-beta.1 → 5.0.0-beta.11

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.
Files changed (45) hide show
  1. package/esm/BedAdapter/BedAdapter.d.ts +1 -3
  2. package/esm/BedAdapter/BedAdapter.js +3 -10
  3. package/esm/BedAdapter/configSchema.d.ts +30 -52
  4. package/esm/BedAdapter/configSchema.js +2 -4
  5. package/esm/BedGraphAdapter/BedGraphAdapter.d.ts +1 -3
  6. package/esm/BedGraphAdapter/BedGraphAdapter.js +8 -10
  7. package/esm/BedGraphAdapter/configSchema.d.ts +15 -17
  8. package/esm/BedGraphAdapter/configSchema.js +5 -10
  9. package/esm/BedGraphTabixAdapter/BedGraphTabixAdapter.js +11 -8
  10. package/esm/BedGraphTabixAdapter/configSchema.d.ts +25 -30
  11. package/esm/BedGraphTabixAdapter/configSchema.js +11 -3
  12. package/esm/BedTabixAdapter/BedTabixAdapter.js +11 -12
  13. package/esm/BedTabixAdapter/configSchema.d.ts +33 -46
  14. package/esm/BedTabixAdapter/configSchema.js +9 -2
  15. package/esm/BedpeAdapter/BedpeAdapter.d.ts +3 -4
  16. package/esm/BedpeAdapter/BedpeAdapter.js +3 -10
  17. package/esm/BedpeAdapter/configSchema.d.ts +12 -16
  18. package/esm/BedpeAdapter/configSchema.js +2 -11
  19. package/esm/BedpeAdapter/util.js +3 -2
  20. package/esm/BigBedAdapter/BigBedAdapter.js +4 -5
  21. package/esm/BigBedAdapter/configSchema.d.ts +21 -29
  22. package/esm/BigBedAdapter/configSchema.js +4 -10
  23. package/esm/BigBedTextSearchAdapter/BigBedTextSearchAdapter.d.ts +27 -0
  24. package/esm/BigBedTextSearchAdapter/BigBedTextSearchAdapter.js +128 -0
  25. package/esm/BigBedTextSearchAdapter/configSchema.d.ts +51 -0
  26. package/esm/BigBedTextSearchAdapter/configSchema.js +57 -0
  27. package/esm/BigBedTextSearchAdapter/index.d.ts +2 -0
  28. package/esm/BigBedTextSearchAdapter/index.js +11 -0
  29. package/esm/StarFusionAdapter/StarFusionAdapter.d.ts +2 -3
  30. package/esm/StarFusionAdapter/StarFusionAdapter.js +16 -71
  31. package/esm/StarFusionAdapter/configSchema.d.ts +9 -10
  32. package/esm/StarFusionAdapter/configSchema.js +2 -11
  33. package/esm/adapterUtil.d.ts +1 -1
  34. package/esm/adapterUtil.js +20 -5
  35. package/esm/bedGraphUtil.d.ts +2 -1
  36. package/esm/bedGraphUtil.js +5 -3
  37. package/esm/copyExcept.d.ts +1 -0
  38. package/esm/copyExcept.js +11 -0
  39. package/esm/generateBedMethylFeature.js +12 -7
  40. package/esm/generateRepeatMaskerFeature.d.ts +17 -4
  41. package/esm/generateRepeatMaskerFeature.js +29 -26
  42. package/esm/generateUcscTranscript.js +51 -4
  43. package/esm/index.js +2 -0
  44. package/esm/util.js +25 -14
  45. package/package.json +12 -7
@@ -1,5 +1,4 @@
1
1
  import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import { IntervalTree } from '@jbrowse/core/util';
3
2
  import type { BedAdapterConfig } from './configSchema.ts';
4
3
  import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
5
4
  import type { Feature, Region } from '@jbrowse/core/util';
@@ -9,13 +8,12 @@ export default class BedAdapter extends BaseFeatureDataAdapter<BedAdapterConfig>
9
8
  features: Record<string, string[]>;
10
9
  }>;
11
10
  private getParser;
12
- protected intervalTrees: Record<string, Promise<IntervalTree<Feature> | undefined> | undefined>;
13
11
  static capabilities: string[];
14
12
  private loadDataP;
15
13
  getRefNames(opts?: BaseOptions): Promise<string[]>;
16
14
  getHeader(opts?: BaseOptions): Promise<string>;
17
15
  getNames(): Promise<string[] | undefined>;
18
16
  private loadFeatureIntervalTreeHelper;
19
- loadFeatureIntervalTree(refName: string): Promise<IntervalTree<Feature> | undefined>;
17
+ private treeFeatures;
20
18
  getFeatures(query: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
21
19
  }
@@ -14,7 +14,6 @@ export default class BedAdapter extends BaseFeatureDataAdapter {
14
14
  columnNames: await this.getNames(),
15
15
  }),
16
16
  });
17
- intervalTrees = {};
18
17
  static capabilities = ['getFeatures', 'getRefNames'];
19
18
  async loadDataP(opts) {
20
19
  const buffer = await fetchAndMaybeUnzip(openLocation(this.getConf('bedLocation'), this.pluginManager), opts);
@@ -60,14 +59,8 @@ export default class BedAdapter extends BaseFeatureDataAdapter {
60
59
  }
61
60
  return intervalTree;
62
61
  }
63
- async loadFeatureIntervalTree(refName) {
64
- this.intervalTrees[refName] ??= this.loadFeatureIntervalTreeHelper(refName).catch((e) => {
65
- this.intervalTrees[refName] = undefined;
66
- throw e;
67
- });
68
- return this.intervalTrees[refName];
69
- }
70
- getFeatures(query, opts = {}) {
71
- return intervalTreeFeatures(query, opts, refName => this.loadFeatureIntervalTree(refName));
62
+ treeFeatures = intervalTreeFeatures(opts => this.loadData(opts), refName => this.loadFeatureIntervalTreeHelper(refName));
63
+ getFeatures(query, opts) {
64
+ return this.treeFeatures(query, opts);
72
65
  }
73
66
  }
@@ -23,73 +23,51 @@ export declare function normalizeSnapshot(snap: Record<string, unknown>): Record
23
23
  * ```
24
24
  */
25
25
  declare const BedAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
26
- /**
27
- * #slot
28
- */
26
+ type: {
27
+ type: "string";
28
+ } & {
29
+ defaultValue: string;
30
+ };
29
31
  readonly bedLocation: {
30
- readonly type: "fileLocation";
31
- readonly description: "path to bed file, also allows gzipped bed";
32
- readonly defaultValue: {
33
- readonly uri: "/path/to/my.bed.gz";
34
- readonly locationType: "UriLocation";
35
- };
32
+ type: "fileLocation";
33
+ } & {
34
+ defaultValue: unknown;
36
35
  };
37
- /**
38
- * #slot
39
- */
40
36
  readonly columnNames: {
41
- readonly type: "stringArray";
42
- readonly description: "List of column names. A column named like a standard BED column is parsed as that column's type (chromStart numeric, blockSizes a numeric list); any other column is text";
43
- readonly defaultValue: readonly [];
37
+ type: "stringArray";
38
+ } & {
39
+ defaultValue: unknown;
44
40
  };
45
- /**
46
- * #slot
47
- */
48
41
  readonly scoreColumn: {
49
- readonly type: "string";
50
- readonly description: "The column to use as a \"score\" attribute";
51
- readonly defaultValue: "";
42
+ type: "string";
43
+ } & {
44
+ defaultValue: string;
52
45
  };
53
- /**
54
- * #slot
55
- */
56
46
  readonly autoSql: {
57
- readonly type: "string";
58
- readonly description: "The autoSql definition for the data fields in the file";
59
- readonly defaultValue: "";
47
+ type: "string";
48
+ } & {
49
+ defaultValue: string;
60
50
  };
61
- /**
62
- * #slot
63
- */
64
51
  readonly colRef: {
65
- readonly type: "number";
66
- readonly description: "The column to use as a \"refName\" attribute";
67
- readonly defaultValue: 0;
52
+ type: "number";
53
+ } & {
54
+ defaultValue: number;
68
55
  };
69
- /**
70
- * #slot
71
- */
72
56
  readonly colStart: {
73
- readonly type: "number";
74
- readonly description: "The column to use as a \"start\" attribute";
75
- readonly defaultValue: 1;
57
+ type: "number";
58
+ } & {
59
+ defaultValue: number;
76
60
  };
77
- /**
78
- * #slot
79
- */
80
61
  readonly colEnd: {
81
- readonly type: "number";
82
- readonly description: "The column to use as a \"end\" attribute";
83
- readonly defaultValue: 2;
62
+ type: "number";
63
+ } & {
64
+ defaultValue: number;
84
65
  };
85
- /**
86
- * #slot
87
- */
88
66
  readonly disableGeneHeuristic: {
89
- readonly type: "boolean";
90
- readonly description: "Disable the heuristic that auto-detects BED12 features as gene/transcript structures. Useful for files that have BED12-like structure but are not genes (e.g. tandem duplications)";
91
- readonly defaultValue: false;
67
+ type: "boolean";
68
+ } & {
69
+ defaultValue: boolean;
92
70
  };
93
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
71
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
94
72
  export type BedAdapterConfig = Instance<typeof BedAdapter>;
95
73
  export default BedAdapter;
@@ -1,8 +1,6 @@
1
- import { ConfigurationSchema } from '@jbrowse/core/configuration';
1
+ import { ConfigurationSchema, expandUriShorthand, } from '@jbrowse/core/configuration';
2
2
  export function normalizeSnapshot(snap) {
3
- return snap.uri
4
- ? { ...snap, bedLocation: { uri: snap.uri, baseUri: snap.baseUri } }
5
- : snap;
3
+ return expandUriShorthand(snap, 'bedLocation');
6
4
  }
7
5
  /**
8
6
  * #config BedAdapter
@@ -1,5 +1,4 @@
1
1
  import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import { IntervalTree } from '@jbrowse/core/util';
3
2
  import type { BedGraphAdapterConfig } from './configSchema.ts';
4
3
  import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
5
4
  import type { Feature, Region } from '@jbrowse/core/util';
@@ -8,11 +7,10 @@ export default class BedGraphAdapter extends BaseFeatureDataAdapter<BedGraphAdap
8
7
  header: string;
9
8
  features: Record<string, string[]>;
10
9
  }>;
11
- protected intervalTrees: Record<string, Promise<IntervalTree<Feature> | undefined> | undefined>;
12
10
  getNames(): Promise<string[] | undefined>;
13
11
  private loadFeatureIntervalTreeHelper;
14
12
  getRefNames(opts?: BaseOptions): Promise<string[]>;
15
13
  private loadDataP;
16
- loadFeatureIntervalTree(refName: string): Promise<IntervalTree<Feature> | undefined>;
14
+ private treeFeatures;
17
15
  getFeatures(query: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
18
16
  }
@@ -7,7 +7,6 @@ import { bucketBedLines, resolveColumnNames } from '../util.js';
7
7
  export default class BedGraphAdapter extends BaseFeatureDataAdapter {
8
8
  // No `label`: `fetchAndMaybeUnzip` narrates the download from inside.
9
9
  loadData = cachedSetup({ setup: opts => this.loadDataP(opts) });
10
- intervalTrees = {};
11
10
  async getNames() {
12
11
  return resolveColumnNames(this.getConf('columnNames'), async () => (await this.loadData()).header);
13
12
  }
@@ -18,12 +17,16 @@ export default class BedGraphAdapter extends BaseFeatureDataAdapter {
18
17
  return undefined;
19
18
  }
20
19
  const names = (await this.getNames())?.slice(3) ?? [];
20
+ const sourceColumn = names.indexOf('source');
21
21
  const intervalTree = new IntervalTree();
22
22
  for (let i = 0, l = lines.length; i < l; i++) {
23
23
  const [refName, s, e, ...rest] = lines[i].split('\t');
24
24
  const start = +s;
25
25
  const end = +e;
26
26
  for (let j = 0, l2 = rest.length; j < l2; j++) {
27
+ if (j === sourceColumn) {
28
+ continue;
29
+ }
27
30
  const feat = makeBedGraphFeature({
28
31
  uniqueId: `${this.id}-${refName}-${i}-${j}`,
29
32
  refName: refName,
@@ -32,6 +35,7 @@ export default class BedGraphAdapter extends BaseFeatureDataAdapter {
32
35
  names,
33
36
  j,
34
37
  value: rest[j],
38
+ rowSource: rest[sourceColumn],
35
39
  });
36
40
  if (feat) {
37
41
  intervalTree.insert([start, end], feat);
@@ -48,14 +52,8 @@ export default class BedGraphAdapter extends BaseFeatureDataAdapter {
48
52
  const buffer = await fetchAndMaybeUnzip(openLocation(this.getConf('bedGraphLocation'), this.pluginManager), opts);
49
53
  return bucketBedLines(buffer, opts.statusCallback);
50
54
  }
51
- async loadFeatureIntervalTree(refName) {
52
- this.intervalTrees[refName] ??= this.loadFeatureIntervalTreeHelper(refName).catch((e) => {
53
- this.intervalTrees[refName] = undefined;
54
- throw e;
55
- });
56
- return this.intervalTrees[refName];
57
- }
58
- getFeatures(query, opts = {}) {
59
- return intervalTreeFeatures(query, opts, refName => this.loadFeatureIntervalTree(refName));
55
+ treeFeatures = intervalTreeFeatures(opts => this.loadData(opts), refName => this.loadFeatureIntervalTreeHelper(refName));
56
+ getFeatures(query, opts) {
57
+ return this.treeFeatures(query, opts);
60
58
  }
61
59
  }
@@ -6,6 +6,9 @@ export declare function normalizeSnapshot(snap: Record<string, unknown>): Record
6
6
  * #fileFormat quantitative | BedGraph (plain) | Loaded entirely into memory; for small files
7
7
  * used to load plain-text bedGraph signal files. Loads the whole file into
8
8
  * memory, so prefer the BedGraphTabixAdapter for large files.
9
+ * Several signals in one file are a `MultiQuantitativeTrack`'s subtracks:
10
+ * one value column each, named by the header, or a `source` column naming each
11
+ * row's, which is the form Save track data writes.
9
12
  *
10
13
  * #example
11
14
  * ```js
@@ -16,26 +19,21 @@ export declare function normalizeSnapshot(snap: Record<string, unknown>): Record
16
19
  * ```
17
20
  */
18
21
  declare const BedGraphAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
19
- /**
20
- * #slot
21
- * location of the plain-text bedGraph (`chrom start end value`, one line
22
- * per interval). May be gzipped.
23
- */
22
+ type: {
23
+ type: "string";
24
+ } & {
25
+ defaultValue: string;
26
+ };
24
27
  readonly bedGraphLocation: {
25
- readonly type: "fileLocation";
26
- readonly defaultValue: {
27
- readonly uri: "/path/to/my.bedgraph";
28
- readonly locationType: "UriLocation";
29
- };
28
+ type: "fileLocation";
29
+ } & {
30
+ defaultValue: unknown;
30
31
  };
31
- /**
32
- * #slot
33
- */
34
32
  readonly columnNames: {
35
- readonly type: "stringArray";
36
- readonly description: "List of column names";
37
- readonly defaultValue: readonly [];
33
+ type: "stringArray";
34
+ } & {
35
+ defaultValue: unknown;
38
36
  };
39
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
37
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
40
38
  export type BedGraphAdapterConfig = Instance<typeof BedGraphAdapter>;
41
39
  export default BedGraphAdapter;
@@ -1,14 +1,6 @@
1
- import { ConfigurationSchema } from '@jbrowse/core/configuration';
1
+ import { ConfigurationSchema, expandUriShorthand, } from '@jbrowse/core/configuration';
2
2
  export function normalizeSnapshot(snap) {
3
- return snap.uri
4
- ? {
5
- ...snap,
6
- bedGraphLocation: {
7
- uri: snap.uri,
8
- baseUri: snap.baseUri,
9
- },
10
- }
11
- : snap;
3
+ return expandUriShorthand(snap, 'bedGraphLocation');
12
4
  }
13
5
  /**
14
6
  * #config BedGraphAdapter
@@ -16,6 +8,9 @@ export function normalizeSnapshot(snap) {
16
8
  * #fileFormat quantitative | BedGraph (plain) | Loaded entirely into memory; for small files
17
9
  * used to load plain-text bedGraph signal files. Loads the whole file into
18
10
  * memory, so prefer the BedGraphTabixAdapter for large files.
11
+ * Several signals in one file are a `MultiQuantitativeTrack`'s subtracks:
12
+ * one value column each, named by the header, or a `source` column naming each
13
+ * row's, which is the form Save track data writes.
19
14
  *
20
15
  * #example
21
16
  * ```js
@@ -5,7 +5,6 @@ import { sharedBgzfWorkerPool } from '@jbrowse/core/util/bgzfWorkerPool';
5
5
  import { decompressedBytesBudget } from '@jbrowse/core/util/cacheBudgets';
6
6
  import { openLocation, openTabixIndexFilehandle } from '@jbrowse/core/util/io';
7
7
  import { ObservableCreate } from '@jbrowse/core/util/rxjs';
8
- import { withStopTokenSignal } from '@jbrowse/core/util/stopToken';
9
8
  import { readTabixHeaderLines } from '@jbrowse/core/util/tabix';
10
9
  import { makeBedGraphFeature } from '../bedGraphUtil.js';
11
10
  import { parseNamesFromHeader } from '../util.js';
@@ -15,9 +14,9 @@ export default class BedGraphTabixAdapter extends BaseFeatureDataAdapter {
15
14
  // getFeatures/byte-estimate awaits it) doesn't re-flash "Downloading index"
16
15
  configure = cachedSetup({
17
16
  label: 'Downloading index',
18
- setup: () => this.configurePre(),
17
+ setup: opts => this.configurePre(opts),
19
18
  });
20
- async configurePre() {
19
+ async configurePre(opts) {
21
20
  const pm = this.pluginManager;
22
21
  const bedGraphGzLocation = this.getConf('bedGraphGzLocation');
23
22
  const location = this.getConf(['index', 'location']);
@@ -32,7 +31,7 @@ export default class BedGraphTabixAdapter extends BaseFeatureDataAdapter {
32
31
  // Not bedGraph.getHeader(): that returns only a `#`-commented header, so a
33
32
  // file whose header is a plain row skipped via `tabix -S 1` reported none
34
33
  // and quietly lost the names of its value columns.
35
- const header = (await readTabixHeaderLines(bedGraph)).join('\n');
34
+ const header = (await readTabixHeaderLines(bedGraph, { signal: opts.signal })).join('\n');
36
35
  return {
37
36
  columnNames,
38
37
  bedGraph,
@@ -61,7 +60,8 @@ export default class BedGraphTabixAdapter extends BaseFeatureDataAdapter {
61
60
  const colEnd = columnNumbers.end - 1;
62
61
  const same = colStart === colEnd;
63
62
  const names = (await this.getNames())?.slice(same ? 2 : 3) ?? [];
64
- await withStopTokenSignal(opts.stopToken, signal => downloadStatus('Downloading features', opts.statusCallback, onProgress =>
63
+ const sourceColumn = names.indexOf('source');
64
+ await downloadStatus('Downloading features', opts.statusCallback, onProgress =>
65
65
  // `same` is a single-coordinate file — a GWAS-style txt with only a
66
66
  // start column, indexed `-b N -e N`. The widening is not slop: the
67
67
  // column value is used below as an interbase start (point p is
@@ -85,6 +85,9 @@ export default class BedGraphTabixAdapter extends BaseFeatureDataAdapter {
85
85
  throw new Error(`start/end NaN on line "${line}", with colStart:${colStart} and colEnd:${colEnd}. run "tabix -p bed" to ensure bed preset`);
86
86
  }
87
87
  for (let j = 0; j < rest.length; j++) {
88
+ if (j === sourceColumn) {
89
+ continue;
90
+ }
88
91
  const feat = makeBedGraphFeature({
89
92
  uniqueId: `${this.id}-${fileOffset}-${j}`,
90
93
  refName,
@@ -93,6 +96,7 @@ export default class BedGraphTabixAdapter extends BaseFeatureDataAdapter {
93
96
  names,
94
97
  j,
95
98
  value: rest[j],
99
+ rowSource: rest[sourceColumn],
96
100
  });
97
101
  if (feat) {
98
102
  observer.next(feat);
@@ -101,9 +105,8 @@ export default class BedGraphTabixAdapter extends BaseFeatureDataAdapter {
101
105
  },
102
106
  ...opts,
103
107
  onProgress,
104
- signal,
105
- })));
108
+ }));
106
109
  observer.complete();
107
- }, opts.stopToken);
110
+ }, opts.signal);
108
111
  }
109
112
  }
@@ -4,7 +4,10 @@ export declare function normalizeSnapshot(snap: Record<string, unknown>): Record
4
4
  * #config BedGraphTabixAdapter
5
5
  * #trackType QuantitativeTrack
6
6
  * #fileFormat quantitative | BedGraph (tabix)
7
- * used to load bgzip-compressed, tabix-indexed bedGraph signal files
7
+ * used to load bgzip-compressed, tabix-indexed bedGraph signal files.
8
+ * Several signals in one file are a `MultiQuantitativeTrack`'s subtracks:
9
+ * one value column each, named by the header, or a `source` column naming each
10
+ * row's, which is the form Save track data writes.
8
11
  *
9
12
  * #example
10
13
  * The `uri` shorthand auto-resolves the `.tbi` index:
@@ -16,43 +19,35 @@ export declare function normalizeSnapshot(snap: Record<string, unknown>): Record
16
19
  * ```
17
20
  */
18
21
  declare const BedGraphTabixAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
19
- /**
20
- * #slot
21
- * location of the bgzip-compressed bedGraph (`chrom start end value`,
22
- * sorted by position). Must be bgzip rather than plain gzip, which tabix
23
- * cannot index.
24
- */
22
+ type: {
23
+ type: "string";
24
+ } & {
25
+ defaultValue: string;
26
+ };
25
27
  readonly bedGraphGzLocation: {
26
- readonly type: "fileLocation";
27
- readonly defaultValue: {
28
- readonly uri: "/path/to/my.bedgraph";
29
- readonly locationType: "UriLocation";
30
- };
28
+ type: "fileLocation";
29
+ } & {
30
+ defaultValue: unknown;
31
31
  };
32
32
  readonly index: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
33
33
  readonly indexType: {
34
- readonly model: import("@jbrowse/mobx-state-tree").ISimpleType<"CSI" | "TBI">;
35
- readonly type: 'stringEnum';
36
- readonly defaultValue: 'TBI';
37
- readonly description: '`TBI` is the usual `tabix` output. `CSI` is required for a reference longer than 512 Mb, which TBI cannot address.';
34
+ type: "stringEnum";
35
+ } & {
36
+ model: import("@jbrowse/mobx-state-tree").ISimpleType<"CSI" | "TBI">;
37
+ } & {
38
+ defaultValue: string;
38
39
  };
39
40
  readonly location: {
40
- readonly type: 'fileLocation';
41
- readonly defaultValue: {
42
- readonly uri: '/path/to/my.gz.tbi';
43
- readonly locationType: 'UriLocation';
44
- };
45
- readonly description: 'location of the tabix index. Only needed when it is not named `<file>.tbi` (or `.csi`), which is what the `uri` shorthand assumes.';
41
+ type: "fileLocation";
42
+ } & {
43
+ defaultValue: unknown;
46
44
  };
47
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
48
- /**
49
- * #slot
50
- */
45
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
51
46
  readonly columnNames: {
52
- readonly type: "stringArray";
53
- readonly description: "List of column names";
54
- readonly defaultValue: readonly [];
47
+ type: "stringArray";
48
+ } & {
49
+ defaultValue: unknown;
55
50
  };
56
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
51
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
57
52
  export type BedGraphTabixAdapterConfig = Instance<typeof BedGraphTabixAdapter>;
58
53
  export default BedGraphTabixAdapter;
@@ -1,4 +1,4 @@
1
- import { ConfigurationSchema, expandTabixShorthand, tabixIndexFields, } from '@jbrowse/core/configuration';
1
+ import { ConfigurationSchema, expandTabixShorthand, tabixIndexSchema, } from '@jbrowse/core/configuration';
2
2
  export function normalizeSnapshot(snap) {
3
3
  return expandTabixShorthand(snap, 'bedGraphGzLocation');
4
4
  }
@@ -6,7 +6,10 @@ export function normalizeSnapshot(snap) {
6
6
  * #config BedGraphTabixAdapter
7
7
  * #trackType QuantitativeTrack
8
8
  * #fileFormat quantitative | BedGraph (tabix)
9
- * used to load bgzip-compressed, tabix-indexed bedGraph signal files
9
+ * used to load bgzip-compressed, tabix-indexed bedGraph signal files.
10
+ * Several signals in one file are a `MultiQuantitativeTrack`'s subtracks:
11
+ * one value column each, named by the header, or a `source` column naming each
12
+ * row's, which is the form Save track data writes.
10
13
  *
11
14
  * #example
12
15
  * The `uri` shorthand auto-resolves the `.tbi` index:
@@ -31,7 +34,12 @@ const BedGraphTabixAdapter = ConfigurationSchema('BedGraphTabixAdapter', {
31
34
  locationType: 'UriLocation',
32
35
  },
33
36
  },
34
- index: ConfigurationSchema('TabixIndex', { ...tabixIndexFields }),
37
+ /**
38
+ * #slot
39
+ * where the tabix index is and which kind it is. The `uri` shorthand derives
40
+ * both, so a config using it states neither.
41
+ */
42
+ index: tabixIndexSchema(),
35
43
  /**
36
44
  * #slot
37
45
  */
@@ -2,11 +2,11 @@ import { TabixIndexedFile } from '@gmod/tabix';
2
2
  import { readConfObject } from '@jbrowse/core/configuration';
3
3
  import { BaseFeatureDataAdapter, cachedSetup, } from '@jbrowse/core/data_adapters/BaseAdapter';
4
4
  import { SimpleFeature, downloadStatus } from '@jbrowse/core/util';
5
+ import { checkAbortSignal } from '@jbrowse/core/util/aborting';
5
6
  import { sharedBgzfWorkerPool } from '@jbrowse/core/util/bgzfWorkerPool';
6
7
  import { decompressedBytesBudget } from '@jbrowse/core/util/cacheBudgets';
7
8
  import { openLocation, openTabixIndexFilehandle } from '@jbrowse/core/util/io';
8
9
  import { ObservableCreate } from '@jbrowse/core/util/rxjs';
9
- import { checkStopTokenThrottled, checkStopToken, createStopTokenChecker, withStopTokenSignal, } from '@jbrowse/core/util/stopToken';
10
10
  import { readTabixHeaderLines } from '@jbrowse/core/util/tabix';
11
11
  import { featureData, makeParser, parseNamesFromHeader } from '../util.js';
12
12
  export default class BedTabixAdapter extends BaseFeatureDataAdapter {
@@ -26,14 +26,14 @@ export default class BedTabixAdapter extends BaseFeatureDataAdapter {
26
26
  // re-entry (every getFeatures awaits it) doesn't re-flash "Downloading index"
27
27
  getMetadata = cachedSetup({
28
28
  label: 'Downloading index',
29
- setup: () => this.bed.getMetadata(),
29
+ setup: opts => this.bed.getMetadata({ signal: opts.signal }),
30
30
  });
31
31
  // Memoized: getFeatures needs the names on every query, and reading them goes
32
32
  // to the file's leading blocks — a fetch and a decompress that was being
33
33
  // repeated on every pan and zoom. Resolves undefined when the file declares
34
34
  // no column names — parseNamesFromHeader's answer for a header it can't read
35
35
  // names out of.
36
- getNames = cachedSetup({ setup: () => this.readNames() });
36
+ getNames = cachedSetup({ setup: opts => this.readNames(opts.signal) });
37
37
  constructor(config, getSubAdapter, pluginManager) {
38
38
  super(config, getSubAdapter, pluginManager);
39
39
  this.bedGzLoc = readConfObject(this.config, 'bedGzLocation');
@@ -61,7 +61,7 @@ export default class BedTabixAdapter extends BaseFeatureDataAdapter {
61
61
  async getRegionByteSize(regions, opts) {
62
62
  return this.bed.bytesForRegions(regions, opts);
63
63
  }
64
- async readNames() {
64
+ async readNames(signal) {
65
65
  const columnNames = readConfObject(this.config, 'columnNames');
66
66
  if (columnNames.length) {
67
67
  return columnNames;
@@ -69,10 +69,10 @@ export default class BedTabixAdapter extends BaseFeatureDataAdapter {
69
69
  // readTabixHeaderLines covers both ways a tabix file keeps a header: a
70
70
  // `#`-commented block, which getHeader() returns, and a plain row skipped
71
71
  // via `tabix -S N`, which it does not.
72
- return parseNamesFromHeader((await readTabixHeaderLines(this.bed)).join('\n'));
72
+ return parseNamesFromHeader((await readTabixHeaderLines(this.bed, { signal })).join('\n'));
73
73
  }
74
74
  getFeatures(query, opts) {
75
- const { stopToken, statusCallback } = opts ?? {};
75
+ const { signal, statusCallback } = opts ?? {};
76
76
  return ObservableCreate(async (observer) => {
77
77
  // warms the index under its own status label — getLines would otherwise
78
78
  // download it under "Downloading features"
@@ -81,9 +81,8 @@ export default class BedTabixAdapter extends BaseFeatureDataAdapter {
81
81
  const parser = await this.getParser();
82
82
  const scoreColumn = readConfObject(this.config, 'scoreColumn');
83
83
  const disableGeneHeuristic = readConfObject(this.config, 'disableGeneHeuristic');
84
- const stopTokenCheck = createStopTokenChecker(stopToken);
85
- checkStopToken(stopToken);
86
- await withStopTokenSignal(stopToken, signal => downloadStatus('Downloading features', statusCallback, onProgress =>
84
+ checkAbortSignal(signal);
85
+ await downloadStatus('Downloading features', statusCallback, onProgress =>
87
86
  // start/end come from @gmod/tabix rather than being re-derived from
88
87
  // the line: it located the coordinate columns to find these lines at
89
88
  // all, and already applied the index's coordinate offset (-1 for a
@@ -92,7 +91,7 @@ export default class BedTabixAdapter extends BaseFeatureDataAdapter {
92
91
  // — getLines only calls back for lines whose ref column matches it.
93
92
  this.bed.getLines(query.refName, query.start, query.end, {
94
93
  lineCallback: (line, fileOffset, start, end) => {
95
- checkStopTokenThrottled(stopTokenCheck);
94
+ checkAbortSignal(signal);
96
95
  const splitLine = line.split('\t');
97
96
  observer.next(new SimpleFeature(featureData({
98
97
  splitLine,
@@ -108,8 +107,8 @@ export default class BedTabixAdapter extends BaseFeatureDataAdapter {
108
107
  },
109
108
  onProgress,
110
109
  signal,
111
- })));
110
+ }));
112
111
  observer.complete();
113
- }, stopToken);
112
+ }, signal);
114
113
  }
115
114
  }