@jbrowse/plugin-gtf 2.16.0 → 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,11 +8,9 @@ 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 util_1 = require("@jbrowse/core/util");
|
|
11
|
-
const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
|
|
12
11
|
const gtf_nostream_1 = require("gtf-nostream");
|
|
13
12
|
// locals
|
|
14
13
|
const util_2 = require("../util");
|
|
15
|
-
const decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf8') : undefined;
|
|
16
14
|
class GtfAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
17
15
|
constructor() {
|
|
18
16
|
super(...arguments);
|
|
@@ -20,19 +18,18 @@ class GtfAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
20
18
|
}
|
|
21
19
|
async loadDataP(opts) {
|
|
22
20
|
const { statusCallback = () => { } } = opts || {};
|
|
23
|
-
const
|
|
24
|
-
const buffer = (0, util_1.
|
|
25
|
-
? await (0, util_1.updateStatus)('Unzipping', statusCallback, () => (0, bgzf_filehandle_1.unzip)(buf))
|
|
26
|
-
: buf;
|
|
21
|
+
const loc = (0, io_1.openLocation)(this.getConf('gtfLocation'), this.pluginManager);
|
|
22
|
+
const buffer = await (0, util_1.fetchAndMaybeUnzip)(loc, opts);
|
|
27
23
|
const headerLines = [];
|
|
28
24
|
const featureMap = {};
|
|
29
25
|
let blockStart = 0;
|
|
30
26
|
let i = 0;
|
|
27
|
+
const decoder = new TextDecoder('utf8');
|
|
31
28
|
while (blockStart < buffer.length) {
|
|
32
29
|
const n = buffer.indexOf('\n', blockStart);
|
|
33
30
|
// could be a non-newline ended file, so slice to end of file if n===-1
|
|
34
31
|
const b = n === -1 ? buffer.subarray(blockStart) : buffer.subarray(blockStart, n);
|
|
35
|
-
const line =
|
|
32
|
+
const line = decoder.decode(b).trim();
|
|
36
33
|
if (line) {
|
|
37
34
|
if (line.startsWith('#')) {
|
|
38
35
|
headerLines.push(line);
|
|
@@ -2,12 +2,10 @@ import { BaseFeatureDataAdapter, } from '@jbrowse/core/data_adapters/BaseAdapter
|
|
|
2
2
|
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
|
-
import { SimpleFeature,
|
|
6
|
-
import { unzip } from '@gmod/bgzf-filehandle';
|
|
5
|
+
import { SimpleFeature, fetchAndMaybeUnzip } from '@jbrowse/core/util';
|
|
7
6
|
import { parseStringSync } from 'gtf-nostream';
|
|
8
7
|
// locals
|
|
9
8
|
import { featureData } from '../util';
|
|
10
|
-
const decoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf8') : undefined;
|
|
11
9
|
export default class GtfAdapter extends BaseFeatureDataAdapter {
|
|
12
10
|
constructor() {
|
|
13
11
|
super(...arguments);
|
|
@@ -15,19 +13,18 @@ export default class GtfAdapter extends BaseFeatureDataAdapter {
|
|
|
15
13
|
}
|
|
16
14
|
async loadDataP(opts) {
|
|
17
15
|
const { statusCallback = () => { } } = opts || {};
|
|
18
|
-
const
|
|
19
|
-
const buffer =
|
|
20
|
-
? await updateStatus('Unzipping', statusCallback, () => unzip(buf))
|
|
21
|
-
: buf;
|
|
16
|
+
const loc = openLocation(this.getConf('gtfLocation'), this.pluginManager);
|
|
17
|
+
const buffer = await fetchAndMaybeUnzip(loc, opts);
|
|
22
18
|
const headerLines = [];
|
|
23
19
|
const featureMap = {};
|
|
24
20
|
let blockStart = 0;
|
|
25
21
|
let i = 0;
|
|
22
|
+
const decoder = new TextDecoder('utf8');
|
|
26
23
|
while (blockStart < buffer.length) {
|
|
27
24
|
const n = buffer.indexOf('\n', blockStart);
|
|
28
25
|
// could be a non-newline ended file, so slice to end of file if n===-1
|
|
29
26
|
const b = n === -1 ? buffer.subarray(blockStart) : buffer.subarray(blockStart, n);
|
|
30
|
-
const line =
|
|
27
|
+
const line = decoder.decode(b).trim();
|
|
31
28
|
if (line) {
|
|
32
29
|
if (line.startsWith('#')) {
|
|
33
30
|
headerLines.push(line);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-gtf",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.0",
|
|
4
4
|
"description": "JBrowse 2 gtf feature adapter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"distModule": "esm/index.js",
|
|
57
57
|
"srcModule": "src/index.ts",
|
|
58
58
|
"module": "esm/index.js",
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "eed30b5e671f8f7823652d7cecc51aa89226de46"
|
|
60
60
|
}
|