@jbrowse/plugin-gff3 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.
@@ -8,7 +8,6 @@ const io_1 = require("@jbrowse/core/util/io");
8
8
  const rxjs_1 = require("@jbrowse/core/util/rxjs");
9
9
  const interval_tree_1 = __importDefault(require("@flatten-js/interval-tree"));
10
10
  const simpleFeature_1 = __importDefault(require("@jbrowse/core/util/simpleFeature"));
11
- const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
12
11
  const gff_nostream_1 = require("gff-nostream");
13
12
  const util_1 = require("@jbrowse/core/util");
14
13
  const featureData_1 = require("../featureData");
@@ -19,20 +18,17 @@ class Gff3Adapter extends BaseAdapter_1.BaseFeatureDataAdapter {
19
18
  }
20
19
  async loadDataP(opts) {
21
20
  const { statusCallback = () => { } } = opts || {};
22
- const buf = (await (0, io_1.openLocation)(this.getConf('gffLocation'), this.pluginManager).readFile(opts));
23
- const buffer = (0, util_1.isGzip)(buf)
24
- ? await (0, util_1.updateStatus)('Unzipping', statusCallback, () => (0, bgzf_filehandle_1.unzip)(buf))
25
- : buf;
21
+ const buffer = await (0, util_1.fetchAndMaybeUnzip)((0, io_1.openLocation)(this.getConf('gffLocation'), this.pluginManager));
26
22
  const headerLines = [];
27
23
  const featureMap = {};
24
+ const decoder = new TextDecoder('utf8');
28
25
  let blockStart = 0;
29
- const decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf8') : undefined;
30
26
  let i = 0;
31
27
  while (blockStart < buffer.length) {
32
28
  const n = buffer.indexOf('\n', blockStart);
33
29
  // could be a non-newline ended file, so subarray to end of file if n===-1
34
30
  const b = n === -1 ? buffer.subarray(blockStart) : buffer.subarray(blockStart, n);
35
- const line = ((decoder === null || decoder === void 0 ? void 0 : decoder.decode(b)) || b.toString()).trim();
31
+ const line = decoder.decode(b).trim();
36
32
  if (line) {
37
33
  if (line.startsWith('#')) {
38
34
  headerLines.push(line);
@@ -3,9 +3,8 @@ import { openLocation } from '@jbrowse/core/util/io';
3
3
  import { ObservableCreate } from '@jbrowse/core/util/rxjs';
4
4
  import IntervalTree from '@flatten-js/interval-tree';
5
5
  import SimpleFeature from '@jbrowse/core/util/simpleFeature';
6
- import { unzip } from '@gmod/bgzf-filehandle';
7
6
  import { parseStringSync } from 'gff-nostream';
8
- import { isGzip, updateStatus } from '@jbrowse/core/util';
7
+ import { fetchAndMaybeUnzip } from '@jbrowse/core/util';
9
8
  import { featureData } from '../featureData';
10
9
  export default class Gff3Adapter extends BaseFeatureDataAdapter {
11
10
  constructor() {
@@ -14,20 +13,17 @@ export default class Gff3Adapter extends BaseFeatureDataAdapter {
14
13
  }
15
14
  async loadDataP(opts) {
16
15
  const { statusCallback = () => { } } = opts || {};
17
- const buf = (await openLocation(this.getConf('gffLocation'), this.pluginManager).readFile(opts));
18
- const buffer = isGzip(buf)
19
- ? await updateStatus('Unzipping', statusCallback, () => unzip(buf))
20
- : buf;
16
+ const buffer = await fetchAndMaybeUnzip(openLocation(this.getConf('gffLocation'), this.pluginManager));
21
17
  const headerLines = [];
22
18
  const featureMap = {};
19
+ const decoder = new TextDecoder('utf8');
23
20
  let blockStart = 0;
24
- const decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf8') : undefined;
25
21
  let i = 0;
26
22
  while (blockStart < buffer.length) {
27
23
  const n = buffer.indexOf('\n', blockStart);
28
24
  // could be a non-newline ended file, so subarray to end of file if n===-1
29
25
  const b = n === -1 ? buffer.subarray(blockStart) : buffer.subarray(blockStart, n);
30
- const line = ((decoder === null || decoder === void 0 ? void 0 : decoder.decode(b)) || b.toString()).trim();
26
+ const line = decoder.decode(b).trim();
31
27
  if (line) {
32
28
  if (line.startsWith('#')) {
33
29
  headerLines.push(line);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-gff3",
3
- "version": "2.16.1",
3
+ "version": "2.17.0",
4
4
  "description": "JBrowse 2 gff3.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -55,5 +55,5 @@
55
55
  "distModule": "esm/index.js",
56
56
  "srcModule": "src/index.ts",
57
57
  "module": "esm/index.js",
58
- "gitHead": "c6a658d2344989895543f0456b1cf7dd3b937769"
58
+ "gitHead": "eed30b5e671f8f7823652d7cecc51aa89226de46"
59
59
  }