@jbrowse/plugin-bed 2.18.0 → 3.0.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/BedAdapter/index.js +17 -7
- package/dist/BedGraphAdapter/index.js +17 -7
- package/dist/BedGraphTabixAdapter/BedGraphTabixAdapter.js +3 -0
- package/dist/BedGraphTabixAdapter/index.js +17 -7
- package/dist/BedTabixAdapter/index.js +17 -7
- package/dist/BedpeAdapter/BedpeAdapter.d.ts +0 -2
- package/dist/BedpeAdapter/BedpeAdapter.js +4 -60
- package/dist/BedpeAdapter/index.js +17 -7
- package/dist/BedpeAdapter/util.d.ts +2 -0
- package/dist/BedpeAdapter/util.js +55 -0
- package/dist/BigBedAdapter/configSchema.js +1 -1
- package/dist/BigBedAdapter/index.js +17 -7
- package/dist/GuessAdapter/index.d.ts +2 -0
- package/dist/GuessAdapter/index.js +68 -0
- package/dist/generateBedMethylFeature.js +3 -1
- package/dist/generateRepeatMaskerFeature.js +2 -1
- package/dist/generateUcscTranscript.js +4 -0
- package/dist/index.js +2 -69
- package/esm/BedGraphTabixAdapter/BedGraphTabixAdapter.js +3 -0
- package/esm/BedpeAdapter/BedpeAdapter.d.ts +0 -2
- package/esm/BedpeAdapter/BedpeAdapter.js +3 -58
- package/esm/BedpeAdapter/util.d.ts +2 -0
- package/esm/BedpeAdapter/util.js +52 -0
- package/esm/BigBedAdapter/configSchema.js +1 -1
- package/esm/GuessAdapter/index.d.ts +2 -0
- package/esm/GuessAdapter/index.js +65 -0
- package/esm/generateBedMethylFeature.js +3 -1
- package/esm/generateRepeatMaskerFeature.js +2 -1
- package/esm/generateUcscTranscript.js +4 -0
- package/esm/index.js +2 -69
- package/package.json +5 -5
package/dist/BedAdapter/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -77,6 +77,9 @@ class BedGraphAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
77
77
|
const start = +cols[colStart];
|
|
78
78
|
const end = +(same ? start + 1 : cols[colEnd]);
|
|
79
79
|
const rest = cols.slice(colEnd + 1);
|
|
80
|
+
if (Number.isNaN(start) || Number.isNaN(end)) {
|
|
81
|
+
throw new Error(`start/end NaN on line "${line}", with colStart:${colStart} and colEnd:${colEnd}. run "tabix -p bed" to ensure bed preset`);
|
|
82
|
+
}
|
|
80
83
|
for (let j = 0; j < rest.length; j++) {
|
|
81
84
|
const uniqueId = `${this.id}-${fileOffset}-${j}`;
|
|
82
85
|
const score = Math.abs(+rest[j]);
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import IntervalTree from '@flatten-js/interval-tree';
|
|
2
2
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
-
import { SimpleFeature } from '@jbrowse/core/util';
|
|
4
3
|
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
5
4
|
import type { Feature, Region } from '@jbrowse/core/util';
|
|
6
|
-
export declare function featureData(line: string, uniqueId: string, flip: boolean, names?: string[]): SimpleFeature;
|
|
7
5
|
export default class BedpeAdapter extends BaseFeatureDataAdapter {
|
|
8
6
|
protected bedpeFeatures?: Promise<{
|
|
9
7
|
header: string;
|
|
@@ -3,75 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.featureData = featureData;
|
|
7
6
|
const interval_tree_1 = __importDefault(require("@flatten-js/interval-tree"));
|
|
8
7
|
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
9
8
|
const util_1 = require("@jbrowse/core/util");
|
|
10
9
|
const io_1 = require("@jbrowse/core/util/io");
|
|
11
10
|
const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
12
|
-
const
|
|
13
|
-
function featureData(line, uniqueId, flip, names) {
|
|
14
|
-
const l = line.split('\t');
|
|
15
|
-
const ref1 = l[flip ? 3 : 0];
|
|
16
|
-
const start1 = +l[flip ? 4 : 1];
|
|
17
|
-
const end1 = +l[flip ? 5 : 2];
|
|
18
|
-
const ref2 = l[!flip ? 3 : 0];
|
|
19
|
-
const start2 = +l[!flip ? 4 : 1];
|
|
20
|
-
const end2 = +l[!flip ? 5 : 2];
|
|
21
|
-
const name = l[6];
|
|
22
|
-
const score = +l[7];
|
|
23
|
-
const strand1 = parseStrand(l[8]);
|
|
24
|
-
const strand2 = parseStrand(l[9]);
|
|
25
|
-
const extra = l.slice(10);
|
|
26
|
-
const rest = names
|
|
27
|
-
? Object.fromEntries(names.slice(10).map((n, idx) => [n, extra[idx]]))
|
|
28
|
-
: extra;
|
|
29
|
-
const ALT = svTypes.has(extra[0]) ? `<${extra[0]}>` : undefined;
|
|
30
|
-
return new util_1.SimpleFeature({
|
|
31
|
-
...rest,
|
|
32
|
-
start: start1,
|
|
33
|
-
end: end1,
|
|
34
|
-
type: 'paired_feature',
|
|
35
|
-
refName: ref1,
|
|
36
|
-
strand: strand1,
|
|
37
|
-
name,
|
|
38
|
-
score,
|
|
39
|
-
uniqueId,
|
|
40
|
-
mate: {
|
|
41
|
-
refName: ref2,
|
|
42
|
-
start: start2,
|
|
43
|
-
end: end2,
|
|
44
|
-
strand: strand2,
|
|
45
|
-
},
|
|
46
|
-
...(ALT ? { ALT: [ALT] } : {}),
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
function parseStrand(strand) {
|
|
50
|
-
if (strand === '+') {
|
|
51
|
-
return 1;
|
|
52
|
-
}
|
|
53
|
-
if (strand === '-') {
|
|
54
|
-
return -1;
|
|
55
|
-
}
|
|
56
|
-
if (strand === '.') {
|
|
57
|
-
return 0;
|
|
58
|
-
}
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
11
|
+
const util_2 = require("./util");
|
|
61
12
|
class BedpeAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
62
13
|
constructor() {
|
|
63
14
|
super(...arguments);
|
|
64
15
|
this.intervalTrees = {};
|
|
65
16
|
}
|
|
66
17
|
async loadDataP(opts) {
|
|
67
|
-
const
|
|
68
|
-
const bedLoc = this.getConf('bedpeLocation');
|
|
69
|
-
const loc = (0, io_1.openLocation)(bedLoc, pm);
|
|
70
|
-
const buffer = await (0, util_1.fetchAndMaybeUnzip)(loc, opts);
|
|
71
|
-
if (buffer.length > 536870888) {
|
|
72
|
-
throw new Error('Data exceeds maximum string length (512MB)');
|
|
73
|
-
}
|
|
74
|
-
const data = new TextDecoder('utf8', { fatal: true }).decode(buffer);
|
|
18
|
+
const data = await (0, util_1.fetchAndMaybeUnzipText)((0, io_1.openLocation)(this.getConf('bedpeLocation'), this.pluginManager), opts);
|
|
75
19
|
const lines = data.split(/\n|\r\n|\r/).filter(f => !!f);
|
|
76
20
|
const headerLines = [];
|
|
77
21
|
let i = 0;
|
|
@@ -139,8 +83,8 @@ class BedpeAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
139
83
|
const { feats1, feats2 } = await this.loadData();
|
|
140
84
|
const names = await this.getNames();
|
|
141
85
|
const intervalTree = new interval_tree_1.default();
|
|
142
|
-
const ret1 = (_b = (_a = feats1[refName]) === null || _a === void 0 ? void 0 : _a.map((f, i) => featureData(f, `${this.id}-${refName}-${i}-r1`, false, names))) !== null && _b !== void 0 ? _b : [];
|
|
143
|
-
const ret2 = (_d = (_c = feats2[refName]) === null || _c === void 0 ? void 0 : _c.map((f, i) => featureData(f, `${this.id}-${refName}-${i}-r2`, true, names))) !== null && _d !== void 0 ? _d : [];
|
|
86
|
+
const ret1 = (_b = (_a = feats1[refName]) === null || _a === void 0 ? void 0 : _a.map((f, i) => (0, util_2.featureData)(f, `${this.id}-${refName}-${i}-r1`, false, names))) !== null && _b !== void 0 ? _b : [];
|
|
87
|
+
const ret2 = (_d = (_c = feats2[refName]) === null || _c === void 0 ? void 0 : _c.map((f, i) => (0, util_2.featureData)(f, `${this.id}-${refName}-${i}-r2`, true, names))) !== null && _d !== void 0 ? _d : [];
|
|
144
88
|
for (const obj of [...ret1, ...ret2]) {
|
|
145
89
|
intervalTree.insert([obj.get('start'), obj.get('end')], obj);
|
|
146
90
|
}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.featureData = featureData;
|
|
4
|
+
const util_1 = require("@jbrowse/core/util");
|
|
5
|
+
const svTypes = new Set(['DUP', 'TRA', 'INV', 'CNV', 'DEL']);
|
|
6
|
+
function featureData(line, uniqueId, flip, names) {
|
|
7
|
+
const l = line.split('\t');
|
|
8
|
+
const ref1 = l[flip ? 3 : 0];
|
|
9
|
+
const start1 = +l[flip ? 4 : 1];
|
|
10
|
+
const end1 = +l[flip ? 5 : 2];
|
|
11
|
+
const ref2 = l[!flip ? 3 : 0];
|
|
12
|
+
const start2 = +l[!flip ? 4 : 1];
|
|
13
|
+
const end2 = +l[!flip ? 5 : 2];
|
|
14
|
+
const name = l[6];
|
|
15
|
+
const score = +l[7];
|
|
16
|
+
const strand1 = parseStrand(l[8]);
|
|
17
|
+
const strand2 = parseStrand(l[9]);
|
|
18
|
+
const extra = l.slice(10);
|
|
19
|
+
const rest = names
|
|
20
|
+
? Object.fromEntries(names.slice(10).map((n, idx) => [n, extra[idx]]))
|
|
21
|
+
: {};
|
|
22
|
+
const ALT = svTypes.has(extra[0]) ? `<${extra[0]}>` : undefined;
|
|
23
|
+
return new util_1.SimpleFeature({
|
|
24
|
+
...rest,
|
|
25
|
+
start: start1,
|
|
26
|
+
end: end1,
|
|
27
|
+
type: 'paired_feature',
|
|
28
|
+
refName: ref1,
|
|
29
|
+
strand: strand1,
|
|
30
|
+
name,
|
|
31
|
+
score,
|
|
32
|
+
uniqueId,
|
|
33
|
+
mate: {
|
|
34
|
+
refName: ref2,
|
|
35
|
+
start: start2,
|
|
36
|
+
end: end2,
|
|
37
|
+
strand: strand2,
|
|
38
|
+
},
|
|
39
|
+
...(ALT ? { ALT: [ALT] } : {}),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function parseStrand(strand) {
|
|
43
|
+
if (strand === '+') {
|
|
44
|
+
return 1;
|
|
45
|
+
}
|
|
46
|
+
else if (strand === '-') {
|
|
47
|
+
return -1;
|
|
48
|
+
}
|
|
49
|
+
else if (strand === '.') {
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -15,7 +15,7 @@ const BigBedAdapter = (0, configuration_1.ConfigurationSchema)('BigBedAdapter',
|
|
|
15
15
|
aggregateField: {
|
|
16
16
|
type: 'string',
|
|
17
17
|
description: 'An attribute to aggregate features with',
|
|
18
|
-
defaultValue: '
|
|
18
|
+
defaultValue: 'geneName2',
|
|
19
19
|
},
|
|
20
20
|
}, { explicitlyTyped: true });
|
|
21
21
|
exports.default = BigBedAdapter;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = GuessAdapterF;
|
|
4
|
+
const util_1 = require("@jbrowse/core/util");
|
|
5
|
+
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
6
|
+
function GuessAdapterF(pluginManager) {
|
|
7
|
+
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
|
|
8
|
+
return (file, index, adapterHint) => {
|
|
9
|
+
const fileName = (0, tracks_1.getFileName)(file);
|
|
10
|
+
const indexName = index && (0, tracks_1.getFileName)(index);
|
|
11
|
+
if ((0, util_1.testAdapter)(fileName, /\.bedpe(\.gz)?$/i, adapterHint, 'BedpeAdapter')) {
|
|
12
|
+
return {
|
|
13
|
+
type: 'BedpeAdapter',
|
|
14
|
+
bedpeLocation: file,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
else if ((0, util_1.testAdapter)(fileName, /\.bb$/i, adapterHint, 'BigBedAdapter') ||
|
|
18
|
+
(0, util_1.testAdapter)(fileName, /\.bigBed?$/i, adapterHint, 'BigBedAdapter')) {
|
|
19
|
+
return {
|
|
20
|
+
type: 'BigBedAdapter',
|
|
21
|
+
bigBedLocation: file,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
else if ((0, util_1.testAdapter)(fileName, /\.bed$/i, adapterHint, 'BedAdapter')) {
|
|
25
|
+
return {
|
|
26
|
+
type: 'BedAdapter',
|
|
27
|
+
bedLocation: file,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
else if ((0, util_1.testAdapter)(fileName, /\.bg$/i, adapterHint, 'BedGraphAdapter')) {
|
|
31
|
+
return {
|
|
32
|
+
type: 'BedGraphAdapter',
|
|
33
|
+
bedGraphLocation: file,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
else if ((0, util_1.testAdapter)(fileName, /\.bg(\.gz)?$/i, adapterHint, 'BedGraphTabixAdapter')) {
|
|
37
|
+
return {
|
|
38
|
+
type: 'BedGraphTabixAdapter',
|
|
39
|
+
bedGraphGzLocation: file,
|
|
40
|
+
index: {
|
|
41
|
+
location: index || (0, tracks_1.makeIndex)(file, '.tbi'),
|
|
42
|
+
indexType: (0, tracks_1.makeIndexType)(indexName, 'CSI', 'TBI'),
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
else if ((0, util_1.testAdapter)(fileName, /\.bed\.gz$/i, adapterHint, 'BedTabixAdapter')) {
|
|
47
|
+
return {
|
|
48
|
+
type: 'BedTabixAdapter',
|
|
49
|
+
bedGzLocation: file,
|
|
50
|
+
index: {
|
|
51
|
+
location: index || (0, tracks_1.makeIndex)(file, '.tbi'),
|
|
52
|
+
indexType: (0, tracks_1.makeIndexType)(indexName, 'CSI', 'TBI'),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
return adapterGuesser(file, index, adapterHint);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', (trackTypeGuesser) => (adapterName) => {
|
|
62
|
+
return ({
|
|
63
|
+
BedpeAdapter: 'VariantTrack',
|
|
64
|
+
BedGraphAdapter: 'QuantitativeTrack',
|
|
65
|
+
BedGraphTabixAdapter: 'QuantitativeTrack',
|
|
66
|
+
}[adapterName] || trackTypeGuesser(adapterName));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isBedMethylFeature = isBedMethylFeature;
|
|
4
4
|
exports.generateBedMethylFeature = generateBedMethylFeature;
|
|
5
5
|
function isBedMethylFeature({ splitLine, start, end, }) {
|
|
6
|
-
return +(splitLine[6] || 0) === start &&
|
|
6
|
+
return (+(splitLine[6] || 0) === start &&
|
|
7
|
+
+(splitLine[7] || 0) === end &&
|
|
8
|
+
[9, 10, 11, 12, 13, 14, 15, 16, 17].every(r => splitLine[r] && !Number.isNaN(+splitLine[r])));
|
|
7
9
|
}
|
|
8
10
|
function generateBedMethylFeature({ splitLine, uniqueId, refName, start, end, }) {
|
|
9
11
|
const [, , , code, , strand, , , color, n_valid_cov, fraction_modified, n_mod, n_canonical, n_other_mod, n_delete, n_fail, n_diff, n_nocall,] = splitLine;
|
|
@@ -30,8 +30,9 @@ function makeRepeatTrackDescription(description) {
|
|
|
30
30
|
return { description };
|
|
31
31
|
}
|
|
32
32
|
function generateRepeatMaskerFeature({ uniqueId, refName, start, end, description, ...rest }) {
|
|
33
|
+
const { subfeatures, ...rest2 } = rest;
|
|
33
34
|
return {
|
|
34
|
-
...
|
|
35
|
+
...rest2,
|
|
35
36
|
...makeRepeatTrackDescription(description),
|
|
36
37
|
uniqueId,
|
|
37
38
|
refName,
|
|
@@ -31,6 +31,7 @@ function generateUcscTranscript(data) {
|
|
|
31
31
|
refName,
|
|
32
32
|
}, {
|
|
33
33
|
type: 'CDS',
|
|
34
|
+
phase: 0,
|
|
34
35
|
start: thickStart,
|
|
35
36
|
end,
|
|
36
37
|
refName,
|
|
@@ -39,6 +40,7 @@ function generateUcscTranscript(data) {
|
|
|
39
40
|
else if (thickStart <= start && thickEnd >= end) {
|
|
40
41
|
subfeatures.push({
|
|
41
42
|
type: 'CDS',
|
|
43
|
+
phase: 0,
|
|
42
44
|
start,
|
|
43
45
|
end,
|
|
44
46
|
refName,
|
|
@@ -52,6 +54,7 @@ function generateUcscTranscript(data) {
|
|
|
52
54
|
refName,
|
|
53
55
|
}, {
|
|
54
56
|
type: 'CDS',
|
|
57
|
+
phase: 0,
|
|
55
58
|
start: thickStart,
|
|
56
59
|
end: thickEnd,
|
|
57
60
|
refName,
|
|
@@ -65,6 +68,7 @@ function generateUcscTranscript(data) {
|
|
|
65
68
|
else if (thickStart <= start && thickEnd > start && thickEnd < end) {
|
|
66
69
|
subfeatures.push({
|
|
67
70
|
type: 'CDS',
|
|
71
|
+
phase: 0,
|
|
68
72
|
start,
|
|
69
73
|
end: thickEnd,
|
|
70
74
|
refName,
|
package/dist/index.js
CHANGED
|
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
|
|
7
|
-
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
8
7
|
const BedAdapter_1 = __importDefault(require("./BedAdapter"));
|
|
9
8
|
const BedGraphAdapter_1 = __importDefault(require("./BedGraphAdapter"));
|
|
10
9
|
const BedGraphTabixAdapter_1 = __importDefault(require("./BedGraphTabixAdapter"));
|
|
11
10
|
const BedTabixAdapter_1 = __importDefault(require("./BedTabixAdapter"));
|
|
12
11
|
const BedpeAdapter_1 = __importDefault(require("./BedpeAdapter"));
|
|
13
12
|
const BigBedAdapter_1 = __importDefault(require("./BigBedAdapter"));
|
|
13
|
+
const GuessAdapter_1 = __importDefault(require("./GuessAdapter"));
|
|
14
14
|
class BedPlugin extends Plugin_1.default {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
@@ -23,74 +23,7 @@ class BedPlugin extends Plugin_1.default {
|
|
|
23
23
|
(0, BedTabixAdapter_1.default)(pluginManager);
|
|
24
24
|
(0, BedGraphAdapter_1.default)(pluginManager);
|
|
25
25
|
(0, BedGraphTabixAdapter_1.default)(pluginManager);
|
|
26
|
-
|
|
27
|
-
return (file, index, adapterHint) => {
|
|
28
|
-
const regexGuess = /\.(bb|bigbed)$/i;
|
|
29
|
-
const adapterName = 'BigBedAdapter';
|
|
30
|
-
const fileName = (0, tracks_1.getFileName)(file);
|
|
31
|
-
const obj = {
|
|
32
|
-
type: adapterName,
|
|
33
|
-
bigBedLocation: file,
|
|
34
|
-
};
|
|
35
|
-
if (regexGuess.test(fileName) && !adapterHint) {
|
|
36
|
-
return obj;
|
|
37
|
-
}
|
|
38
|
-
if (adapterHint === adapterName) {
|
|
39
|
-
return obj;
|
|
40
|
-
}
|
|
41
|
-
return adapterGuesser(file, index, adapterHint);
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
|
|
45
|
-
return (file, index, adapterHint) => {
|
|
46
|
-
const regexGuess = /\.bedpe(\.gz)?$/i;
|
|
47
|
-
const adapterName = 'BedpeAdapter';
|
|
48
|
-
const fileName = (0, tracks_1.getFileName)(file);
|
|
49
|
-
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
50
|
-
return {
|
|
51
|
-
type: adapterName,
|
|
52
|
-
bedpeLocation: file,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
return adapterGuesser(file, index, adapterHint);
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
|
|
59
|
-
return (file, index, adapterHint) => {
|
|
60
|
-
const regexGuess = /\.bed\.b?gz$/i;
|
|
61
|
-
const adapterName = 'BedTabixAdapter';
|
|
62
|
-
const fileName = (0, tracks_1.getFileName)(file);
|
|
63
|
-
const indexName = index && (0, tracks_1.getFileName)(index);
|
|
64
|
-
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
65
|
-
return {
|
|
66
|
-
type: adapterName,
|
|
67
|
-
bedGzLocation: file,
|
|
68
|
-
index: {
|
|
69
|
-
location: index || (0, tracks_1.makeIndex)(file, '.tbi'),
|
|
70
|
-
indexType: (0, tracks_1.makeIndexType)(indexName, 'CSI', 'TBI'),
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
return adapterGuesser(file, index, adapterHint);
|
|
75
|
-
};
|
|
76
|
-
});
|
|
77
|
-
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
|
|
78
|
-
return (file, index, adapterHint) => {
|
|
79
|
-
const regexGuess = /\.bed$/i;
|
|
80
|
-
const adapterName = 'BedAdapter';
|
|
81
|
-
const fileName = (0, tracks_1.getFileName)(file);
|
|
82
|
-
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
83
|
-
return {
|
|
84
|
-
type: adapterName,
|
|
85
|
-
bedLocation: file,
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
return adapterGuesser(file, index, adapterHint);
|
|
89
|
-
};
|
|
90
|
-
});
|
|
91
|
-
pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', (trackTypeGuesser) => (adapterName) => adapterName === 'BedpeAdapter'
|
|
92
|
-
? 'VariantTrack'
|
|
93
|
-
: trackTypeGuesser(adapterName));
|
|
26
|
+
(0, GuessAdapter_1.default)(pluginManager);
|
|
94
27
|
}
|
|
95
28
|
}
|
|
96
29
|
exports.default = BedPlugin;
|
|
@@ -75,6 +75,9 @@ export default class BedGraphAdapter extends BaseFeatureDataAdapter {
|
|
|
75
75
|
const start = +cols[colStart];
|
|
76
76
|
const end = +(same ? start + 1 : cols[colEnd]);
|
|
77
77
|
const rest = cols.slice(colEnd + 1);
|
|
78
|
+
if (Number.isNaN(start) || Number.isNaN(end)) {
|
|
79
|
+
throw new Error(`start/end NaN on line "${line}", with colStart:${colStart} and colEnd:${colEnd}. run "tabix -p bed" to ensure bed preset`);
|
|
80
|
+
}
|
|
78
81
|
for (let j = 0; j < rest.length; j++) {
|
|
79
82
|
const uniqueId = `${this.id}-${fileOffset}-${j}`;
|
|
80
83
|
const score = Math.abs(+rest[j]);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import IntervalTree from '@flatten-js/interval-tree';
|
|
2
2
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
-
import { SimpleFeature } from '@jbrowse/core/util';
|
|
4
3
|
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
5
4
|
import type { Feature, Region } from '@jbrowse/core/util';
|
|
6
|
-
export declare function featureData(line: string, uniqueId: string, flip: boolean, names?: string[]): SimpleFeature;
|
|
7
5
|
export default class BedpeAdapter extends BaseFeatureDataAdapter {
|
|
8
6
|
protected bedpeFeatures?: Promise<{
|
|
9
7
|
header: string;
|
|
@@ -1,71 +1,16 @@
|
|
|
1
1
|
import IntervalTree from '@flatten-js/interval-tree';
|
|
2
2
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
-
import {
|
|
3
|
+
import { fetchAndMaybeUnzipText } from '@jbrowse/core/util';
|
|
4
4
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
5
5
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
6
|
-
|
|
7
|
-
export function featureData(line, uniqueId, flip, names) {
|
|
8
|
-
const l = line.split('\t');
|
|
9
|
-
const ref1 = l[flip ? 3 : 0];
|
|
10
|
-
const start1 = +l[flip ? 4 : 1];
|
|
11
|
-
const end1 = +l[flip ? 5 : 2];
|
|
12
|
-
const ref2 = l[!flip ? 3 : 0];
|
|
13
|
-
const start2 = +l[!flip ? 4 : 1];
|
|
14
|
-
const end2 = +l[!flip ? 5 : 2];
|
|
15
|
-
const name = l[6];
|
|
16
|
-
const score = +l[7];
|
|
17
|
-
const strand1 = parseStrand(l[8]);
|
|
18
|
-
const strand2 = parseStrand(l[9]);
|
|
19
|
-
const extra = l.slice(10);
|
|
20
|
-
const rest = names
|
|
21
|
-
? Object.fromEntries(names.slice(10).map((n, idx) => [n, extra[idx]]))
|
|
22
|
-
: extra;
|
|
23
|
-
const ALT = svTypes.has(extra[0]) ? `<${extra[0]}>` : undefined;
|
|
24
|
-
return new SimpleFeature({
|
|
25
|
-
...rest,
|
|
26
|
-
start: start1,
|
|
27
|
-
end: end1,
|
|
28
|
-
type: 'paired_feature',
|
|
29
|
-
refName: ref1,
|
|
30
|
-
strand: strand1,
|
|
31
|
-
name,
|
|
32
|
-
score,
|
|
33
|
-
uniqueId,
|
|
34
|
-
mate: {
|
|
35
|
-
refName: ref2,
|
|
36
|
-
start: start2,
|
|
37
|
-
end: end2,
|
|
38
|
-
strand: strand2,
|
|
39
|
-
},
|
|
40
|
-
...(ALT ? { ALT: [ALT] } : {}),
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function parseStrand(strand) {
|
|
44
|
-
if (strand === '+') {
|
|
45
|
-
return 1;
|
|
46
|
-
}
|
|
47
|
-
if (strand === '-') {
|
|
48
|
-
return -1;
|
|
49
|
-
}
|
|
50
|
-
if (strand === '.') {
|
|
51
|
-
return 0;
|
|
52
|
-
}
|
|
53
|
-
return undefined;
|
|
54
|
-
}
|
|
6
|
+
import { featureData } from './util';
|
|
55
7
|
class BedpeAdapter extends BaseFeatureDataAdapter {
|
|
56
8
|
constructor() {
|
|
57
9
|
super(...arguments);
|
|
58
10
|
this.intervalTrees = {};
|
|
59
11
|
}
|
|
60
12
|
async loadDataP(opts) {
|
|
61
|
-
const
|
|
62
|
-
const bedLoc = this.getConf('bedpeLocation');
|
|
63
|
-
const loc = openLocation(bedLoc, pm);
|
|
64
|
-
const buffer = await fetchAndMaybeUnzip(loc, opts);
|
|
65
|
-
if (buffer.length > 536870888) {
|
|
66
|
-
throw new Error('Data exceeds maximum string length (512MB)');
|
|
67
|
-
}
|
|
68
|
-
const data = new TextDecoder('utf8', { fatal: true }).decode(buffer);
|
|
13
|
+
const data = await fetchAndMaybeUnzipText(openLocation(this.getConf('bedpeLocation'), this.pluginManager), opts);
|
|
69
14
|
const lines = data.split(/\n|\r\n|\r/).filter(f => !!f);
|
|
70
15
|
const headerLines = [];
|
|
71
16
|
let i = 0;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { SimpleFeature } from '@jbrowse/core/util';
|
|
2
|
+
const svTypes = new Set(['DUP', 'TRA', 'INV', 'CNV', 'DEL']);
|
|
3
|
+
export function featureData(line, uniqueId, flip, names) {
|
|
4
|
+
const l = line.split('\t');
|
|
5
|
+
const ref1 = l[flip ? 3 : 0];
|
|
6
|
+
const start1 = +l[flip ? 4 : 1];
|
|
7
|
+
const end1 = +l[flip ? 5 : 2];
|
|
8
|
+
const ref2 = l[!flip ? 3 : 0];
|
|
9
|
+
const start2 = +l[!flip ? 4 : 1];
|
|
10
|
+
const end2 = +l[!flip ? 5 : 2];
|
|
11
|
+
const name = l[6];
|
|
12
|
+
const score = +l[7];
|
|
13
|
+
const strand1 = parseStrand(l[8]);
|
|
14
|
+
const strand2 = parseStrand(l[9]);
|
|
15
|
+
const extra = l.slice(10);
|
|
16
|
+
const rest = names
|
|
17
|
+
? Object.fromEntries(names.slice(10).map((n, idx) => [n, extra[idx]]))
|
|
18
|
+
: {};
|
|
19
|
+
const ALT = svTypes.has(extra[0]) ? `<${extra[0]}>` : undefined;
|
|
20
|
+
return new SimpleFeature({
|
|
21
|
+
...rest,
|
|
22
|
+
start: start1,
|
|
23
|
+
end: end1,
|
|
24
|
+
type: 'paired_feature',
|
|
25
|
+
refName: ref1,
|
|
26
|
+
strand: strand1,
|
|
27
|
+
name,
|
|
28
|
+
score,
|
|
29
|
+
uniqueId,
|
|
30
|
+
mate: {
|
|
31
|
+
refName: ref2,
|
|
32
|
+
start: start2,
|
|
33
|
+
end: end2,
|
|
34
|
+
strand: strand2,
|
|
35
|
+
},
|
|
36
|
+
...(ALT ? { ALT: [ALT] } : {}),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function parseStrand(strand) {
|
|
40
|
+
if (strand === '+') {
|
|
41
|
+
return 1;
|
|
42
|
+
}
|
|
43
|
+
else if (strand === '-') {
|
|
44
|
+
return -1;
|
|
45
|
+
}
|
|
46
|
+
else if (strand === '.') {
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -13,7 +13,7 @@ const BigBedAdapter = ConfigurationSchema('BigBedAdapter', {
|
|
|
13
13
|
aggregateField: {
|
|
14
14
|
type: 'string',
|
|
15
15
|
description: 'An attribute to aggregate features with',
|
|
16
|
-
defaultValue: '
|
|
16
|
+
defaultValue: 'geneName2',
|
|
17
17
|
},
|
|
18
18
|
}, { explicitlyTyped: true });
|
|
19
19
|
export default BigBedAdapter;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { testAdapter } from '@jbrowse/core/util';
|
|
2
|
+
import { getFileName, makeIndex, makeIndexType, } from '@jbrowse/core/util/tracks';
|
|
3
|
+
export default function GuessAdapterF(pluginManager) {
|
|
4
|
+
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
|
|
5
|
+
return (file, index, adapterHint) => {
|
|
6
|
+
const fileName = getFileName(file);
|
|
7
|
+
const indexName = index && getFileName(index);
|
|
8
|
+
if (testAdapter(fileName, /\.bedpe(\.gz)?$/i, adapterHint, 'BedpeAdapter')) {
|
|
9
|
+
return {
|
|
10
|
+
type: 'BedpeAdapter',
|
|
11
|
+
bedpeLocation: file,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
else if (testAdapter(fileName, /\.bb$/i, adapterHint, 'BigBedAdapter') ||
|
|
15
|
+
testAdapter(fileName, /\.bigBed?$/i, adapterHint, 'BigBedAdapter')) {
|
|
16
|
+
return {
|
|
17
|
+
type: 'BigBedAdapter',
|
|
18
|
+
bigBedLocation: file,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
else if (testAdapter(fileName, /\.bed$/i, adapterHint, 'BedAdapter')) {
|
|
22
|
+
return {
|
|
23
|
+
type: 'BedAdapter',
|
|
24
|
+
bedLocation: file,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
else if (testAdapter(fileName, /\.bg$/i, adapterHint, 'BedGraphAdapter')) {
|
|
28
|
+
return {
|
|
29
|
+
type: 'BedGraphAdapter',
|
|
30
|
+
bedGraphLocation: file,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
else if (testAdapter(fileName, /\.bg(\.gz)?$/i, adapterHint, 'BedGraphTabixAdapter')) {
|
|
34
|
+
return {
|
|
35
|
+
type: 'BedGraphTabixAdapter',
|
|
36
|
+
bedGraphGzLocation: file,
|
|
37
|
+
index: {
|
|
38
|
+
location: index || makeIndex(file, '.tbi'),
|
|
39
|
+
indexType: makeIndexType(indexName, 'CSI', 'TBI'),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
else if (testAdapter(fileName, /\.bed\.gz$/i, adapterHint, 'BedTabixAdapter')) {
|
|
44
|
+
return {
|
|
45
|
+
type: 'BedTabixAdapter',
|
|
46
|
+
bedGzLocation: file,
|
|
47
|
+
index: {
|
|
48
|
+
location: index || makeIndex(file, '.tbi'),
|
|
49
|
+
indexType: makeIndexType(indexName, 'CSI', 'TBI'),
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return adapterGuesser(file, index, adapterHint);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', (trackTypeGuesser) => (adapterName) => {
|
|
59
|
+
return ({
|
|
60
|
+
BedpeAdapter: 'VariantTrack',
|
|
61
|
+
BedGraphAdapter: 'QuantitativeTrack',
|
|
62
|
+
BedGraphTabixAdapter: 'QuantitativeTrack',
|
|
63
|
+
}[adapterName] || trackTypeGuesser(adapterName));
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export function isBedMethylFeature({ splitLine, start, end, }) {
|
|
2
|
-
return +(splitLine[6] || 0) === start &&
|
|
2
|
+
return (+(splitLine[6] || 0) === start &&
|
|
3
|
+
+(splitLine[7] || 0) === end &&
|
|
4
|
+
[9, 10, 11, 12, 13, 14, 15, 16, 17].every(r => splitLine[r] && !Number.isNaN(+splitLine[r])));
|
|
3
5
|
}
|
|
4
6
|
export function generateBedMethylFeature({ splitLine, uniqueId, refName, start, end, }) {
|
|
5
7
|
const [, , , code, , strand, , , color, n_valid_cov, fraction_modified, n_mod, n_canonical, n_other_mod, n_delete, n_fail, n_diff, n_nocall,] = splitLine;
|
|
@@ -26,8 +26,9 @@ function makeRepeatTrackDescription(description) {
|
|
|
26
26
|
return { description };
|
|
27
27
|
}
|
|
28
28
|
export function generateRepeatMaskerFeature({ uniqueId, refName, start, end, description, ...rest }) {
|
|
29
|
+
const { subfeatures, ...rest2 } = rest;
|
|
29
30
|
return {
|
|
30
|
-
...
|
|
31
|
+
...rest2,
|
|
31
32
|
...makeRepeatTrackDescription(description),
|
|
32
33
|
uniqueId,
|
|
33
34
|
refName,
|
|
@@ -27,6 +27,7 @@ export function generateUcscTranscript(data) {
|
|
|
27
27
|
refName,
|
|
28
28
|
}, {
|
|
29
29
|
type: 'CDS',
|
|
30
|
+
phase: 0,
|
|
30
31
|
start: thickStart,
|
|
31
32
|
end,
|
|
32
33
|
refName,
|
|
@@ -35,6 +36,7 @@ export function generateUcscTranscript(data) {
|
|
|
35
36
|
else if (thickStart <= start && thickEnd >= end) {
|
|
36
37
|
subfeatures.push({
|
|
37
38
|
type: 'CDS',
|
|
39
|
+
phase: 0,
|
|
38
40
|
start,
|
|
39
41
|
end,
|
|
40
42
|
refName,
|
|
@@ -48,6 +50,7 @@ export function generateUcscTranscript(data) {
|
|
|
48
50
|
refName,
|
|
49
51
|
}, {
|
|
50
52
|
type: 'CDS',
|
|
53
|
+
phase: 0,
|
|
51
54
|
start: thickStart,
|
|
52
55
|
end: thickEnd,
|
|
53
56
|
refName,
|
|
@@ -61,6 +64,7 @@ export function generateUcscTranscript(data) {
|
|
|
61
64
|
else if (thickStart <= start && thickEnd > start && thickEnd < end) {
|
|
62
65
|
subfeatures.push({
|
|
63
66
|
type: 'CDS',
|
|
67
|
+
phase: 0,
|
|
64
68
|
start,
|
|
65
69
|
end: thickEnd,
|
|
66
70
|
refName,
|
package/esm/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
-
import { getFileName, makeIndex, makeIndexType, } from '@jbrowse/core/util/tracks';
|
|
3
2
|
import BedAdapterF from './BedAdapter';
|
|
4
3
|
import BedGraphAdapterF from './BedGraphAdapter';
|
|
5
4
|
import BedGraphTabixAdapterF from './BedGraphTabixAdapter';
|
|
6
5
|
import BedTabixAdapterF from './BedTabixAdapter';
|
|
7
6
|
import BedpeAdapterF from './BedpeAdapter';
|
|
8
7
|
import BigBedAdapterF from './BigBedAdapter';
|
|
8
|
+
import GuessAdapterF from './GuessAdapter';
|
|
9
9
|
export default class BedPlugin extends Plugin {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
@@ -18,73 +18,6 @@ export default class BedPlugin extends Plugin {
|
|
|
18
18
|
BedTabixAdapterF(pluginManager);
|
|
19
19
|
BedGraphAdapterF(pluginManager);
|
|
20
20
|
BedGraphTabixAdapterF(pluginManager);
|
|
21
|
-
pluginManager
|
|
22
|
-
return (file, index, adapterHint) => {
|
|
23
|
-
const regexGuess = /\.(bb|bigbed)$/i;
|
|
24
|
-
const adapterName = 'BigBedAdapter';
|
|
25
|
-
const fileName = getFileName(file);
|
|
26
|
-
const obj = {
|
|
27
|
-
type: adapterName,
|
|
28
|
-
bigBedLocation: file,
|
|
29
|
-
};
|
|
30
|
-
if (regexGuess.test(fileName) && !adapterHint) {
|
|
31
|
-
return obj;
|
|
32
|
-
}
|
|
33
|
-
if (adapterHint === adapterName) {
|
|
34
|
-
return obj;
|
|
35
|
-
}
|
|
36
|
-
return adapterGuesser(file, index, adapterHint);
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
|
|
40
|
-
return (file, index, adapterHint) => {
|
|
41
|
-
const regexGuess = /\.bedpe(\.gz)?$/i;
|
|
42
|
-
const adapterName = 'BedpeAdapter';
|
|
43
|
-
const fileName = getFileName(file);
|
|
44
|
-
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
45
|
-
return {
|
|
46
|
-
type: adapterName,
|
|
47
|
-
bedpeLocation: file,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return adapterGuesser(file, index, adapterHint);
|
|
51
|
-
};
|
|
52
|
-
});
|
|
53
|
-
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
|
|
54
|
-
return (file, index, adapterHint) => {
|
|
55
|
-
const regexGuess = /\.bed\.b?gz$/i;
|
|
56
|
-
const adapterName = 'BedTabixAdapter';
|
|
57
|
-
const fileName = getFileName(file);
|
|
58
|
-
const indexName = index && getFileName(index);
|
|
59
|
-
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
60
|
-
return {
|
|
61
|
-
type: adapterName,
|
|
62
|
-
bedGzLocation: file,
|
|
63
|
-
index: {
|
|
64
|
-
location: index || makeIndex(file, '.tbi'),
|
|
65
|
-
indexType: makeIndexType(indexName, 'CSI', 'TBI'),
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
return adapterGuesser(file, index, adapterHint);
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
|
|
73
|
-
return (file, index, adapterHint) => {
|
|
74
|
-
const regexGuess = /\.bed$/i;
|
|
75
|
-
const adapterName = 'BedAdapter';
|
|
76
|
-
const fileName = getFileName(file);
|
|
77
|
-
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
78
|
-
return {
|
|
79
|
-
type: adapterName,
|
|
80
|
-
bedLocation: file,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
return adapterGuesser(file, index, adapterHint);
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', (trackTypeGuesser) => (adapterName) => adapterName === 'BedpeAdapter'
|
|
87
|
-
? 'VariantTrack'
|
|
88
|
-
: trackTypeGuesser(adapterName));
|
|
21
|
+
GuessAdapterF(pluginManager);
|
|
89
22
|
}
|
|
90
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-bed",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "JBrowse 2 bed adapters, tracks, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@flatten-js/interval-tree": "^1.0.15",
|
|
40
|
-
"@gmod/bbi": "^
|
|
40
|
+
"@gmod/bbi": "^6.0.0",
|
|
41
41
|
"@gmod/bed": "^2.1.2",
|
|
42
|
-
"@gmod/bgzf-filehandle": "^
|
|
43
|
-
"@gmod/tabix": "^
|
|
42
|
+
"@gmod/bgzf-filehandle": "^2.0.1",
|
|
43
|
+
"@gmod/tabix": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@jbrowse/core": "^2.0.0",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"distModule": "esm/index.js",
|
|
56
56
|
"srcModule": "src/index.ts",
|
|
57
57
|
"module": "esm/index.js",
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "2c6897f1fa732b1db5b094d1dca197e333e95319"
|
|
59
59
|
}
|