@jbrowse/plugin-variants 2.16.1 → 2.17.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.
@@ -93,8 +93,8 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
93
93
  trackId: string | undefined;
94
94
  trackType: string | undefined;
95
95
  maxDepth: number | undefined;
96
- formattedFields: any;
97
96
  sequenceFeatureDetails: import("mobx-state-tree").ModelSnapshotType<{}>;
97
+ formattedFields: any;
98
98
  finalizedFeatureData: any;
99
99
  } & import("mobx-state-tree")._NotCustomized>;
100
100
  export type VariantFeatureWidgetStateModel = ReturnType<typeof stateModelFactory>;
@@ -8,7 +8,6 @@ const util_1 = require("@jbrowse/core/util");
8
8
  const io_1 = require("@jbrowse/core/util/io");
9
9
  const rxjs_1 = require("@jbrowse/core/util/rxjs");
10
10
  const interval_tree_1 = __importDefault(require("@flatten-js/interval-tree"));
11
- const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
12
11
  const vcf_1 = __importDefault(require("@gmod/vcf"));
13
12
  // local
14
13
  const VcfFeature_1 = __importDefault(require("../VcfFeature"));
@@ -28,20 +27,18 @@ class VcfAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
28
27
  }
29
28
  async setupP(opts) {
30
29
  const { statusCallback = () => { } } = opts || {};
31
- const buf = (await (0, io_1.openLocation)(this.getConf('vcfLocation'), this.pluginManager).readFile(opts));
32
- const buffer = (0, util_1.isGzip)(buf)
33
- ? await (0, util_1.updateStatus)('Unzipping', statusCallback, () => (0, bgzf_filehandle_1.unzip)(buf))
34
- : buf;
30
+ const loc = (0, io_1.openLocation)(this.getConf('vcfLocation'), this.pluginManager);
31
+ const buffer = await (0, util_1.fetchAndMaybeUnzip)(loc, opts);
35
32
  const headerLines = [];
36
33
  const featureMap = {};
37
34
  let blockStart = 0;
38
- const decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf8') : undefined;
35
+ const decoder = new TextDecoder('utf8');
39
36
  let i = 0;
40
37
  while (blockStart < buffer.length) {
41
38
  const n = buffer.indexOf('\n', blockStart);
42
39
  // could be a non-newline ended file, so slice to end of file if n===-1
43
40
  const b = n === -1 ? buffer.subarray(blockStart) : buffer.subarray(blockStart, n);
44
- const line = ((decoder === null || decoder === void 0 ? void 0 : decoder.decode(b)) || b.toString()).trim();
41
+ const line = decoder.decode(b).trim();
45
42
  if (line) {
46
43
  if (line.startsWith('#')) {
47
44
  headerLines.push(line);
@@ -93,8 +93,8 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
93
93
  trackId: string | undefined;
94
94
  trackType: string | undefined;
95
95
  maxDepth: number | undefined;
96
- formattedFields: any;
97
96
  sequenceFeatureDetails: import("mobx-state-tree").ModelSnapshotType<{}>;
97
+ formattedFields: any;
98
98
  finalizedFeatureData: any;
99
99
  } & import("mobx-state-tree")._NotCustomized>;
100
100
  export type VariantFeatureWidgetStateModel = ReturnType<typeof stateModelFactory>;
@@ -1,9 +1,8 @@
1
1
  import { BaseFeatureDataAdapter, } from '@jbrowse/core/data_adapters/BaseAdapter';
2
- import { updateStatus, isGzip } from '@jbrowse/core/util';
2
+ import { fetchAndMaybeUnzip } from '@jbrowse/core/util';
3
3
  import { openLocation } from '@jbrowse/core/util/io';
4
4
  import { ObservableCreate } from '@jbrowse/core/util/rxjs';
5
5
  import IntervalTree from '@flatten-js/interval-tree';
6
- import { unzip } from '@gmod/bgzf-filehandle';
7
6
  import VCF from '@gmod/vcf';
8
7
  // local
9
8
  import VcfFeature from '../VcfFeature';
@@ -23,20 +22,18 @@ class VcfAdapter extends BaseFeatureDataAdapter {
23
22
  }
24
23
  async setupP(opts) {
25
24
  const { statusCallback = () => { } } = opts || {};
26
- const buf = (await openLocation(this.getConf('vcfLocation'), this.pluginManager).readFile(opts));
27
- const buffer = isGzip(buf)
28
- ? await updateStatus('Unzipping', statusCallback, () => unzip(buf))
29
- : buf;
25
+ const loc = openLocation(this.getConf('vcfLocation'), this.pluginManager);
26
+ const buffer = await fetchAndMaybeUnzip(loc, opts);
30
27
  const headerLines = [];
31
28
  const featureMap = {};
32
29
  let blockStart = 0;
33
- const decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf8') : undefined;
30
+ const decoder = new TextDecoder('utf8');
34
31
  let i = 0;
35
32
  while (blockStart < buffer.length) {
36
33
  const n = buffer.indexOf('\n', blockStart);
37
34
  // could be a non-newline ended file, so slice to end of file if n===-1
38
35
  const b = n === -1 ? buffer.subarray(blockStart) : buffer.subarray(blockStart, n);
39
- const line = ((decoder === null || decoder === void 0 ? void 0 : decoder.decode(b)) || b.toString()).trim();
36
+ const line = decoder.decode(b).trim();
40
37
  if (line) {
41
38
  if (line.startsWith('#')) {
42
39
  headerLines.push(line);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-variants",
3
- "version": "2.16.1",
3
+ "version": "2.17.0",
4
4
  "description": "JBrowse 2 variant adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -40,7 +40,7 @@
40
40
  "@gmod/bgzf-filehandle": "^1.4.3",
41
41
  "@gmod/tabix": "^1.5.6",
42
42
  "@gmod/vcf": "^5.0.9",
43
- "@jbrowse/sv-core": "^2.16.1",
43
+ "@jbrowse/sv-core": "^2.17.0",
44
44
  "@mui/icons-material": "^6.0.0",
45
45
  "@mui/x-data-grid": "^7.0.0",
46
46
  "generic-filehandle": "^3.0.0"
@@ -63,5 +63,5 @@
63
63
  "distModule": "esm/index.js",
64
64
  "srcModule": "src/index.ts",
65
65
  "module": "esm/index.js",
66
- "gitHead": "c6a658d2344989895543f0456b1cf7dd3b937769"
66
+ "gitHead": "eed30b5e671f8f7823652d7cecc51aa89226de46"
67
67
  }