@jbrowse/plugin-gff3 3.0.5 → 3.2.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.
@@ -45,7 +45,7 @@ class Gff3Adapter extends BaseAdapter_1.BaseFeatureDataAdapter {
45
45
  }
46
46
  }
47
47
  if (i++ % 10000 === 0) {
48
- statusCallback(`Loading ${Math.floor(blockStart / 1000000).toLocaleString('en-US')}/${Math.floor(buffer.length / 1000000).toLocaleString('en-US')} MB`);
48
+ statusCallback(`Loading ${(0, util_1.getProgressDisplayStr)(blockStart, buffer.length)}`);
49
49
  }
50
50
  blockStart = n + 1;
51
51
  }
@@ -55,13 +55,14 @@ class Gff3Adapter extends BaseAdapter_1.BaseFeatureDataAdapter {
55
55
  if (!this.calculatedIntervalTreeMap[refName]) {
56
56
  sc === null || sc === void 0 ? void 0 : sc('Parsing GFF data');
57
57
  const intervalTree = new interval_tree_1.default();
58
- (0, gff_nostream_1.parseStringSync)(lines)
58
+ for (const obj of (0, gff_nostream_1.parseStringSync)(lines)
59
59
  .flat()
60
60
  .map((f, i) => new simpleFeature_1.default({
61
61
  data: (0, featureData_1.featureData)(f),
62
62
  id: `${this.id}-${refName}-${i}`,
63
- }))
64
- .forEach(obj => intervalTree.insert([obj.get('start'), obj.get('end')], obj));
63
+ }))) {
64
+ intervalTree.insert([obj.get('start'), obj.get('end')], obj);
65
+ }
65
66
  this.calculatedIntervalTreeMap[refName] = intervalTree;
66
67
  }
67
68
  return this.calculatedIntervalTreeMap[refName];
@@ -95,9 +96,12 @@ class Gff3Adapter extends BaseAdapter_1.BaseFeatureDataAdapter {
95
96
  try {
96
97
  const { start, end, refName } = query;
97
98
  const { intervalTreeMap } = await this.loadData(opts);
98
- (_a = intervalTreeMap[refName]) === null || _a === void 0 ? void 0 : _a.call(intervalTreeMap, opts.statusCallback).search([start, end]).forEach(f => {
99
+ for (const f of ((_a = intervalTreeMap[refName]) === null || _a === void 0 ? void 0 : _a.call(intervalTreeMap, opts.statusCallback).search([
100
+ start,
101
+ end,
102
+ ])) || []) {
99
103
  observer.next(f);
100
- });
104
+ }
101
105
  observer.complete();
102
106
  }
103
107
  catch (e) {
@@ -5,7 +5,23 @@ function x() { }
5
5
  const Gff3Adapter = (0, configuration_1.ConfigurationSchema)('Gff3Adapter', {
6
6
  gffLocation: {
7
7
  type: 'fileLocation',
8
- defaultValue: { uri: '/path/to/my.gff', locationType: 'UriLocation' },
8
+ defaultValue: {
9
+ uri: '/path/to/my.gff',
10
+ locationType: 'UriLocation',
11
+ },
9
12
  },
10
- }, { explicitlyTyped: true });
13
+ }, {
14
+ explicitlyTyped: true,
15
+ preProcessSnapshot: snap => {
16
+ return snap.uri
17
+ ? {
18
+ ...snap,
19
+ gffLocation: {
20
+ uri: snap.uri,
21
+ baseUri: snap.baseUri,
22
+ },
23
+ }
24
+ : snap;
25
+ },
26
+ });
11
27
  exports.default = Gff3Adapter;
@@ -6,7 +6,10 @@ function x() { }
6
6
  const Gff3TabixAdapter = (0, configuration_1.ConfigurationSchema)('Gff3TabixAdapter', {
7
7
  gffGzLocation: {
8
8
  type: 'fileLocation',
9
- defaultValue: { uri: '/path/to/my.gff.gz', locationType: 'UriLocation' },
9
+ defaultValue: {
10
+ uri: '/path/to/my.gff.gz',
11
+ locationType: 'UriLocation',
12
+ },
10
13
  },
11
14
  index: (0, configuration_1.ConfigurationSchema)('Gff3TabixIndex', {
12
15
  indexType: {
@@ -26,5 +29,24 @@ const Gff3TabixAdapter = (0, configuration_1.ConfigurationSchema)('Gff3TabixAdap
26
29
  type: 'stringArray',
27
30
  defaultValue: ['chromosome', 'region', 'contig'],
28
31
  },
29
- }, { explicitlyTyped: true });
32
+ }, {
33
+ explicitlyTyped: true,
34
+ preProcessSnapshot: snap => {
35
+ return snap.uri
36
+ ? {
37
+ ...snap,
38
+ gffGzLocation: {
39
+ uri: snap.uri,
40
+ baseUri: snap.baseUri,
41
+ },
42
+ index: {
43
+ location: {
44
+ uri: snap.uri,
45
+ baseUri: snap.baseUri,
46
+ },
47
+ },
48
+ }
49
+ : snap;
50
+ },
51
+ });
30
52
  exports.default = Gff3TabixAdapter;
@@ -1,6 +1,6 @@
1
1
  import IntervalTree from '@flatten-js/interval-tree';
2
2
  import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
3
- import { fetchAndMaybeUnzip } from '@jbrowse/core/util';
3
+ import { fetchAndMaybeUnzip, getProgressDisplayStr } from '@jbrowse/core/util';
4
4
  import { openLocation } from '@jbrowse/core/util/io';
5
5
  import { ObservableCreate } from '@jbrowse/core/util/rxjs';
6
6
  import SimpleFeature from '@jbrowse/core/util/simpleFeature';
@@ -40,7 +40,7 @@ export default class Gff3Adapter extends BaseFeatureDataAdapter {
40
40
  }
41
41
  }
42
42
  if (i++ % 10000 === 0) {
43
- statusCallback(`Loading ${Math.floor(blockStart / 1000000).toLocaleString('en-US')}/${Math.floor(buffer.length / 1000000).toLocaleString('en-US')} MB`);
43
+ statusCallback(`Loading ${getProgressDisplayStr(blockStart, buffer.length)}`);
44
44
  }
45
45
  blockStart = n + 1;
46
46
  }
@@ -50,13 +50,14 @@ export default class Gff3Adapter extends BaseFeatureDataAdapter {
50
50
  if (!this.calculatedIntervalTreeMap[refName]) {
51
51
  sc === null || sc === void 0 ? void 0 : sc('Parsing GFF data');
52
52
  const intervalTree = new IntervalTree();
53
- parseStringSync(lines)
53
+ for (const obj of parseStringSync(lines)
54
54
  .flat()
55
55
  .map((f, i) => new SimpleFeature({
56
56
  data: featureData(f),
57
57
  id: `${this.id}-${refName}-${i}`,
58
- }))
59
- .forEach(obj => intervalTree.insert([obj.get('start'), obj.get('end')], obj));
58
+ }))) {
59
+ intervalTree.insert([obj.get('start'), obj.get('end')], obj);
60
+ }
60
61
  this.calculatedIntervalTreeMap[refName] = intervalTree;
61
62
  }
62
63
  return this.calculatedIntervalTreeMap[refName];
@@ -90,9 +91,12 @@ export default class Gff3Adapter extends BaseFeatureDataAdapter {
90
91
  try {
91
92
  const { start, end, refName } = query;
92
93
  const { intervalTreeMap } = await this.loadData(opts);
93
- (_a = intervalTreeMap[refName]) === null || _a === void 0 ? void 0 : _a.call(intervalTreeMap, opts.statusCallback).search([start, end]).forEach(f => {
94
+ for (const f of ((_a = intervalTreeMap[refName]) === null || _a === void 0 ? void 0 : _a.call(intervalTreeMap, opts.statusCallback).search([
95
+ start,
96
+ end,
97
+ ])) || []) {
94
98
  observer.next(f);
95
- });
99
+ }
96
100
  observer.complete();
97
101
  }
98
102
  catch (e) {
@@ -3,7 +3,23 @@ function x() { }
3
3
  const Gff3Adapter = ConfigurationSchema('Gff3Adapter', {
4
4
  gffLocation: {
5
5
  type: 'fileLocation',
6
- defaultValue: { uri: '/path/to/my.gff', locationType: 'UriLocation' },
6
+ defaultValue: {
7
+ uri: '/path/to/my.gff',
8
+ locationType: 'UriLocation',
9
+ },
7
10
  },
8
- }, { explicitlyTyped: true });
11
+ }, {
12
+ explicitlyTyped: true,
13
+ preProcessSnapshot: snap => {
14
+ return snap.uri
15
+ ? {
16
+ ...snap,
17
+ gffLocation: {
18
+ uri: snap.uri,
19
+ baseUri: snap.baseUri,
20
+ },
21
+ }
22
+ : snap;
23
+ },
24
+ });
9
25
  export default Gff3Adapter;
@@ -4,7 +4,10 @@ function x() { }
4
4
  const Gff3TabixAdapter = ConfigurationSchema('Gff3TabixAdapter', {
5
5
  gffGzLocation: {
6
6
  type: 'fileLocation',
7
- defaultValue: { uri: '/path/to/my.gff.gz', locationType: 'UriLocation' },
7
+ defaultValue: {
8
+ uri: '/path/to/my.gff.gz',
9
+ locationType: 'UriLocation',
10
+ },
8
11
  },
9
12
  index: ConfigurationSchema('Gff3TabixIndex', {
10
13
  indexType: {
@@ -24,5 +27,24 @@ const Gff3TabixAdapter = ConfigurationSchema('Gff3TabixAdapter', {
24
27
  type: 'stringArray',
25
28
  defaultValue: ['chromosome', 'region', 'contig'],
26
29
  },
27
- }, { explicitlyTyped: true });
30
+ }, {
31
+ explicitlyTyped: true,
32
+ preProcessSnapshot: snap => {
33
+ return snap.uri
34
+ ? {
35
+ ...snap,
36
+ gffGzLocation: {
37
+ uri: snap.uri,
38
+ baseUri: snap.baseUri,
39
+ },
40
+ index: {
41
+ location: {
42
+ uri: snap.uri,
43
+ baseUri: snap.baseUri,
44
+ },
45
+ },
46
+ }
47
+ : snap;
48
+ },
49
+ });
28
50
  export default Gff3TabixAdapter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-gff3",
3
- "version": "3.0.5",
3
+ "version": "3.2.0",
4
4
  "description": "JBrowse 2 gff3.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -39,8 +39,8 @@
39
39
  "@flatten-js/interval-tree": "^1.0.15",
40
40
  "@gmod/bgzf-filehandle": "^2.0.1",
41
41
  "@gmod/tabix": "^2.0.0",
42
- "@jbrowse/core": "^3.0.5",
43
- "@jbrowse/plugin-linear-genome-view": "^3.0.5",
42
+ "@jbrowse/core": "^3.2.0",
43
+ "@jbrowse/plugin-linear-genome-view": "^3.2.0",
44
44
  "@mui/material": "^6.0.0",
45
45
  "gff-nostream": "^1.3.3",
46
46
  "mobx": "^6.0.0",
@@ -53,5 +53,5 @@
53
53
  "distModule": "esm/index.js",
54
54
  "srcModule": "src/index.ts",
55
55
  "module": "esm/index.js",
56
- "gitHead": "a03749efe19e51609922272b845a331897346789"
56
+ "gitHead": "c750e3f56706a490c19ba75abd807fec5e38aebf"
57
57
  }