@jbrowse/plugin-sequence 2.0.1 → 2.1.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.
- package/dist/ChromSizesAdapter/ChromSizesAdapter.d.ts +9 -8
- package/dist/ChromSizesAdapter/ChromSizesAdapter.js +31 -26
- package/dist/ChromSizesAdapter/ChromSizesAdapter.js.map +1 -1
- package/esm/ChromSizesAdapter/ChromSizesAdapter.d.ts +9 -8
- package/esm/ChromSizesAdapter/ChromSizesAdapter.js +20 -23
- package/esm/ChromSizesAdapter/ChromSizesAdapter.js.map +1 -1
- package/package.json +3 -4
- package/src/ChromSizesAdapter/ChromSizesAdapter.ts +22 -38
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { RegionsAdapter, BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
import { Instance } from 'mobx-state-tree';
|
|
3
|
-
import MyConfigSchema from './configSchema';
|
|
4
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
5
|
-
import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
6
2
|
export default class extends BaseAdapter implements RegionsAdapter {
|
|
7
|
-
protected
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
protected setupP?: Promise<{
|
|
4
|
+
[key: string]: number;
|
|
5
|
+
}>;
|
|
6
|
+
setupPre(): Promise<{
|
|
7
|
+
[k: string]: number;
|
|
8
|
+
}>;
|
|
9
|
+
setup(): Promise<{
|
|
10
|
+
[key: string]: number;
|
|
11
|
+
}>;
|
|
11
12
|
getRegions(): Promise<{
|
|
12
13
|
refName: string;
|
|
13
14
|
start: number;
|
|
@@ -69,40 +69,45 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
69
69
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
70
|
var BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
71
71
|
var io_1 = require("@jbrowse/core/util/io");
|
|
72
|
-
var configuration_1 = require("@jbrowse/core/configuration");
|
|
73
72
|
var default_1 = /** @class */ (function (_super) {
|
|
74
73
|
__extends(default_1, _super);
|
|
75
|
-
function default_1(
|
|
76
|
-
|
|
77
|
-
var chromSizesLocation = (0, configuration_1.readConfObject)(config, 'chromSizesLocation');
|
|
78
|
-
if (!chromSizesLocation) {
|
|
79
|
-
throw new Error('must provide chromSizesLocation');
|
|
80
|
-
}
|
|
81
|
-
var file = (0, io_1.openLocation)(chromSizesLocation, _this.pluginManager);
|
|
82
|
-
_this.source = file.toString();
|
|
83
|
-
_this.refSeqs = _this.init(file);
|
|
84
|
-
return _this;
|
|
74
|
+
function default_1() {
|
|
75
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
85
76
|
}
|
|
86
|
-
default_1.prototype.
|
|
77
|
+
default_1.prototype.setupPre = function () {
|
|
87
78
|
return __awaiter(this, void 0, void 0, function () {
|
|
88
|
-
var
|
|
79
|
+
var pm, file, data;
|
|
89
80
|
return __generator(this, function (_a) {
|
|
90
81
|
switch (_a.label) {
|
|
91
|
-
case 0:
|
|
82
|
+
case 0:
|
|
83
|
+
pm = this.pluginManager;
|
|
84
|
+
file = (0, io_1.openLocation)(this.getConf('chromSizesLocation'), pm);
|
|
85
|
+
return [4 /*yield*/, file.readFile('utf8')];
|
|
92
86
|
case 1:
|
|
93
87
|
data = _a.sent();
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
88
|
+
return [2 /*return*/, Object.fromEntries(data
|
|
89
|
+
.split('\n')
|
|
90
|
+
.map(function (f) { return f.trim(); })
|
|
91
|
+
.filter(function (f) { return !!f; })
|
|
92
|
+
.map(function (line) {
|
|
93
|
+
var _a = __read(line.split('\t'), 2), name = _a[0], length = _a[1];
|
|
94
|
+
return [name, +length];
|
|
95
|
+
}))];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
default_1.prototype.setup = function () {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
102
|
+
var _this = this;
|
|
103
|
+
return __generator(this, function (_a) {
|
|
104
|
+
if (!this.setupP) {
|
|
105
|
+
this.setupP = this.setupPre().catch(function (e) {
|
|
106
|
+
_this.setupP = undefined;
|
|
107
|
+
throw e;
|
|
108
|
+
});
|
|
105
109
|
}
|
|
110
|
+
return [2 /*return*/, this.setupP];
|
|
106
111
|
});
|
|
107
112
|
});
|
|
108
113
|
};
|
|
@@ -111,7 +116,7 @@ var default_1 = /** @class */ (function (_super) {
|
|
|
111
116
|
var refSeqs;
|
|
112
117
|
return __generator(this, function (_a) {
|
|
113
118
|
switch (_a.label) {
|
|
114
|
-
case 0: return [4 /*yield*/, this.
|
|
119
|
+
case 0: return [4 /*yield*/, this.setup()];
|
|
115
120
|
case 1:
|
|
116
121
|
refSeqs = _a.sent();
|
|
117
122
|
return [2 /*return*/, Object.keys(refSeqs).map(function (refName) { return ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChromSizesAdapter.js","sourceRoot":"","sources":["../../src/ChromSizesAdapter/ChromSizesAdapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAGgD;
|
|
1
|
+
{"version":3,"file":"ChromSizesAdapter.js","sourceRoot":"","sources":["../../src/ChromSizesAdapter/ChromSizesAdapter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAGgD;AAChD,4CAAoD;AAEpD;IAA6B,6BAAW;IAAxC;;IA4CA,CAAC;IAxCO,4BAAQ,GAAd;;;;;;wBACQ,EAAE,GAAG,IAAI,CAAC,aAAa,CA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AC,OAAO,CAAC;6BACtB,CAAC,EAJyC,CAIzC,CAAC,EAAA;;;;KACJ;IAEM,6BAAS,GAAhB;QACE,OAAO,EAAE,CAAA;IACX,CAAC;IAEM,iCAAa,GAApB,WAAqB,gBAAgB,IAAS,CAAC;IACjD,gBAAC;AAAD,CAAC,AA5CD,CAA6B,yBAAW,GA4CvC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { RegionsAdapter, BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
import { Instance } from 'mobx-state-tree';
|
|
3
|
-
import MyConfigSchema from './configSchema';
|
|
4
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
5
|
-
import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
6
2
|
export default class extends BaseAdapter implements RegionsAdapter {
|
|
7
|
-
protected
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
protected setupP?: Promise<{
|
|
4
|
+
[key: string]: number;
|
|
5
|
+
}>;
|
|
6
|
+
setupPre(): Promise<{
|
|
7
|
+
[k: string]: number;
|
|
8
|
+
}>;
|
|
9
|
+
setup(): Promise<{
|
|
10
|
+
[key: string]: number;
|
|
11
|
+
}>;
|
|
11
12
|
getRegions(): Promise<{
|
|
12
13
|
refName: string;
|
|
13
14
|
start: number;
|
|
@@ -1,33 +1,30 @@
|
|
|
1
1
|
import { BaseAdapter, } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
2
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
3
|
-
import { readConfObject } from '@jbrowse/core/configuration';
|
|
4
3
|
export default class extends BaseAdapter {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
if (!chromSizesLocation) {
|
|
9
|
-
throw new Error('must provide chromSizesLocation');
|
|
10
|
-
}
|
|
11
|
-
const file = openLocation(chromSizesLocation, this.pluginManager);
|
|
12
|
-
this.source = file.toString();
|
|
13
|
-
this.refSeqs = this.init(file);
|
|
14
|
-
}
|
|
15
|
-
async init(file) {
|
|
4
|
+
async setupPre() {
|
|
5
|
+
const pm = this.pluginManager;
|
|
6
|
+
const file = openLocation(this.getConf('chromSizesLocation'), pm);
|
|
16
7
|
const data = await file.readFile('utf8');
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
return Object.fromEntries(data
|
|
9
|
+
.split('\n')
|
|
10
|
+
.map(f => f.trim())
|
|
11
|
+
.filter(f => !!f)
|
|
12
|
+
.map((line) => {
|
|
13
|
+
const [name, length] = line.split('\t');
|
|
14
|
+
return [name, +length];
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
async setup() {
|
|
18
|
+
if (!this.setupP) {
|
|
19
|
+
this.setupP = this.setupPre().catch(e => {
|
|
20
|
+
this.setupP = undefined;
|
|
21
|
+
throw e;
|
|
22
|
+
});
|
|
20
23
|
}
|
|
21
|
-
|
|
22
|
-
if (line.length) {
|
|
23
|
-
const [name, length] = line.split('\t');
|
|
24
|
-
refSeqs[name] = +length;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
return refSeqs;
|
|
24
|
+
return this.setupP;
|
|
28
25
|
}
|
|
29
26
|
async getRegions() {
|
|
30
|
-
const refSeqs = await this.
|
|
27
|
+
const refSeqs = await this.setup();
|
|
31
28
|
return Object.keys(refSeqs).map(refName => ({
|
|
32
29
|
refName,
|
|
33
30
|
start: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChromSizesAdapter.js","sourceRoot":"","sources":["../../src/ChromSizesAdapter/ChromSizesAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,GACZ,MAAM,yCAAyC,CAAA;
|
|
1
|
+
{"version":3,"file":"ChromSizesAdapter.js","sourceRoot":"","sources":["../../src/ChromSizesAdapter/ChromSizesAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,GACZ,MAAM,yCAAyC,CAAA;AAChD,OAAO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CAAC,CAAC;YAC1C,OAAO;YACP,KAAK,EAAE,CAAC;YACR,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC;SACtB,CAAC,CAAC,CAAA;IACL,CAAC;IAEM,SAAS;QACd,OAAO,EAAE,CAAA;IACX,CAAC;IAEM,aAAa,EAAC,gBAAgB,IAAS,CAAC;CAChD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-sequence",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "JBrowse 2 sequence adapters, tracks, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -40,8 +40,7 @@
|
|
|
40
40
|
"@babel/runtime": "^7.17.9",
|
|
41
41
|
"@gmod/indexedfasta": "^2.0.2",
|
|
42
42
|
"@gmod/twobit": "^1.1.12",
|
|
43
|
-
"abortable-promise-cache": "^1.5.0"
|
|
44
|
-
"generic-filehandle": "^2.2.2"
|
|
43
|
+
"abortable-promise-cache": "^1.5.0"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
47
46
|
"@jbrowse/core": "^2.0.0",
|
|
@@ -61,5 +60,5 @@
|
|
|
61
60
|
"distModule": "esm/index.js",
|
|
62
61
|
"srcModule": "src/index.ts",
|
|
63
62
|
"module": "esm/index.js",
|
|
64
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "0db0462fa1f9f15ab4869da085bcab032b9483c3"
|
|
65
64
|
}
|
|
@@ -2,56 +2,40 @@ import {
|
|
|
2
2
|
RegionsAdapter,
|
|
3
3
|
BaseAdapter,
|
|
4
4
|
} from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
5
|
-
import { FileLocation } from '@jbrowse/core/util/types'
|
|
6
5
|
import { openLocation } from '@jbrowse/core/util/io'
|
|
7
|
-
import { GenericFilehandle } from 'generic-filehandle'
|
|
8
|
-
import { readConfObject } from '@jbrowse/core/configuration'
|
|
9
|
-
import { Instance } from 'mobx-state-tree'
|
|
10
|
-
import MyConfigSchema from './configSchema'
|
|
11
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
12
|
-
import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache'
|
|
13
6
|
|
|
14
7
|
export default class extends BaseAdapter implements RegionsAdapter {
|
|
15
8
|
// the map of refSeq to length
|
|
16
|
-
protected
|
|
9
|
+
protected setupP?: Promise<{ [key: string]: number }>
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
chromSizesLocation as FileLocation,
|
|
32
|
-
this.pluginManager,
|
|
11
|
+
async setupPre() {
|
|
12
|
+
const pm = this.pluginManager
|
|
13
|
+
const file = openLocation(this.getConf('chromSizesLocation'), pm)
|
|
14
|
+
const data = await file.readFile('utf8')
|
|
15
|
+
return Object.fromEntries(
|
|
16
|
+
data
|
|
17
|
+
.split('\n')
|
|
18
|
+
.map(f => f.trim())
|
|
19
|
+
.filter(f => !!f)
|
|
20
|
+
.map((line: string) => {
|
|
21
|
+
const [name, length] = line.split('\t')
|
|
22
|
+
return [name, +length]
|
|
23
|
+
}),
|
|
33
24
|
)
|
|
34
|
-
this.source = file.toString()
|
|
35
|
-
this.refSeqs = this.init(file)
|
|
36
25
|
}
|
|
37
26
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
async setup() {
|
|
28
|
+
if (!this.setupP) {
|
|
29
|
+
this.setupP = this.setupPre().catch(e => {
|
|
30
|
+
this.setupP = undefined
|
|
31
|
+
throw e
|
|
32
|
+
})
|
|
43
33
|
}
|
|
44
|
-
|
|
45
|
-
if (line.length) {
|
|
46
|
-
const [name, length] = line.split('\t')
|
|
47
|
-
refSeqs[name] = +length
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
return refSeqs
|
|
34
|
+
return this.setupP
|
|
51
35
|
}
|
|
52
36
|
|
|
53
37
|
public async getRegions() {
|
|
54
|
-
const refSeqs = await this.
|
|
38
|
+
const refSeqs = await this.setup()
|
|
55
39
|
return Object.keys(refSeqs).map(refName => ({
|
|
56
40
|
refName,
|
|
57
41
|
start: 0,
|