@jbrowse/plugin-bed 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.
Files changed (81) hide show
  1. package/dist/BedAdapter/BedAdapter.d.ts +15 -5
  2. package/dist/BedAdapter/BedAdapter.js +7 -10
  3. package/dist/BedAdapter/configSchema.d.ts +0 -21
  4. package/dist/BedAdapter/configSchema.js +1 -25
  5. package/dist/BedAdapter/index.d.ts +1 -1
  6. package/dist/BedGraphAdapter/BedGraphAdapter.d.ts +24 -0
  7. package/dist/BedGraphAdapter/BedGraphAdapter.js +130 -0
  8. package/dist/BedGraphAdapter/configSchema.d.ts +15 -0
  9. package/dist/BedGraphAdapter/configSchema.js +19 -0
  10. package/dist/BedGraphAdapter/index.d.ts +2 -0
  11. package/dist/BedGraphAdapter/index.js +39 -0
  12. package/dist/BedGraphTabixAdapter/BedGraphTabixAdapter.d.ts +18 -0
  13. package/dist/BedGraphTabixAdapter/BedGraphTabixAdapter.js +105 -0
  14. package/dist/BedGraphTabixAdapter/configSchema.d.ts +29 -0
  15. package/dist/BedGraphTabixAdapter/configSchema.js +34 -0
  16. package/dist/BedGraphTabixAdapter/index.d.ts +2 -0
  17. package/dist/BedGraphTabixAdapter/index.js +39 -0
  18. package/dist/BedTabixAdapter/BedTabixAdapter.d.ts +6 -5
  19. package/dist/BedTabixAdapter/BedTabixAdapter.js +12 -5
  20. package/dist/BedTabixAdapter/configSchema.d.ts +0 -18
  21. package/dist/BedTabixAdapter/configSchema.js +1 -22
  22. package/dist/BedTabixAdapter/index.d.ts +1 -1
  23. package/dist/BedpeAdapter/BedpeAdapter.d.ts +4 -2
  24. package/dist/BedpeAdapter/BedpeAdapter.js +4 -5
  25. package/dist/BedpeAdapter/configSchema.d.ts +0 -7
  26. package/dist/BedpeAdapter/configSchema.js +1 -12
  27. package/dist/BedpeAdapter/index.d.ts +1 -1
  28. package/dist/BigBedAdapter/BigBedAdapter.d.ts +5 -4
  29. package/dist/BigBedAdapter/BigBedAdapter.js +13 -8
  30. package/dist/BigBedAdapter/configSchema.d.ts +0 -9
  31. package/dist/BigBedAdapter/configSchema.js +1 -13
  32. package/dist/BigBedAdapter/index.d.ts +1 -1
  33. package/dist/generateBedMethylFeature.d.ts +3 -3
  34. package/dist/generateBedMethylFeature.js +3 -5
  35. package/dist/generateUcscTranscript.d.ts +1 -1
  36. package/dist/generateUcscTranscript.js +0 -6
  37. package/dist/index.d.ts +1 -1
  38. package/dist/index.js +8 -4
  39. package/dist/util.d.ts +171 -6
  40. package/dist/util.js +65 -61
  41. package/esm/BedAdapter/BedAdapter.d.ts +15 -5
  42. package/esm/BedAdapter/BedAdapter.js +8 -11
  43. package/esm/BedAdapter/configSchema.d.ts +0 -21
  44. package/esm/BedAdapter/configSchema.js +1 -25
  45. package/esm/BedAdapter/index.d.ts +1 -1
  46. package/esm/BedGraphAdapter/BedGraphAdapter.d.ts +24 -0
  47. package/esm/BedGraphAdapter/BedGraphAdapter.js +124 -0
  48. package/esm/BedGraphAdapter/configSchema.d.ts +15 -0
  49. package/esm/BedGraphAdapter/configSchema.js +17 -0
  50. package/esm/BedGraphAdapter/index.d.ts +2 -0
  51. package/esm/BedGraphAdapter/index.js +10 -0
  52. package/esm/BedGraphTabixAdapter/BedGraphTabixAdapter.d.ts +18 -0
  53. package/esm/BedGraphTabixAdapter/BedGraphTabixAdapter.js +102 -0
  54. package/esm/BedGraphTabixAdapter/configSchema.d.ts +29 -0
  55. package/esm/BedGraphTabixAdapter/configSchema.js +32 -0
  56. package/esm/BedGraphTabixAdapter/index.d.ts +2 -0
  57. package/esm/BedGraphTabixAdapter/index.js +10 -0
  58. package/esm/BedTabixAdapter/BedTabixAdapter.d.ts +6 -5
  59. package/esm/BedTabixAdapter/BedTabixAdapter.js +13 -6
  60. package/esm/BedTabixAdapter/configSchema.d.ts +0 -18
  61. package/esm/BedTabixAdapter/configSchema.js +1 -22
  62. package/esm/BedTabixAdapter/index.d.ts +1 -1
  63. package/esm/BedpeAdapter/BedpeAdapter.d.ts +4 -2
  64. package/esm/BedpeAdapter/BedpeAdapter.js +5 -6
  65. package/esm/BedpeAdapter/configSchema.d.ts +0 -7
  66. package/esm/BedpeAdapter/configSchema.js +1 -12
  67. package/esm/BedpeAdapter/index.d.ts +1 -1
  68. package/esm/BigBedAdapter/BigBedAdapter.d.ts +5 -4
  69. package/esm/BigBedAdapter/BigBedAdapter.js +14 -9
  70. package/esm/BigBedAdapter/configSchema.d.ts +0 -9
  71. package/esm/BigBedAdapter/configSchema.js +1 -13
  72. package/esm/BigBedAdapter/index.d.ts +1 -1
  73. package/esm/generateBedMethylFeature.d.ts +3 -3
  74. package/esm/generateBedMethylFeature.js +3 -5
  75. package/esm/generateUcscTranscript.d.ts +1 -1
  76. package/esm/generateUcscTranscript.js +0 -6
  77. package/esm/index.d.ts +1 -1
  78. package/esm/index.js +8 -4
  79. package/esm/util.d.ts +171 -6
  80. package/esm/util.js +65 -61
  81. package/package.json +2 -2
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.default = BedGraphTabixAdapterF;
30
+ const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
31
+ const configSchema_1 = __importDefault(require("./configSchema"));
32
+ function BedGraphTabixAdapterF(pluginManager) {
33
+ pluginManager.addAdapterType(() => new AdapterType_1.default({
34
+ name: 'BedGraphTabixAdapter',
35
+ displayName: 'BedGraphTabix adapter',
36
+ configSchema: configSchema_1.default,
37
+ getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./BedGraphTabixAdapter'))).then(r => r.default),
38
+ }));
39
+ }
@@ -1,9 +1,10 @@
1
- import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import { Region, Feature } from '@jbrowse/core/util';
3
1
  import { TabixIndexedFile } from '@gmod/tabix';
4
- import PluginManager from '@jbrowse/core/PluginManager';
5
- import { AnyConfigurationModel } from '@jbrowse/core/configuration';
6
- import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
2
+ import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
3
+ import type PluginManager from '@jbrowse/core/PluginManager';
4
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
5
+ import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
6
+ import type { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
7
+ import type { Feature, Region } from '@jbrowse/core/util';
7
8
  export default class BedTabixAdapter extends BaseFeatureDataAdapter {
8
9
  private parser;
9
10
  protected bed: TabixIndexedFile;
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const bed_1 = __importDefault(require("@gmod/bed"));
7
+ const tabix_1 = require("@gmod/tabix");
7
8
  const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
9
+ const util_1 = require("@jbrowse/core/util");
8
10
  const io_1 = require("@jbrowse/core/util/io");
9
11
  const rxjs_1 = require("@jbrowse/core/util/rxjs");
10
- const util_1 = require("@jbrowse/core/util");
11
- const tabix_1 = require("@gmod/tabix");
12
- // locals
12
+ const stopToken_1 = require("@jbrowse/core/util/stopToken");
13
13
  const util_2 = require("../util");
14
14
  class BedTabixAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
15
15
  constructor(config, getSubAdapter, pluginManager) {
@@ -50,6 +50,7 @@ class BedTabixAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
50
50
  : undefined;
51
51
  }
52
52
  getFeatures(query, opts = {}) {
53
+ const { stopToken } = opts;
53
54
  return (0, rxjs_1.ObservableCreate)(async (observer) => {
54
55
  const meta = await this.bed.getMetadata();
55
56
  const { columnNumbers } = meta;
@@ -57,8 +58,14 @@ class BedTabixAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
57
58
  const colStart = columnNumbers.start - 1;
58
59
  const colEnd = columnNumbers.end - 1;
59
60
  const names = await this.getNames();
61
+ let start = performance.now();
62
+ (0, stopToken_1.checkStopToken)(stopToken);
60
63
  await this.bed.getLines(query.refName, query.start, query.end, {
61
64
  lineCallback: (line, fileOffset) => {
65
+ if (performance.now() - start > 200) {
66
+ (0, stopToken_1.checkStopToken)(stopToken);
67
+ start = performance.now();
68
+ }
62
69
  observer.next(new util_1.SimpleFeature((0, util_2.featureData)({
63
70
  line,
64
71
  colRef,
@@ -70,10 +77,10 @@ class BedTabixAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
70
77
  names,
71
78
  })));
72
79
  },
73
- signal: opts.signal,
80
+ stopToken: opts.stopToken,
74
81
  });
75
82
  observer.complete();
76
- }, opts.signal);
83
+ }, opts.stopToken);
77
84
  }
78
85
  freeResources() { }
79
86
  }
@@ -1,7 +1,4 @@
1
1
  declare const BedTabixAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- /**
3
- * #slot
4
- */
5
2
  bedGzLocation: {
6
3
  type: string;
7
4
  defaultValue: {
@@ -10,17 +7,11 @@ declare const BedTabixAdapter: import("@jbrowse/core/configuration/configuration
10
7
  };
11
8
  };
12
9
  index: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
13
- /**
14
- * #slot index.indexType
15
- */
16
10
  indexType: {
17
11
  model: import("mobx-state-tree").ISimpleType<string>;
18
12
  type: string;
19
13
  defaultValue: string;
20
14
  };
21
- /**
22
- * #slot index.location
23
- */
24
15
  location: {
25
16
  type: string;
26
17
  defaultValue: {
@@ -29,25 +20,16 @@ declare const BedTabixAdapter: import("@jbrowse/core/configuration/configuration
29
20
  };
30
21
  };
31
22
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
32
- /**
33
- * #slot
34
- */
35
23
  columnNames: {
36
24
  type: string;
37
25
  description: string;
38
26
  defaultValue: never[];
39
27
  };
40
- /**
41
- * #slot
42
- */
43
28
  scoreColumn: {
44
29
  type: string;
45
30
  description: string;
46
31
  defaultValue: string;
47
32
  };
48
- /**
49
- * #slot
50
- */
51
33
  autoSql: {
52
34
  type: string;
53
35
  description: string;
@@ -2,30 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const configuration_1 = require("@jbrowse/core/configuration");
4
4
  const mobx_state_tree_1 = require("mobx-state-tree");
5
- /**
6
- * #config BedTabixAdapter
7
- */
8
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ function x() { }
9
6
  const BedTabixAdapter = (0, configuration_1.ConfigurationSchema)('BedTabixAdapter', {
10
- /**
11
- * #slot
12
- */
13
7
  bedGzLocation: {
14
8
  type: 'fileLocation',
15
9
  defaultValue: { uri: '/path/to/my.bed.gz', locationType: 'UriLocation' },
16
10
  },
17
11
  index: (0, configuration_1.ConfigurationSchema)('TabixIndex', {
18
- /**
19
- * #slot index.indexType
20
- */
21
12
  indexType: {
22
13
  model: mobx_state_tree_1.types.enumeration('IndexType', ['TBI', 'CSI']),
23
14
  type: 'stringEnum',
24
15
  defaultValue: 'TBI',
25
16
  },
26
- /**
27
- * #slot index.location
28
- */
29
17
  location: {
30
18
  type: 'fileLocation',
31
19
  defaultValue: {
@@ -34,25 +22,16 @@ const BedTabixAdapter = (0, configuration_1.ConfigurationSchema)('BedTabixAdapte
34
22
  },
35
23
  },
36
24
  }),
37
- /**
38
- * #slot
39
- */
40
25
  columnNames: {
41
26
  type: 'stringArray',
42
27
  description: 'List of column names',
43
28
  defaultValue: [],
44
29
  },
45
- /**
46
- * #slot
47
- */
48
30
  scoreColumn: {
49
31
  type: 'string',
50
32
  description: 'The column to use as a "score" attribute',
51
33
  defaultValue: '',
52
34
  },
53
- /**
54
- * #slot
55
- */
56
35
  autoSql: {
57
36
  type: 'string',
58
37
  description: 'The autoSql definition for the data fields in the file',
@@ -1,2 +1,2 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function BedTabixAdapterF(pluginManager: PluginManager): void;
@@ -1,6 +1,8 @@
1
- import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import { Region, Feature, SimpleFeature } from '@jbrowse/core/util';
3
1
  import IntervalTree from '@flatten-js/interval-tree';
2
+ import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
3
+ import { SimpleFeature } from '@jbrowse/core/util';
4
+ import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
5
+ import type { Feature, Region } from '@jbrowse/core/util';
4
6
  export declare function featureData(line: string, uniqueId: string, flip: boolean, names?: string[]): SimpleFeature;
5
7
  export default class BedpeAdapter extends BaseFeatureDataAdapter {
6
8
  protected bedpeFeatures?: Promise<{
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.featureData = featureData;
7
+ const interval_tree_1 = __importDefault(require("@flatten-js/interval-tree"));
7
8
  const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
9
+ const util_1 = require("@jbrowse/core/util");
8
10
  const io_1 = require("@jbrowse/core/util/io");
9
11
  const rxjs_1 = require("@jbrowse/core/util/rxjs");
10
- const util_1 = require("@jbrowse/core/util");
11
- const interval_tree_1 = __importDefault(require("@flatten-js/interval-tree"));
12
12
  const svTypes = new Set(['DUP', 'TRA', 'INV', 'CNV', 'DEL']);
13
13
  function featureData(line, uniqueId, flip, names) {
14
14
  const l = line.split('\t');
@@ -43,7 +43,7 @@ function featureData(line, uniqueId, flip, names) {
43
43
  end: end2,
44
44
  strand: strand2,
45
45
  },
46
- ...(ALT ? { ALT: [ALT] } : {}), // ALT is an array in VCF
46
+ ...(ALT ? { ALT: [ALT] } : {}),
47
47
  });
48
48
  }
49
49
  function parseStrand(strand) {
@@ -68,7 +68,6 @@ class BedpeAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
68
68
  const bedLoc = this.getConf('bedpeLocation');
69
69
  const loc = (0, io_1.openLocation)(bedLoc, pm);
70
70
  const buffer = await (0, util_1.fetchAndMaybeUnzip)(loc, opts);
71
- // 512MB max chrome string length is 512MB
72
71
  if (buffer.length > 536870888) {
73
72
  throw new Error('Data exceeds maximum string length (512MB)');
74
73
  }
@@ -164,7 +163,7 @@ class BedpeAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
164
163
  observer.next(f);
165
164
  });
166
165
  observer.complete();
167
- }, opts.signal);
166
+ }, opts.stopToken);
168
167
  }
169
168
  freeResources() { }
170
169
  }
@@ -1,8 +1,4 @@
1
1
  declare const BedpeAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- /**
3
- * #slot
4
- * can be plaintext or gzipped, not indexed so loaded into memory on startup
5
- */
6
2
  bedpeLocation: {
7
3
  type: string;
8
4
  defaultValue: {
@@ -10,9 +6,6 @@ declare const BedpeAdapter: import("@jbrowse/core/configuration/configurationSch
10
6
  locationType: string;
11
7
  };
12
8
  };
13
- /**
14
- * #slot
15
- */
16
9
  columnNames: {
17
10
  type: string;
18
11
  description: string;
@@ -1,16 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const configuration_1 = require("@jbrowse/core/configuration");
4
- /**
5
- * #config BedpeAdapter
6
- * intended for SVs in a single assembly
7
- */
8
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ function x() { }
9
5
  const BedpeAdapter = (0, configuration_1.ConfigurationSchema)('BedpeAdapter', {
10
- /**
11
- * #slot
12
- * can be plaintext or gzipped, not indexed so loaded into memory on startup
13
- */
14
6
  bedpeLocation: {
15
7
  type: 'fileLocation',
16
8
  defaultValue: {
@@ -18,9 +10,6 @@ const BedpeAdapter = (0, configuration_1.ConfigurationSchema)('BedpeAdapter', {
18
10
  locationType: 'UriLocation',
19
11
  },
20
12
  },
21
- /**
22
- * #slot
23
- */
24
13
  columnNames: {
25
14
  type: 'stringArray',
26
15
  description: 'List of column names',
@@ -1,2 +1,2 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function BedpeAdapterF(pluginManager: PluginManager): void;
@@ -1,9 +1,10 @@
1
1
  import { BigBed } from '@gmod/bbi';
2
2
  import BED from '@gmod/bed';
3
- import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
4
- import { Region } from '@jbrowse/core/util/types';
5
- import { Feature } from '@jbrowse/core/util';
6
- import { Observer } from 'rxjs';
3
+ import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
4
+ import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
5
+ import type { Feature } from '@jbrowse/core/util';
6
+ import type { Region } from '@jbrowse/core/util/types';
7
+ import type { Observer } from 'rxjs';
7
8
  export default class BigBedAdapter extends BaseFeatureDataAdapter {
8
9
  private cachedP?;
9
10
  configurePre(opts?: BaseOptions): Promise<{
@@ -6,11 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const bbi_1 = require("@gmod/bbi");
7
7
  const bed_1 = __importDefault(require("@gmod/bed"));
8
8
  const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
9
+ const util_1 = require("@jbrowse/core/util");
9
10
  const io_1 = require("@jbrowse/core/util/io");
10
11
  const rxjs_1 = require("@jbrowse/core/util/rxjs");
11
- const util_1 = require("@jbrowse/core/util");
12
12
  const rxjs_2 = require("rxjs");
13
- // locals
14
13
  const util_2 = require("../util");
15
14
  class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
16
15
  async configurePre(opts) {
@@ -67,12 +66,13 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
67
66
  };
68
67
  }
69
68
  async getFeaturesHelper({ query, opts, observer, allowRedispatch, originalQuery = query, }) {
70
- const { signal } = opts;
69
+ var _a;
70
+ const { stopToken } = opts;
71
71
  const scoreColumn = this.getConf('scoreColumn');
72
72
  const aggregateField = this.getConf('aggregateField');
73
73
  const { parser, bigbed } = await this.configure(opts);
74
74
  const feats = await bigbed.getFeatures(query.refName, query.start, query.end, {
75
- signal,
75
+ stopToken,
76
76
  basesPerSpan: query.end - query.start,
77
77
  });
78
78
  if (allowRedispatch && feats.length) {
@@ -106,8 +106,13 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
106
106
  throw new Error('found uniqueId undefined');
107
107
  }
108
108
  for (const feat of feats) {
109
- const line = `${query.refName}\t${feat.start}\t${feat.end}\t${feat.rest}`;
110
- const data = parser.parseLine(line, { uniqueId: feat.uniqueId });
109
+ const splitLine = [
110
+ query.refName,
111
+ `${feat.start}`,
112
+ `${feat.end}`,
113
+ ...(((_a = feat.rest) === null || _a === void 0 ? void 0 : _a.split('\t')) || []),
114
+ ];
115
+ const data = parser.parseLine(splitLine, { uniqueId: feat.uniqueId });
111
116
  const aggr = data[aggregateField];
112
117
  if (!parentAggregation[aggr]) {
113
118
  parentAggregation[aggr] = [];
@@ -116,7 +121,7 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
116
121
  const f = (0, util_2.featureData2)({
117
122
  ...rest,
118
123
  scoreColumn,
119
- line,
124
+ splitLine,
120
125
  parser,
121
126
  uniqueId,
122
127
  start: feat.start,
@@ -169,7 +174,7 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
169
174
  catch (e) {
170
175
  observer.error(e);
171
176
  }
172
- }, opts.signal);
177
+ }, opts.stopToken);
173
178
  }
174
179
  freeResources() { }
175
180
  }
@@ -1,7 +1,4 @@
1
1
  declare const BigBedAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- /**
3
- * #slot
4
- */
5
2
  bigBedLocation: {
6
3
  type: string;
7
4
  defaultValue: {
@@ -9,17 +6,11 @@ declare const BigBedAdapter: import("@jbrowse/core/configuration/configurationSc
9
6
  locationType: string;
10
7
  };
11
8
  };
12
- /**
13
- * #slot
14
- */
15
9
  scoreColumn: {
16
10
  type: string;
17
11
  description: string;
18
12
  defaultValue: string;
19
13
  };
20
- /**
21
- * #slot
22
- */
23
14
  aggregateField: {
24
15
  type: string;
25
16
  description: string;
@@ -1,29 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const configuration_1 = require("@jbrowse/core/configuration");
4
- /**
5
- * #config BigBedAdapter
6
- */
7
- function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ function x() { }
8
5
  const BigBedAdapter = (0, configuration_1.ConfigurationSchema)('BigBedAdapter', {
9
- /**
10
- * #slot
11
- */
12
6
  bigBedLocation: {
13
7
  type: 'fileLocation',
14
8
  defaultValue: { uri: '/path/to/my.bb', locationType: 'UriLocation' },
15
9
  },
16
- /**
17
- * #slot
18
- */
19
10
  scoreColumn: {
20
11
  type: 'string',
21
12
  description: 'The column to use as a "score" attribute',
22
13
  defaultValue: '',
23
14
  },
24
- /**
25
- * #slot
26
- */
27
15
  aggregateField: {
28
16
  type: 'string',
29
17
  description: 'An attribute to aggregate features with',
@@ -1,2 +1,2 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function BigBedAdapterF(pluginManager: PluginManager): void;
@@ -3,8 +3,8 @@ export declare function isBedMethylFeature({ splitLine, start, end, }: {
3
3
  start: number;
4
4
  end: number;
5
5
  }): boolean;
6
- export declare function generateBedMethylFeature({ line, uniqueId, refName, start, end, }: {
7
- line: string;
6
+ export declare function generateBedMethylFeature({ splitLine, uniqueId, refName, start, end, }: {
7
+ splitLine: string[];
8
8
  uniqueId: string;
9
9
  refName: string;
10
10
  start: number;
@@ -15,7 +15,7 @@ export declare function generateBedMethylFeature({ line, uniqueId, refName, star
15
15
  start: number;
16
16
  end: number;
17
17
  code: string | undefined;
18
- score: string | undefined;
18
+ score: number;
19
19
  strand: string | undefined;
20
20
  color: string | undefined;
21
21
  source: string | undefined;
@@ -5,17 +5,15 @@ exports.generateBedMethylFeature = generateBedMethylFeature;
5
5
  function isBedMethylFeature({ splitLine, start, end, }) {
6
6
  return +(splitLine[6] || 0) === start && +(splitLine[7] || 0) === end;
7
7
  }
8
- function generateBedMethylFeature({ line, uniqueId, refName, start, end, }) {
9
- // see
10
- // https://github.com/nanoporetech/modkit?tab=readme-ov-file#description-of-bedmethyl-output
11
- const [, , , code, , strand, , , color, n_valid_cov, fraction_modified, n_mod, n_canonical, n_other_mod, n_delete, n_fail, n_diff, n_nocall,] = line.split('\t');
8
+ function generateBedMethylFeature({ splitLine, uniqueId, refName, start, end, }) {
9
+ const [, , , code, , strand, , , color, n_valid_cov, fraction_modified, n_mod, n_canonical, n_other_mod, n_delete, n_fail, n_diff, n_nocall,] = splitLine;
12
10
  return {
13
11
  uniqueId,
14
12
  refName,
15
13
  start,
16
14
  end,
17
15
  code,
18
- score: fraction_modified,
16
+ score: +fraction_modified || 0,
19
17
  strand,
20
18
  color,
21
19
  source: code,
@@ -1,4 +1,4 @@
1
- import { MinimalFeature, TranscriptFeat } from './types';
1
+ import type { MinimalFeature, TranscriptFeat } from './types';
2
2
  export declare function isUcscTranscript({ thickStart, blockCount, strand, }: {
3
3
  thickStart?: number;
4
4
  blockCount?: number;
@@ -16,7 +16,6 @@ function generateUcscTranscript(data) {
16
16
  const start = block.start;
17
17
  const end = block.end;
18
18
  if (thickStart >= end) {
19
- // left-side UTR
20
19
  subfeatures.push({
21
20
  type: `${strand > 0 ? 'five' : 'three'}_prime_UTR`,
22
21
  start,
@@ -25,7 +24,6 @@ function generateUcscTranscript(data) {
25
24
  });
26
25
  }
27
26
  else if (thickStart > start && thickStart < end && thickEnd >= end) {
28
- // UTR | CDS
29
27
  subfeatures.push({
30
28
  type: `${strand > 0 ? 'five' : 'three'}_prime_UTR`,
31
29
  start,
@@ -39,7 +37,6 @@ function generateUcscTranscript(data) {
39
37
  });
40
38
  }
41
39
  else if (thickStart <= start && thickEnd >= end) {
42
- // CDS
43
40
  subfeatures.push({
44
41
  type: 'CDS',
45
42
  start,
@@ -48,7 +45,6 @@ function generateUcscTranscript(data) {
48
45
  });
49
46
  }
50
47
  else if (thickStart > start && thickStart < end && thickEnd < end) {
51
- // UTR | CDS | UTR
52
48
  subfeatures.push({
53
49
  type: `${strand > 0 ? 'five' : 'three'}_prime_UTR`,
54
50
  start,
@@ -67,7 +63,6 @@ function generateUcscTranscript(data) {
67
63
  });
68
64
  }
69
65
  else if (thickStart <= start && thickEnd > start && thickEnd < end) {
70
- // CDS | UTR
71
66
  subfeatures.push({
72
67
  type: 'CDS',
73
68
  start,
@@ -81,7 +76,6 @@ function generateUcscTranscript(data) {
81
76
  });
82
77
  }
83
78
  else if (thickEnd <= start) {
84
- // right-side UTR
85
79
  subfeatures.push({
86
80
  type: `${strand > 0 ? 'three' : 'five'}_prime_UTR`,
87
81
  start,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Plugin from '@jbrowse/core/Plugin';
2
- import PluginManager from '@jbrowse/core/PluginManager';
2
+ import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  export default class BedPlugin extends Plugin {
4
4
  name: string;
5
5
  install(pluginManager: PluginManager): void;
package/dist/index.js CHANGED
@@ -4,11 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
7
- const BigBedAdapter_1 = __importDefault(require("./BigBedAdapter"));
8
- const BedpeAdapter_1 = __importDefault(require("./BedpeAdapter"));
9
- const BedTabixAdapter_1 = __importDefault(require("./BedTabixAdapter"));
10
- const BedAdapter_1 = __importDefault(require("./BedAdapter"));
11
7
  const tracks_1 = require("@jbrowse/core/util/tracks");
8
+ const BedAdapter_1 = __importDefault(require("./BedAdapter"));
9
+ const BedGraphAdapter_1 = __importDefault(require("./BedGraphAdapter"));
10
+ const BedGraphTabixAdapter_1 = __importDefault(require("./BedGraphTabixAdapter"));
11
+ const BedTabixAdapter_1 = __importDefault(require("./BedTabixAdapter"));
12
+ const BedpeAdapter_1 = __importDefault(require("./BedpeAdapter"));
13
+ const BigBedAdapter_1 = __importDefault(require("./BigBedAdapter"));
12
14
  class BedPlugin extends Plugin_1.default {
13
15
  constructor() {
14
16
  super(...arguments);
@@ -19,6 +21,8 @@ class BedPlugin extends Plugin_1.default {
19
21
  (0, BedAdapter_1.default)(pluginManager);
20
22
  (0, BedpeAdapter_1.default)(pluginManager);
21
23
  (0, BedTabixAdapter_1.default)(pluginManager);
24
+ (0, BedGraphAdapter_1.default)(pluginManager);
25
+ (0, BedGraphTabixAdapter_1.default)(pluginManager);
22
26
  pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
23
27
  return (file, index, adapterHint) => {
24
28
  const regexGuess = /\.(bb|bigbed)$/i;